Sunday, February 23, 2014

Newcomers help, make a welcome screen, two seconds, then enter the main interface


Know the main logic is to set up the main thread to sleep for two seconds, but the code is always a problem, the great God who helped me see the bar code, or give me a correct code, under my own research, thank you
Here is the code
 
public class MainActivity extends Activity {

@ Override
protected void onCreate (Bundle savedInstanceState) {
super.onCreate (savedInstanceState);
/ / SetContentView (R.layout.activity_main);
/ / SetContentView (R.layout.activity_main);
requestWindowFeature (Window.FEATURE_NO_TITLE);
/ / Set fullscreen
getWindow () setFlags (WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);.
setContentView (R.layout.activity_main);
MyTimer timer = new MyTimer ();
timer.start ();
}
private static final int Goto = 0;

Handler handler = new Handler () {
public void handleMessage (Message mes) {
switch (mes.what) {
case Goto:
Intent intent = new Intent ();
intent.setClass (MainActivity.this, Welcome.class);
startActivity (intent);
finish ();
break;

default:
break;
}
}
};
public class MyTimer extends Thread {
public MyTimer () {

}
public void run () {
try {
sleep (1000);
handler.sendEmptyMessage (Goto);
} Catch (InterruptedException e) {
/ / TODO Auto-generated catch block
e.printStackTrace ();
}
}
}

@ Override
public boolean onCreateOptionsMenu (Menu menu) {
/ / Inflate the menu; this adds items to the action bar if it is present
.getMenuInflater () inflate (R.menu.main, menu);.
return true;
}

}
<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
Using the handle of senddaleyMESSAGE method;
Reply:
. . . . This in the end you are Timer or Thread
Reply:
Sometimes you need people to help
Reply:
 public class StartActivity extends Activity {

@ Override
protected void onCreate (Bundle savedInstanceState) {
super.onCreate (savedInstanceState);
setContentView (R.layout.activity_main);
new Thread (new Runnable () {

@ Override
public void run () {
/ / TODO Auto-generated method stub
try {
Thread.sleep (2000);
} Catch (InterruptedException e) {
/ / TODO Auto-generated catch block
e.printStackTrace ();
}
Intent intent = new Intent (StartActivity.this, MainPageActivity.class);
startActivity (intent);
finish ();
}

.}) Start ();
}
}

Reply:
 private final int Jump = 0x10; 
private Handler handler = null;

@ Override
protected void onCreate (Bundle savedInstanceState) {
super.onCreate (savedInstanceState);
setContentView (R.layout.activity_main);
handler = new Handler () {
@ Override
public void handleMessage (Message msg) {
if (msg.what == Jump)
startActivity (new Intent (Activity_Main.this,
Activity_NewPage.class));
super.handleMessage (msg);
}
};
new Thread (new Runnable () {

@ Override
public void run () {
try {
Thread.sleep (2000);
handler.sendEmptyMessage (Jump);
} Catch (InterruptedException e) {
e.printStackTrace ();
}
}
.}) Start ();
}

Reply:
references, 5th Floor hjywyj reply:
 private final int Jump = 0x10; 
private Handler handler = null;

@ Override
protected void onCreate (Bundle savedInstanceState) {
super.onCreate (savedInstanceState);
setContentView (R.layout.activity_main);
handler = new Handler () {
@ Override
public void handleMessage (Message msg) {
if (msg.what == Jump)
startActivity (new Intent (Activity_Main.this,
Activity_NewPage.class));
super.handleMessage (msg);
}
};
new Thread (new Runnable () {

@ Override
public void run () {
try {
Thread.sleep (2000);
handler.sendEmptyMessage (Jump);
} Catch (InterruptedException e) {
e.printStackTrace ();
}
}
.}) Start ();
}


references, 5th Floor hjywyj reply:
 private final int Jump = 0x10; 
private Handler handler = null;

@ Override
protected void onCreate (Bundle savedInstanceState) {
super.onCreate (savedInstanceState);
setContentView (R.layout.activity_main);
handler = new Handler () {
@ Override
public void handleMessage (Message msg) {
if (msg.what == Jump)
startActivity (new Intent (Activity_Main.this,
Activity_NewPage.class));
super.handleMessage (msg);
}
};
new Thread (new Runnable () {

@ Override
public void run () {
try {
Thread.sleep (2000);
handler.sendEmptyMessage (Jump);
} Catch (InterruptedException e) {
e.printStackTrace ();
}
}
.}) Start ();
}


references, 5th Floor hjywyj reply:
 private final int Jump = 0x10; 
private Handler handler = null;

@ Override
protected void onCreate (Bundle savedInstanceState) {
super.onCreate (savedInstanceState);
setContentView (R.layout.activity_main);
handler = new Handler () {
@ Override
public void handleMessage (Message msg) {
if (msg.what == Jump)
startActivity (new Intent (Activity_Main.this,
Activity_NewPage.class));
super.handleMessage (msg);
}
};
new Thread (new Runnable () {

@ Override
public void run () {
try {
Thread.sleep (2000);
handler.sendEmptyMessage (Jump);
} Catch (InterruptedException e) {
e.printStackTrace ();
}
}
.}) Start ();
}

