My launcher icon currently starts the login activity. I\'ve stored the logged in status in SharedPreferences. Is there any way to properly skip the login activi
You can create a Base Activity that will check if the user's username and password is already in the SharedPreferences and starts the activity if it exist hence not.
example:
public class BeanStalkBaseActivity extends SherlockActivity{
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
if(SavedPreference.getUserName(this).length() == 0)
{
Intent intent = new Intent(this,LoginActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
finish();
startActivity(intent);
}else
{
Intent intent = new Intent(this,MainActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
finish();
startActivity(intent);
}
}
}
BeanStalkBaseActivity should be your Launcher as it only serve as a checker.