intent problem

0 Mohammed imran · May 10, 2015
I have tried something like this but, the application is getting closed unfortunately in the emulator the second screen is not coming up.

package com.app.hems.cqu;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;

public class Title_page_activity extends Activity {

@Override
protected void onCreate(Bundle CreateTitleSleep) {
// TODO Auto-generated method stub
super.onCreate(CreateTitleSleep);
setContentView(R.layout.titlepage);
Thread Timer = new Thread(){
public void run()
{
try
{
sleep(2000);

}
catch(InterruptedException e)
{
e.printStackTrace();
}
finally
{
Intent openMainActivity = new Intent("com.app.hems.cqu.MAINACTIVITY");
startActivity(openMainActivity);
}
}
};
Timer.start();
}

}

Post a Reply

Replies

Oldest  Newest  Rating
0 Nicholas Eason · May 12, 2015
You cant do this:

Thread Timer = new Thread(){

public void run()

You want:

Thread timer = new Thread(new Runnable(){
public void run(){

}
});
0 Wout Ceulemans · May 10, 2015
And what is the error in your IDE or in your console?
  • 1

Java / Android Development

106,968 followers
About

Very popular language used to create desktop applications, website applets, and Android apps.

Links
Moderators
Bucky Roberts Administrator