Предлагаю без изобретения велосипедов. Изучай:
Java |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
| private ImageView splash;
private static final int STOPSPLASH = 0;
private static final long SPLASHTIME = 2000;
private Handler splashHandler = new Handler()
{
@Override
public void handleMessage(Message msg)
{
switch (msg.what)
{
case STOPSPLASH:
splash.setVisibility(View.GONE);
break;
}
super.handleMessage(msg);
}
};
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
splash = (ImageView) findViewById(R.id.splashscreen);
Message msg = new Message();
msg.what = STOPSPLASH;
splashHandler.sendMessageDelayed(msg, SPLASHTIME); |
|
Так что изучай Handler, крутая штука