2016-04-01 29 views

cevap

0

Bunun için bunun için SharedPreferences sınıfını kullanın.

Ex. SharedPreferences sınıfı oluşturun.

public class SharedPreferencesUtility {

SharedPreferences sharedpref; 

public SharedPreferencesUtility(Context context) { 

    sharedpref = context.getSharedPreferences(context.getPackageName(), Context.MODE_PRIVATE); 

} 

public void setVerifiy(boolean b) { 

    sharedpref.edit().putBoolean("isVerify", b).commit(); 
} 

public boolean getVerifiy() { 

    return sharedpref.getBoolean("isVerify", false); 
} 

}

kullandığınız yöntem setVerifiy facebook aracılığıyla ve getVerifiy sıçrama/Diğer aktivitesinde OnCreate çek yöntemi sonra giriş yaptığınızda gerçek yöntem.

private Activity activity; 
    private SharedPreferencesUtility preferencesUtility; 

    @Override 
    public void onCreate(Bundle savedInstanceState) { 

    setContentView(R.layout.activity_splash); 

    activity = SplashActivity.this; 

    preferencesUtility = new SharedPreferencesUtility(activity); 

    Handler handler = new Handler(); 

    handler.postDelayed(new Runnable() { 
     @Override 
     public void run() { 

      if (preferencesUtility.getVerifiy()) { 

       startActivity(new Intent(getApplicationContext(), HomePage.class)); 

       finish(); 

      } else { 

       startActivity(new Intent(getApplicationContext(), LoginPage.class)); 

       finish(); 

      } 

     } 
    }, 3000); 
} 
İlgili konular