Android 活动指示器

发布于 2024-11-14 16:44:57 字数 193 浏览 7 评论 0原文

我正在为 Android 应用程序编程。单击按钮时,它会调用服务来显示必要的内容。调用服务并解析该服务中存在的 XML 数据需要花费近 5 到 10 秒的时间。在这 5 秒的时间段内,我需要显示一个活动指示器,并显示一条文本“正在加载。请稍候...”。这部分对于 iPhone 来说效果很好。但在安卓中则不然。

任何帮助将不胜感激..

谢谢

I am programming for an Android application. while clicking a button, it calls a service to display the necessary contents. For calling the service and to parse the XML data present in that service it takes nearly 5 to 10 seconds. In these 5 seconds time period I need to display an activity Indicator with a text stating that "Loading. Please wait...". This part works fine for iPhone. But not in Android.

Any help would be appreciated..

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

仲春光 2024-11-21 16:44:57

检查。请参阅“创建进度对话框”部分。尝试解析 AsyncTask 中的 XML。当您启动任务时,仅显示进度对话框。任务完成后 - 隐藏进度对话框。

Check this. Look at "Creating a ProgressDialog" section. Try to parse the XMLs in AsyncTask. When you start the task just show the progress dialog. When the task finishes - hide the progress dialog.

困倦 2024-11-21 16:44:57

如果您想在服务运行时显示一条消息,您可以使用进度对话框。

 ProgressDialog dialog = new ProgressDialog(MainActivity.this);
                dialog.setMessage("Your message..");
                dialog.show();

要关闭此进度对话框,请使用

 dialog.dismiss();

if you want to show a message when your service is running you can use Progress Dialog for that.

 ProgressDialog dialog = new ProgressDialog(MainActivity.this);
                dialog.setMessage("Your message..");
                dialog.show();

to dismiss this progress dialog use

 dialog.dismiss();
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文