What does Context mean in Android

Possible Duplicate:
What is Context in Android?

I would like to have an answer on this question Android - SharedPreferences with serializable object:

LocalPersistence LP=new LocalPersistence();
Asortiment=(Nomenklatura) LP.readObjectFromFile(???, filename);

But can't understand what to pass instead of Context context in main activity?


If you are in the Activity , you can pass this . Otherwise (for example if you are inside another class), you can always use MyActivity.this to get a app-wide available reference to the activity object (there is always only one).

链接地址: http://www.djcxy.com/p/91366.html

上一篇: 在android中的上下文的重要性

下一篇: Android中的Context是什么意思