2017-08-04 2 views
0

Chaque fois que j'appelle cette méthode, mon application se ferme.Chaque fois que j'appelle cette méthode, mon application se ferme

Voici le code:

public void getData(){ 
    dbObj=db.getReadableDatabase(); 
    Cursor cursor = dbObj.query(SignupEntries.Table_Name,null,"" +SignupEntries.email+ new String[] {primarypass} ,null,null,null,null); 
    while (cursor.moveToNext()){ 
     if(cursor.isFirst()){ 
      cursor.moveToFirst(); 
      primarypass= cursor.getString(cursor.getColumnIndex(SignupEntries.pass)); 
      if (primarypass.equals(PassHolder)){ 
       Toast.makeText(MainActivity.this, "You are Successfully login", Toast.LENGTH_SHORT).show(); 
      } 
      else{ 
       Toast.makeText(MainActivity.this, "email or password is wrong", Toast.LENGTH_SHORT).show(); 
      } 
      cursor.close(); 
     } 
    } 
} 

Où est mon erreur?

+1

Qu'est-ce logcat à dire sur la raison pour laquelle l'application ferme? –

Répondre

0

Cela ne semble pas correct.

Cursor cursor = dbObj.query(
    /* String table */   SignupEntries.Table_Name, 
    /* String[] columns */  null, 
    /* String selection */  "" +SignupEntries.email+ new String[] {primarypass}, 
    /* String[] selectionArgs */ null, 
    /* String groupBy */   null, 
    /* String having */   null, 
    /* String orderBy */   null); 

Vous vouliez probablement dire

Cursor cursor = dbObj.query(
    /* String table */   SignupEntries.Table_Name, 
    /* String[] columns */  null, 
    /* String selection */  SignupEntries.email, 
    /* String[] selectionArgs */ new String[] {primarypass}, 
    /* String groupBy */   null, 
    /* String having */   null, 
    /* String orderBy */   null, 
    /* String limit */   null);