progressdialog

android.view.ViewRoot$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views.

喜你入骨 提交于 2019-12-04 01:55:40
问题 I am developing an android app in which i need to display images after downloading them from server and when the downloading is proceeding a progress dialog is being show. For that i an using an asynctask class. I am using t he following source code for it. private void startDownload() { new DownloadFileAsync().execute(imageUrl); image.setImageBitmap(bitmap); } @Override protected Dialog onCreateDialog(int id) { switch (id) { case DIALOG_DOWNLOAD_PROGRESS: dialog = new ProgressDialog(this);

ProgressDialog using AsyncTask producing constructor undefined error

风流意气都作罢 提交于 2019-12-03 21:54:33
public class async extends AsyncTask<String, Integer, String>{ ProgressDialog prog; @Override protected void onPreExecute() { super.onPreExecute(); prog=new ProgressDialog(async.this);//This is chowing error prog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL); prog.setMax(100); prog.show(); } @Override protected String doInBackground(String... params) { for (int i = 0; i < 10; i++) { publishProgress(5); try { Thread.sleep(100); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } return null; } @Override protected void onPostExecute(String result) {

2014.10.07学习总结

房东的猫 提交于 2019-12-03 18:53:19
今天主要是学习了UI界面的设计,都还是一些皮毛,慢慢来吧,今天感觉收获颇多,把学习的这些东西总结一下,权当自己复习了。 一.常见的控件 1.TextView:用于在界面上显示一段文字 2.Button:按钮,一般需要在主方法中的onCreate中的setOnClickListener中写onClick方法(两种方法,匿名类或接口实现) 3.EditText:可以在控件内输入或编辑内容,提示的话加android:hint="提示的内容" 4.ImageView:用于在界面上展示图片 5.ProgressBar:用于在界面上显示进度条,有三种状态(visible,invisible,gone) 6.AlertDialog:置于所有元素之上,用于提示重要的信息。 7.ProgressDialog:类似AlertDialog,用于显示进度条,让用户耐心等待 以上控件除了6,7使用和其他不同之外,剩下的都是大同小异 都是 android:id="@+id/XXX" android:layout_width="wrap_content" android:layout_height="wrap_content" 再加上自己特有的东西,需要用的时候查一下就好了 AlertDialog在MainActivity中写 AlertDialog.Builder dialog=new AlertDialog

android ProgressDialog fontSize change

夙愿已清 提交于 2019-12-03 16:58:14
Is it possible to change the font size and make text bold which is displayed in a ProgressDialog .I have created a ProgressDialog like this: private ProgressDialog dialog; this.dialog = ProgressDialog.show(Activity.this, "Heading","Message...", true); I want to make Heading bold and increase the font size..pls help If you import android.text.Html; then you will be able to use the Html.fromHtml() method to do it, like so: private ProgressDialog dialog; this.dialog = ProgressDialog.show(Activity.this, Html.fromHtml( "<b>Heading<b>"), Html.fromHtml("<big>Message...</big>"), true); You should also

Change style of ProgressDialog

不问归期 提交于 2019-12-03 16:30:18
问题 Is it possible to change ProgressBar style of progress dialog. If yes, then how can I do it? 回答1: You can style your progress dialog this way: create a drawable file with your ring shape (circular_progress_dialog.xml) <rotate xmlns:android="http://schemas.android.com/apk/res/android" android:fromDegrees="270" android:toDegrees="270"> <shape android:innerRadiusRatio="2.5" android:shape="ring" android:thickness="2dp" android:useLevel="true"><!-- this line fixes the issue for lollipop api 21 -->

Android AsynTask with progress dialog cancel

耗尽温柔 提交于 2019-12-03 15:28:10
问题 In my android app I use AsynTask with Progress Dialog (Please wait login in ...) for logining user with my web page (web service function inside AsynTask) I want to dismiss Progress Dialog and cancel AsynTask when user click on Back button on device. I can't find that kind of example, for interrupting AsynTask. I read abouth cancel(boolean) but I don't know how to call from UI. Can anyone give me idea. Thanks 回答1: public MyActivity extends Activity { private MyAsyncTask task; public onCreate(

Android 下载进度对话框 ProgressDialog

半世苍凉 提交于 2019-12-03 13:51:55
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); button = (Button) findViewById(R.id.button); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub ProgressDialog dialog = new ProgressDialog(MainActivity.this); dialog.setTitle("下载提示"); dialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL); dialog.setProgress(50); dialog.show(); } }); } 来源: https://www.cnblogs.com/zhangxuechao/p/11797779.html

Android 进度对话框 ProgressDialog

不羁岁月 提交于 2019-12-03 13:51:09
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); button = (Button) findViewById(R.id.button); button.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub // ProgressDialog.show(MainActivity.this, "提示", "正在加载,请稍后..."); ProgressDialog dialog = new ProgressDialog(MainActivity.this); dialog.setTitle("提示"); dialog.setMessage("正在加载,请稍后..."); dialog.show(); } }); } 来源: https://www.cnblogs.com/zhangxuechao/p/11797776.html

Android: How to Create a Modal Progress “Wheel” Overlay?

為{幸葍}努か 提交于 2019-12-03 13:18:55
I would like to show a modal progress "wheel" overlay on my view. The ProgressDialog comes close, but I do not want the dialog background or border. I tried setting the background drawable of the dialog window: this.progressDialog = new ProgressDialog(Main.this); this.progressDialog.getWindow().setBackgroundDrawable(new ColorDrawable(0)); this.progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); this.progressDialog.setCancelable(false); this.progressDialog.setIndeterminate(true); this.progressDialog.show(); but to no avail (i.e. still looks the same as without the ..

How can I open a ProgressDialog on top of a DialogFragment?

ⅰ亾dé卋堺 提交于 2019-12-03 13:06:27
I have this Android activity/layout with a button. When I click this button, it opens a DialogFragment with 2 spinners. When the DialogFragment shows up, I need to populate these 2 spinners with items returned by a web service. So, while waiting for the service to return, I'd like to display a ProgressDialog over the DialogFragment I've just opened. The problem is I can't seem to make the ProgressDialog on top of the DialogFragment. I can see the ProgressDialog being shown behind the DialogFragment, is it possible to make the ProgressDialog being displayed over everything else? My code is like