进度条终止并进入新屏幕
package com.example.progress;
import android.app.Activity;
import android.app.ProgressDialog;
import android.os.Bundle;
public class ProgressActivity extends Activity {
ProgressDialog myProgressDialog = null;
@Override
public void onCreate(Bundle icicle){
super.onCreate(icicle);
myProgressDialog = ProgressDialog.show(ProgressActivity.this,
"Please wait...", "few seconds.....", true);
new Thread() {
public void run() {
try{
// Do some Fake-Work
sleep(5000);
} catch (Exception e) { }
myProgressDialog.dismiss();
}
}.start();
}
};
这是我的代码...我现在想要的是当进度条完成时,我想进入下一个屏幕...
即使我知道如何使用按钮进入其他屏幕..我无法实现它....
我尝试了这个...
Intent i = new Intent(SplashActivity.this, screen2.class); 开始活动(一);
添加这行代码并替换为 Progress.dismiss();
但它没有成功...请给我看源代码或任何帮助...我只想进入其他屏幕...
我对此很陌生...并且想学习它...任何帮助将不胜感激...
package com.example.progress;
import android.app.Activity;
import android.app.ProgressDialog;
import android.os.Bundle;
public class ProgressActivity extends Activity {
ProgressDialog myProgressDialog = null;
@Override
public void onCreate(Bundle icicle){
super.onCreate(icicle);
myProgressDialog = ProgressDialog.show(ProgressActivity.this,
"Please wait...", "few seconds.....", true);
new Thread() {
public void run() {
try{
// Do some Fake-Work
sleep(5000);
} catch (Exception e) { }
myProgressDialog.dismiss();
}
}.start();
}
};
This is my code... What I want now is when progress bar finishes, i want to go into next screen....
Even tho I know how to go into other screen with using buttons.. I am not able to implement it....
I tried this...
Intent i = new Intent(SplashActivity.this, screen2.class);
startActivity(i);
Add this line of code and replace with the progress.dismiss();
But it didn't work out... Please just show me a source code or any help... I just want to get to other screen...
I am new to this... and want to learn it... Any help would be appreciated...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用 Handler 非常简单...
并且在 Oncreate 方法中,您需要随时向处理程序发送消息;
Use Handler it is very easy...
and In Oncreate method you need to send message to handler whenever you want;