I am just trying to fill my ListView but I get a NullPointerException
Here is the code
String[] values = new String[] { "Reset Company", "Reset Demographic"};
ArrayAdapter<String> adapter = new ArrayAdapter<String(this,android.R.layout.simple_list_item_1, values);
settingsOptions.setAdapter(adapter);
The LogCat says there is a NullPointException on this line settingsOptions.setAdapter(adapter);
How can i resolve this?
You can resolve it by giving
settingsOptionsa valid value instead ofnull.Chances are you are doing a
findViewByIdwith an invalid id, or before the view is actually put there bysetContentView.