Launching Intent using userID with if block
<p>I have this activity class that won't catch the if block. Because I'm a beginner, I couldn't think of any other way to catch the given userID("001") to launch a specific intent(AdminTab) after the Splash Thread. </p>

<p>Could someone please help me point out what i'm doing wrong or advice me with some sample code? Thank you!</p>

<p>public class Splash extends Activity{</p>

<pre><code>@Override
protected void onCreate(Bundle savedInstanceState) {

    final UserFunctions userFunction = new UserFunctions();

    super.onCreate(savedInstanceState);
    setContentView(R.layout.splash);

    Thread timer = new Thread(){

    public void run(){

    String id = "";
    id = userFunction.getID(getApplicationContext());

    try{
        sleep(1000);
        //Should open AdminTab if user id is "001"      
        if("001".equals(id)){

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

                    startActivity(i);

        }else{

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

                    startActivity(i);
        }

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


        }
    }

    };

    timer.start();
}
</code></pre>

<p>This is the getID method from UserFunctions Class.
getUserID from a sqlite database handler.</p>

<p>UserFunctions.java</p>

<pre><code>public String getID(Context context) {
    String id = "";
    DatabaseHandler db = new DatabaseHandler(context);
    Cursor cursor = db.getUserID();

    if(cursor != null) {
        while(cursor.moveToNext()) {
            id = cursor.getString(0);
        }
    } else {
        id = "";
    }

    cursor.close();
    db.close();
    return id;
}
</code></pre>
