Thanks for the suggestion.. I have got a solution from the android dev forum
that i can also pass the class ref which extends Application as the
context.. So that has solved my problem rite now.. Will try out this
solution too..

On Tue, Dec 22, 2009 at 11:29 AM, Nithin <[email protected]> wrote:

> Hi,
>
> No need to extend activity. You should create a class and have a
> constructor, having the parameter as context
>
> class MySample {
>
> Context mContext;
> public MySample(Context context) {
> mContext = context;
> }
>
> }
>
> In MainActivity class, call this class as,
>
> MySample sample = new MySample(this);
>
>
>
> On Dec 20, 7:15 pm, Alok Kulkarni <[email protected]> wrote:
> > Hi guys,
> >
> > I have a database with 5 tables in it.There is a core layer which
> > communicates with the database and fetches the results and stores them in
> > memory temporarily.
> > Now my UI layer wishes to display the data retrieved by core layer in the
> > UI.
> > What i want to have ideally is to create an object of the core class and
> > call the DB operations whenever i want.The class which creates this core
> > object does not extend activity , but from examples i see , i need to
> pass
> > the activity as a context parameter to SQLiteOpenHelper.What context shd
> i
> > pass in that case ? There is also some concept of AsyncTask in Android
> but i
> > havent yet chkd how to use it.. Please help me on this one..
> Thanks..Alok.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Beginners" group.
>
> NEW! Try asking and tagging your question on Stack Overflow at
> http://stackoverflow.com/questions/tagged/android
>
> To unsubscribe from this group, send email to
> [email protected]<android-beginners%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/android-beginners?hl=en
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en

Reply via email to