从服务器下载图像时如何设置进度条/进度指示器

时间:2012-07-20 16:20:16

标签: java-me

我正在从服务器 j2me 应用程序中下载图像。

我希望在我的下载未完成之前显示进度条或活动指示器。

但我不知道怎么做?我搜索了一下但没有得到答案。

1 个答案:

答案 0 :(得分:1)

您需要根据您的要求使用Gauge Control。使用Gauge Control创建一个简单的for并在开始下载代码之前显示该表单。

// first display progressbar form
ProgressForm progressForm = new ProgressForm ( "Please wait" ); 
display.setCurrent(progressForm); 

// now downloading code in background
new Thread ( new Runnable() 
{
      public void run()
      {
          // Image downloading code goes here
      }
}).start();
相关问题