Msg pass in the thread to the main thread in the jump and jump directly to the sub-thread it any different
Reply:
reference to the second floor pengguohua1988 reply:
. . . . This in the end you are Timer or Thread

thread thread ah
Reply:
references, 5th Floor hjywyj reply:
 
startActivity (new Intent (Activity_Main.this, Activity_NewPage.class));

I would like to ask this line of code (Activity_Main.this, Activity_NewPage.class) these two parameters should be how to fill in, what does that mean Oh, please explain the Great God
Reply:
reference to the 8th floor u011631889 reply:
Quote: references, 5th Floor hjywyj reply:

 
startActivity (new Intent (Activity_Main.this, Activity_NewPage.class));

I would like to ask this line of code (Activity_Main.this, Activity_NewPage.class) these two parameters should be how to fill in, what does that mean, oh, God, seeking big Detailed

One is in front of the current Activity, followed by a target Activity .........
Reply:
reference to the 9th floor rouzi1230 reply:
Quote: references to the 8th floor u011631889 reply:

Quote: references, 5th Floor hjywyj reply:

 
startActivity (new Intent (Activity_Main.this, Activity_NewPage.class));

I would like to ask this line of code (Activity_Main.this, Activity_NewPage.class) these two parameters should be how to fill in, what does that mean, oh, God, seeking big Detailed

One is in front of the current Activity, followed by a target Activity .........

Why every time I set up over two seconds on the forced termination, and,
Reply:
reference to the 10th floor u011631889 reply:
Quote: references to the 9th floor rouzi1230 reply:

Quote: references to the 8th floor u011631889 reply:

Quote: references, 5th Floor hjywyj reply:

 
startActivity (new Intent (Activity_Main.this, Activity_NewPage.class));

I would like to ask this line of code (Activity_Main.this, Activity_NewPage.class) these two parameters should be how to fill in, what does that mean, oh, God, seeking big Detailed

One is in front of the current Activity, followed by a target Activity .........

Why every time I set up over two seconds on the forced termination of,,

Error, or the Editor?
Reply:
reference to the 10th floor u011631889 reply:
Quote: references to the 9th floor rouzi1230 reply:

Quote: references to the 8th floor u011631889 reply:

Quote: references, 5th Floor hjywyj reply:

 
startActivity (new Intent (Activity_Main.this, Activity_NewPage.class));

I would like to ask this line of code (Activity_Main.this, Activity_NewPage.class) these two parameters should be how to fill in, what does that mean, oh, God, seeking big Detailed

One is in front of the current Activity, followed by a target Activity .........

Why every time I set up over two seconds on the forced termination of,,

Activity_NewPage not declared in the Manifest in it?
Reply:
Not being given, it is time to run, if two seconds after the welcome screen should jump, no jump directly linked to the
Reply:
reference to the 12th floor tantahe reply:
Quote: references to the 10th floor u011631889 reply:

Quote: references to the 9th floor rouzi1230 reply:

Quote: references to the 8th floor u011631889 reply:

Quote: references, 5th Floor hjywyj reply:

 
startActivity (new Intent (Activity_Main.this, Activity_NewPage.class));

I would like to ask this line of code (Activity_Main.this, Activity_NewPage.class) these two parameters should be how to fill in, what does that mean, oh, God, seeking big Detailed

One is in front of the current Activity, followed by a target Activity .........

Why every time I set up over two seconds on the forced termination of,,

Activity_NewPage not declared in the Manifest in it?

Not being given, it is time to run, if two seconds after the welcome screen should jump, no jump directly linked to the
Reply:
reference to the 14th floor u011631889 reply:
......
No error, time is running two seconds after the welcome screen should jump if not jump directly linked to the

Caesar had hung error
1 look logcat, can not read Tieshanglai.
2 Make sure you have registered Activity_NewPage in the Manifest.
Reply:
reference to the 12th floor tantahe reply:
Quote: references to the 10th floor u011631889 reply:

Quote: references to the 9th floor rouzi1230 reply:

Quote: references to the 8th floor u011631889 reply:

Quote: references, 5th Floor hjywyj reply:

 
startActivity (new Intent (Activity_Main.this, Activity_NewPage.class));

I would like to ask this line of code (Activity_Main.this, Activity_NewPage.class) these two parameters should be how to fill in, what does that mean, oh, God, seeking big Detailed

One is in front of the current Activity, followed by a target Activity .........

Why every time I set up over two seconds on the forced termination of,,

Activity_NewPage not declared in the Manifest in it?

Thank you, it is because this problem solved
Reply:
Alright! Novice Come on!

No comments:

Post a Comment