dimanche 8 mars 2015

How Validate null data from SQLite in Splash Screen

I got a null value in my SQlite Database, but when I try to get this value... my app stopped


This is the code:


SplashScreenActivity.java



File dbtest =new File("data/data/http://ift.tt/1A6CZdr");
if(dbtest.exists())
{

//This is the reason for my app crash: get the "null" value
boolean tag= Check.beginActivity();

if (tag==true){
Intent mainIntent = new Intent().setClass(SplashScreenActivity.this, ActivityVistaQR.class);
startActivity(mainIntent);
}else{
Intent mainIntent = new Intent().setClass(SplashScreenActivity.this, ActivityVistaQR.class);
startActivity(mainIntent);
}

}
else
{
Intent mainIntent = new Intent().setClass(SplashScreenActivity.this, HomeActivity.class);
startActivity(mainIntent);

}


beginActivity.java


public class RevisionInicio {



public static boolean beginActivity(){

String tag= UsersDataBaseAdapter.getTag();

if(Tag==null){
return false;
}else{
return true;
}

}


When the Database have a "null" value in "Tag" (in Users Table) my app Crash, when my Method get the value. What Should I do? Encode or Parse that value? (How?), Good Day :)


Aucun commentaire:

Enregistrer un commentaire