-1

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?

Community
  • 1
  • 1
user1884872
  • 197
  • 1
  • 3
  • 14

1 Answers1

1

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).

Bart Friederichs
  • 33,050
  • 15
  • 95
  • 195