This Blog for beginer. i am showing you simple code of splash screen
Inside the Anctivity OnCreate Method
//this is used for hide action bar
getSupportActionBar().hide();
//After that we are chaking sharedPrefrance for user is already loged in or not. if loged in then home activity open other wise login
SharedPreferences mCheak=getSharePreferences("CheakLogIn", Context.MODE_PRIVATE);
String Name=mCheak.getString("Name","");
//Handler is used for autometicaly after some second activity call
Handler h= new Handler();
Runnable r = new Runnable ()
{
@override
public void run()
{
//here we cheak if name is null login page open else home page
if(Name.equals(" "))
{
Intent i= new Intent(getApplicationContext (), Activity_LogIn.class);
startActivity(i);
finish();
}else
{
Intent i=new Intent(getApplicationContext(),Activity_Home.Class);
startActivity(i)
finish();
}
}
};
h.postDelayed(r,3000); // 3000 is mili second means 3 second
- Mahesh Saraswat
Inside the Anctivity OnCreate Method
//this is used for hide action bar
getSupportActionBar().hide();
//After that we are chaking sharedPrefrance for user is already loged in or not. if loged in then home activity open other wise login
SharedPreferences mCheak=getSharePreferences("CheakLogIn", Context.MODE_PRIVATE);
String Name=mCheak.getString("Name","");
//Handler is used for autometicaly after some second activity call
Handler h= new Handler();
Runnable r = new Runnable ()
{
@override
public void run()
{
//here we cheak if name is null login page open else home page
if(Name.equals(" "))
{
Intent i= new Intent(getApplicationContext (), Activity_LogIn.class);
startActivity(i);
finish();
}else
{
Intent i=new Intent(getApplicationContext(),Activity_Home.Class);
startActivity(i)
finish();
}
}
};
h.postDelayed(r,3000); // 3000 is mili second means 3 second
- Mahesh Saraswat
No comments:
Post a Comment