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
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 () {
Msg pass in the thread to the main thread in the jump and jump directly to the sub-thread it any different Reply:
thread thread ah Reply:
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:
One is in front of the current Activity, followed by a target Activity ......... 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:
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:
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:
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:
...... 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:
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