I have DataBase Table
in which i have COULMNS KEY_ID(INT)
, EMAIL(TEXT)
, PASSWORD(TEXT)
, FIRST_NAME(TEXT)
, LAST_NAME(TEXT)
I have a function in SqliteConnection Class :
public String Well(String el,String pl)
{
SQLiteDatabase pox =this.getReadableDatabase();
String qr="SELECT "+FIRST_NAME+" FROM "+TABLE_NAME+" WHERE "+EMAIL+" = "+el+" AND "+PASSWORD+" = "+pl;
Cursor cur =pox.rawQuery(qr,null);
String itemname = cur.getString(cur.getColumnIndex(FIRST_NAME));
pox.close();
cur.close();
return itemname;
}
In the above function i am passing EMAIL as e1
and PASSWORD as p1
and trying to fetch FIRST_NAME
of user that matches EMAIL and PASSWORD.
When i call this function inside any other activity than its causing a java.lang.NullPointerException
exception. Is there any problem in this function.
LogCat
12-02 11:02:36.943 2368-2368/? W/dalvikvm: VFY: unable to find class referenced in signature (Landroid/graphics/drawable/Icon;)
12-02 11:02:36.943 2368-2368/? I/dalvikvm: Could not find method android.widget.ImageView.setImageIcon, referenced from method android.support.v7.widget.AppCompatImageView.setImageIcon
12-02 11:02:36.943 2368-2368/? W/dalvikvm: VFY: unable to resolve virtual method 16525: Landroid/widget/ImageView;.setImageIcon (Landroid/graphics/drawable/Icon;)V
12-02 11:02:36.943 2368-2368/? D/dalvikvm: VFY: replacing opcode 0x6f at 0x0000
12-02 11:02:37.073 1559-1574/system_process W/ActivityManager: Launch timeout has expired, giving up wake lock!
12-02 11:02:38.343 1670-1681/com.android.inputmethod.latin W/Binder: Caught a RuntimeException from the binder stub implementation.
java.lang.NullPointerException
at android.inputmethodservice.IInputMethodWrapper.setSessionEnabled(IInputMethodWrapper.java:280)
at com.android.internal.view.IInputMethod$Stub.onTransact(IInputMethod.java:129)
at android.os.Binder.execTransact(Binder.java:404)
at dalvik.system.NativeStart.run(Native Method)
12-02 11:02:38.343 1559-1713/system_process W/InputMethodManagerService: Got RemoteException sending setActive(false) notification to pid 2323 uid 10055
12-02 11:02:38.353 2368-2368/com.example.sony.sqloperations I/Choreographer: Skipped 83 frames! The application may be doing too much work on its main thread.
12-02 11:02:40.533 1559-1573/system_process I/ActivityManager: Displayed com.example.sony.sqloperations/.MainActivity: +4s448ms (total +13s453ms)
12-02 11:03:00.013 1616-1616/com.android.systemui D/EGL_emulation: eglMakeCurrent: 0xb8f0e180: ver 2 0
12-02 11:03:00.093 1616-1616/com.android.systemui D/dalvikvm: GC_FOR_ALLOC freed 20284K, 67% free 10469K/30824K, paused 50ms, total 68ms