I am trying to develop a dictionary app using a predefined database SQLite here is the logs while its crashed.
2019-11-23 08:26:40.432 16132-16349/offline.english.dictionary W/CrashlyticsCore: Cannot send reports. Settings are unavailable.
2019-11-23 08:26:40.433 16132-16132/offline.english.dictionary E/UncaughtException: java.lang.NullPointerException: Attempt to invoke virtual method 'int android.database.CursorWindow.getNumRows()' on a null object reference
at android.database.sqlite.SQLiteCursor.fillWindow(SQLiteCursor.java:162)
at android.database.sqlite.SQLiteCursor.getCount(SQLiteCursor.java:149)
at android.support.v4.widget.CursorAdapter.getCount(CursorAdapter.java:217)
at android.widget.AutoCompleteTextView$PopupDataSetObserver$1.run(AutoCompleteTextView.java:1416)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7073)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:965)
Here is the SQLITECURSOR.java which showed error line:162
catch (RuntimeException ex) {
closeWindow();
throw ex;
}
}
This is SQLiteCursor.java:149 as per the crash log
mCount = mQuery.fillWindow(mWindow, requiredPos, requiredPos, true);
This is CursorAdapter.java:217 as per the crash log
private final Runnable updateRunnable = new Runnable() {
@Override
public void run() {
final AutoCompleteTextView textView = mViewReference.get();
if (textView == null) {
return;
}
final ListAdapter adapter = textView.mAdapter;
if (adapter == null) {
return;
}
textView.updateDropDownForFilter(adapter.getCount());
}
};
}
}
This is Handler.java:873,99 as per the crash log
private static void handleCallback(Message message) {
message.callback.run();
}
public void dispatchMessage(Message msg) {
if (msg.callback != null) {
handleCallback(msg);
} else {
if (mCallback != null) {
if (mCallback.handleMessage(msg)) {
return;
}
}
handleMessage(msg);
}
}
This is Looper.java:214 as per the crash report.
if (logSlowDispatch) {
showSlowLog(slowDispatchThresholdMs, dispatchStart, dispatchEnd, "dispatch", msg);
}
if (logging != null) {
logging.println("<<<<< Finished to " + msg.target + " " + msg.callback);
}