Advertisement
Guest User

Untitled

a guest
Feb 18th, 2016
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. java.lang.IllegalStateException: Couldn't read row 0, col 2 from CursorWindow. Make sure the Cursor is initialized correctly before accessing data from it
  2.  
  3. mSubmit.setOnClickListener(new View.OnClickListener() {
  4. @Override
  5. public void onClick(View v) {
  6. SQLiteDatabase myDatabase=openOrCreateDatabase("Login",MODE_PRIVATE,null);
  7. myDatabase.execSQL("CREATE TABLE IF NOT EXISTS Login(Username VARCHAR,Password VARCHAR);");
  8. myDatabase.execSQL("INSERT INTO Login VALUES('"+mUserName.getText()+"','"+mPassword.getText()+"');");
  9.  
  10. }
  11. });
  12.  
  13. SQLiteDatabase myDatabase=openOrCreateDatabase("Login",MODE_PRIVATE,null);
  14.  
  15. Cursor result=myDatabase.rawQuery("Select * from Login",null);
  16. result.moveToFirst();
  17. String username= result.getString(1);
  18. String password=result.getString(2);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement