01.
package
com.appTest.testapp;
02.
03.
import
android.os.Bundle;
04.
import
android.os.Handler;
05.
import
android.os.Message;
06.
import
android.app.Activity;
07.
import
android.content.Intent;
08.
09.
public
class
MainActivity
extends
Activity {
10.
11.
private
static
final
int
REFRESH_SCREEN =
1
;
12.
13.
@Override
14.
public
void
onCreate(Bundle savedInstanceState) {
15.
super
.onCreate(savedInstanceState);
16.
setContentView(R.layout.activity_main);
17.
18.
startScan();
19.
20.
}
21.
22.
public
void
startScan() {
23.
new
Thread() {
24.
public
void
run() {
25.
try
{
26.
Thread.sleep(
3000
);
27.
hRefresh.sendEmptyMessage(REFRESH_SCREEN);
28.
}
catch
(Exception e){
29.
}
30.
}
31.
}.start();
32.
}
33.
34.
Handler hRefresh =
new
Handler(){
35.
public
void
handleMessage(Message msg) {
36.
switch
(msg.what){
37.
case
REFRESH_SCREEN:
38.
39.
40.
Intent newActivity =
new
Intent(MainActivity.
this
,Search.
class
);
41.
startActivity(newActivity);
42.
43.
break
;
44.
default
:
45.
break
;
46.
}
47.
}
48.
};
49.
50.
}