I have the following activity which extends ListActivity:
public class TweetActivity extends ListActivity {
SharedPreferences settings = this.getSharedPreferences("NewsTweetSettings", 0);
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
....
}
}
The line where I set the sharePreferences always causes the app to crash in the emulator, and I can’t find a reason why. Any ideas?
use the line in your oncreate() after calling the onCreate() super class implementation . It may help you
The reason is we dont have any value for ‘this’ before the line
super.onCreate(savedInstanceState);Happy Coding