How to get the user authentication in Splash Activity
<p>I'm working on a small app that has a Splash Screen and a User Login. </p>

<p>I want to launch different tab menu based on the user's ID. </p>

<p>Let say I have an Admin who has ID == "100" will get AdminTabActivity and rest of others will get UserTabActivity. so I wrote it like this. I'm simply passing the user ID from here to the MainActivity.</p>

<p>SplashActivity.java </p>

<pre><code>public void run(){
        try{
        sleep(1000);
            Intent in = new Intent(getApplicationContext(), MainActivity.class);
            startActivity(in);  
            finish();

        } catch (InterruptedException e){
            e.printStackTrace();
        }finally {                                  

        }
    } 
</code></pre>

<p>LoginActivity.java</p>

<pre><code>//Stores and Grabs the user ID from sqlite db
db.addUser(json_user.getString(KEY_ID), 
           json_user.getString(KEY_NAME));                                                 

Intent i = new Intent(getApplicationContext(), MainActivity.class);                 

    i.putExtra(KEY_ID, id);
    startActivity(i);

    finish();
</code></pre>

<p>MainActivity.java</p>

<pre><code>Intent i = getIntent();
String id = i.getStringExtra(KEY_ID);

if("001".equals(id)){

    /* Launch Admin Screen if ID == 100 */

    Intent in = new Intent(getApplicationContext(), AdminTabActivity.class);           
    startActivity(in);          
    finish();

}else{

    /* Launch User Screen if ID !== 100 */

    Intent in = new Intent(getApplicationContext(), UserTabActivity.class);                        
    startActivity(in);      
    finish();

}
</code></pre>

<p>If the user exits out of the app and returns back, it will skips the LoginActivity and go straight from Splash to MainActivity (which I want it to be), but the <strong>if block</strong> will skip this time even if the user has the ID == "100". Hope it makes sense, if not please kindly let me know so I can explain more. Thank you!</p>
