如何在单击活动中的按钮时显示进度条我的主要活动中有一个按钮,如果我单击该按钮我想显示一个进度条我不想为此使用辅助活动我已经完成了 2 个活动但是我需要它在主要活动本身中完成。
谢谢你
我的代码:
家庭活动:
public void load(View v){
Intent intent = new Intent(this,Splash.class);
this.startActivity(intent);
}
飞溅活动:
public class Splash extends Activity {
private long ms = 0;
private long splashTime = 20000;
private boolean splashActive = true;
private boolean paused = false;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.splash);
Thread mythread = new Thread() {
public void run() {
try {
while (splashActive && ms < splashTime) {
if (!paused)
ms = ms + 100;
sleep(100);
}
} catch (Exception e) {
} finally {
Intent intent = new Intent(Splash.this, Home.class);
startActivity(intent);
}
}
};
mythread.start();
}
}