List of usage examples for android.app Activity runOnUiThread
public final void runOnUiThread(Runnable action)
From source file:Main.java
public static void changeProgressDialogMessage(final Activity activity, final String message) { activity.runOnUiThread(new Runnable() { @Override//from w w w . j a v a 2 s . c o m public void run() { if (progressDialog != null) { progressDialog.setMessage(message); } } }); }
From source file:Main.java
public static void showToast(final Activity activity, final String message) { activity.runOnUiThread(new Runnable() { @Override// www .j av a 2s .co m public void run() { Toast toast = Toast.makeText(activity.getApplicationContext(), message, Toast.LENGTH_SHORT); toast.setGravity(Gravity.CENTER_VERTICAL | Gravity.BOTTOM, 0, 80); toast.show(); } }); }
From source file:Main.java
public static ProgressDialog createProgressDialog(Context mContext) { final ProgressDialog dialog = new ProgressDialog(mContext); try {/*w ww. ja v a2 s. com*/ Activity a = (Activity) mContext; a.runOnUiThread(new Runnable() { @Override public void run() { dialog.show(); } }); } catch (WindowManager.BadTokenException e) { } dialog.setCancelable(false); return dialog; }
From source file:Main.java
public static ProgressDialog startProgressBar(final Activity activity) { activity.runOnUiThread(new Runnable() { public void run() { // pBar = ProgressBar.makeText(activity, text, duration); pDialog = new ProgressDialog(activity); pDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); pDialog.setMessage("Laden"); pDialog.setCancelable(false); pDialog.show();//from ww w . j a v a 2 s . c o m } }); return pDialog; }
From source file:Main.java
@SuppressWarnings("deprecation") public static void showAlert(final String title, final String msg, final Context context) { Activity a = (Activity) context; a.runOnUiThread(new Runnable() { @Override/*from w w w. j a v a2s . com*/ public void run() { AlertDialog alertDialog = new AlertDialog.Builder(context).create(); alertDialog.setTitle(title); alertDialog.setMessage(msg); alertDialog.setButton("Ok", new DialogInterface.OnClickListener() { @Override public void onClick(final DialogInterface dialog, final int which) { dialog.cancel(); } }); alertDialog.show(); } }); }
From source file:Main.java
public static void setRaiting(Activity r, final RatingBar v, final String value) { r.runOnUiThread(new Runnable() { @Override/*from w ww. j ava 2 s . c o m*/ public void run() { try { v.setRating(new Float(value)); } catch (Exception e) { } } }); }
From source file:Main.java
public static void setText(Activity r, final TextView v, final String text) { r.runOnUiThread(new Runnable() { @Override/*from w w w . j a v a2 s . c o m*/ public void run() { try { v.setSingleLine(false); v.setText(Html.fromHtml(text)); } catch (Exception e) { } } }); }
From source file:Main.java
public static void show(final Activity activity, final String message) { activity.runOnUiThread(new Runnable() { public void run() { Toast.makeText(activity, message, Toast.LENGTH_SHORT).show(); }//from www .j a v a2s .c om }); }
From source file:Main.java
public static void showMessageText(final Activity activity, final String text) { activity.runOnUiThread(new Runnable() { public void run() { Toast.makeText(activity, text, Toast.LENGTH_LONG).show(); }/*from www. j av a2s . co m*/ }); }
From source file:Main.java
private static void UIUpdater(Activity activity, final TextView textView, final String str) { activity.runOnUiThread(new Runnable() { @Override/* w ww.j a v a2s. c om*/ public void run() { textView.setText(str); } }); }