如何把设定的延迟的android进度条中 [英] How to Put set delay on android Progress bar

查看:504
本文介绍了如何把设定的延迟的android进度条中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要的是将其设置这样的进度栏加载15秒,然后在进入下一个活动。

What I want is to set it up so that the progress bar loads for 15 seconds, and then go on to the next activity.

目前的活动有:

public class MainActivity extends Activity {

  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    Button btn5 =(Button)findViewById(R.id.button);

    btn5.setOnClickListener(new Button.OnClickListener() {

      public void onClick(View v) {
        Intent myIntent = new Intent();

        myIntent.setAction(Intent.ACTION_VIEW);

        myIntent.setData(android.provider.MediaStore.Images.Media.INTERNAL_CONTENT_URI);
        setContentView(R.layout.loading);

      }        
    });
  }

}

和XML页面有:

<ProgressBar
    android:id="@+id/progressBar1"
    style="?android:attr/progressBarStyleHorizontal"
    android:layout_width="match_parent"
    android:layout_height="144dp"
    android:layout_gravity="center_vertical" />

我想知道如何使progressBar1负载15秒,然后去为result.xml

I want to know how to make to make progressBar1 Load for 15 seconds and then go to result.xml

推荐答案

看一看在演示包含SDK的样本code API的进度对话框的例子。我相信这是在/src/com/example/android/apis/app/AlertDialogSamples.java。如果你看看最底部有code它通过时间延迟的消息更新进度条。

Take a look at the progress dialog example in the api demos included with the sample code of the sdk. I believe it is in /src/com/example/android/apis/app/AlertDialogSamples.java. If you look at the very bottom it has code which updates the progress bar through time delayed messages.

您的问题是有点不清楚虽然,您发布的第一或第二活动code

Your question is a bit unclear though, is the code you posted the first or second activity

这篇关于如何把设定的延迟的android进度条中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