I run the following code:
public class MainActivity extends ActionBarActivity
{
ExpandableListAdapter listAdapter;
ExpandableListView expListView;
List<String> listDataHeader;
HashMap<String, List<String>> listDataChild;
public static final String PREFS_NAME = "MyPrefsFile";
static SharedPreferences mPrefs;
SharedPreferences.Editor shPrefEditor;
public int BlackBackground=0, SleepScreen=1;
static MenuInflater inflater;
public ActionBar ab;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mPrefs = getSharedPreferences(PREFS_NAME, 0);
shPrefEditor = mPrefs.edit();
BlackBackground = mPrefs.getInt("BlackBackground", 0);
inflater = getMenuInflater();
...
The simulator is crash (NullPointerException) on:
inflater = getMenuInflater();
Anyone know why? And how can I fix it?