Hi, everybody. I'm new in Android and after doing some programming I'm facing this problem. In line 125 of my code in MainActivityAlertDialog where I set adapter for the listview lvInternalStorage.setAdapter(adapter); I get this error:
MainActivityAlertDialog: checkInternalStorage: NULLPOINTEREXCEPTION Attempt to invoke virtual method 'void android.widget.ListView.setAdapter(android.widget.ListAdapter)' on a null object reference
After googling I've found this error is because of line 124 of MainActivityAlertDialog ArrayAdapter<String> adapter = new ArrayAdapter<String>(MainActivityAlertDialog.this, android.R.layout.simple_list_item_1, FilePathStrings);
where anonymous onclicklistener cannot be converted to context , so If this is the case. What should I have to do?
I'll appreciate any help.