java.lang.NullPointerException: Attempt to invoke virtual method 'int android.view.View.getImportantForAccessibility()' on a null object reference
In your public View getView
method change return null;
to return convertView;
.
Attempt to invoke virtual method 'int android.view.View.getImportantForAccessibility()' on a null object reference
Hello Naresh Negi You have to just remove a single line from earthquakeAdapter
@Override
public View getView(int position, View convertView, ViewGroup parent) {
LayoutInflater earthquake = LayoutInflater.from(getContext());
// View customView = convertView;
if(convertView == null){
convertView = earthquake.inflate(R.layout.custom_layout,parent,false);
}
earthquake currentEarthquakeAdapter = getItem(position);
TextView Magnitude = (TextView) convertView.findViewById(R.id.magnitude);
Magnitude.setText(currentEarthquakeAdapter.get_magnitude());
TextView Location = (TextView) convertView.findViewById(R.id.location);
Location.setText(currentEarthquakeAdapter.get_location());
return convertView;
}
Use convertView instead of assigning every time. We have just assign only first time after that it will hold the reference of the view in adapter
Related Topics
Android - Swipe to Delete Recyclerview
How to Request Root Access in Android
How to Programmatically Add a Submenu Item to the New Material Design Android Support Library
Android - Print Full Exception Backtrace to Log
Android Spinner with Different Layouts for "Drop Down State" and "Closed State"
Sending a File Using Bluetooth Obex Object Push Profile (Opp)
Create SQLite Database in Android
Android- How to Convert Android.Net.Uri Object to Java.Net.Uri Object
Illegalstateexception: Can't Change Container Id of Fragment
Android 1.5: Reading Sms Messages
Android Accelerometer Not Working When Screen Is Turned Off
How to Implement Export SQLite to Excel/CSV File in Android
Adding Tab Inside Fragment in Android
Detect Back Button But Don't Dismiss Dialogfragment
How to Populate Android Room Database Table on First Run
Justify Text in an Android App Using a Webview But Presenting a Textview-Like Interface