List of usage examples for android.app AlertDialog.Builder show
public void show()
From source file:com.lge.friendsCamera.Utils.java
public static void showAlertDialog(Context context, String title, String message, DialogInterface.OnClickListener posListener) { AlertDialog.Builder alert = new AlertDialog.Builder(context); alert.setTitle(title);/*w w w. ja v a2 s .c o m*/ alert.setMessage(message); alert.setPositiveButton("Ok", posListener); alert.setCancelable(false); alert.show(); }
From source file:Main.java
public static void showTipDialog(Activity activity, String title, String dismiss) { AlertDialog.Builder builder = new AlertDialog.Builder(activity).setTitle(title).setNegativeButton(dismiss, new DialogInterface.OnClickListener() { @Override/*from w ww .j a v a 2 s . c o m*/ public void onClick(DialogInterface dialogInterface, int i) { } }); AlertDialog alertDialog = builder.create(); builder.show(); }
From source file:ca.frozen.curlingtv.App.java
public static void error(Context context, String message) { AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setMessage(message);/*from w w w.j a v a2 s.co m*/ builder.setCancelable(true); builder.setNeutralButton(R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }); builder.show(); }
From source file:Main.java
/** * This method shows an alert box with specified message * @param context/* ww w. j a v a2 s . c om*/ * @param message */ public static void displayAlert(final Context context, String message) { AlertDialog.Builder alert = new AlertDialog.Builder(context); alert.setTitle("Yumm! Alert:"); alert.setMessage(message); alert.setCancelable(false); alert.setPositiveButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { } }); alert.show(); }
From source file:com.lge.friendsCamera.Utils.java
public static void showSelectDialog(Context context, String title, String message, DialogInterface.OnClickListener positiveListener, DialogInterface.OnClickListener cancelListener) { AlertDialog.Builder alert = new AlertDialog.Builder(context); alert.setTitle(title);// www .j a v a 2 s . co m alert.setMessage(message); alert.setPositiveButton("Ok", positiveListener); alert.setNegativeButton("Cancel", cancelListener); alert.setCancelable(false); alert.show(); }
From source file:palamarchuk.fraudguide.utils.QueryMaster.java
public static AlertDialog alert(Context context, String message) { AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setMessage(message);/*from w w w.j a v a 2s .co m*/ // builder.setTitle(""); builder.setPositiveButton("Ok", null); return builder.show(); }
From source file:com.lge.friendsCamera.Utils.java
public static void showTextDialog(Context context, String title, String body) { AlertDialog.Builder alert = new AlertDialog.Builder(context); alert.setTitle(title);/*ww w .j ava2 s.co m*/ alert.setMessage(body); alert.setPositiveButton("Ok", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { } }); alert.show(); }
From source file:org.ptlug.ptwifiauth.Utilities.java
public static void showSimpleAlertDialog(Activity act, String title, String text, String button) { AlertDialog.Builder alertDialog = new AlertDialog.Builder(act); alertDialog.setTitle(title);/* w w w . j a va2 s . com*/ alertDialog.setMessage(text); alertDialog.setCancelable(false); alertDialog.setPositiveButton(button, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); alertDialog.show(); }
From source file:com.doplgangr.secrecy.utils.Util.java
public static void alert(final Context context, final String title, final String message, final DialogInterface.OnClickListener ok) { new Handler(Looper.getMainLooper()).post(new Runnable() { @Override/*from w w w. jav a 2 s . c o m*/ public void run() { AlertDialog.Builder a = new AlertDialog.Builder(context); if (title != null) a.setTitle(title); if (message != null) a.setMessage(message); if (ok != null) a.setPositiveButton("OK", ok); a.setCancelable(false); a.show(); } }); }
From source file:jp.ne.sakura.kkkon.android.exceptionhandler.DefaultUploaderWeb.java
public static void upload(final Context context, final File file, final String url) { terminate();/*from ww w. j ava 2s . com*/ thread = new Thread(new Runnable() { @Override public void run() { Log.d(TAG, "upload thread tid=" + android.os.Process.myTid()); try { //$(BRAND)/$(PRODUCT)/$(DEVICE)/$(BOARD):$(VERSION.RELEASE)/$(ID)/$(VERSION.INCREMENTAL):$(TYPE)/$(TAGS) Log.d(TAG, "fng=" + Build.FINGERPRINT); final List<NameValuePair> list = new ArrayList<NameValuePair>(16); list.add(new BasicNameValuePair("fng", Build.FINGERPRINT)); HttpPost httpPost = new HttpPost(url); //httpPost.getParams().setParameter( CoreConnectionPNames.SO_TIMEOUT, new Integer(5*1000) ); httpPost.setEntity(new UrlEncodedFormEntity(list, HTTP.UTF_8)); DefaultHttpClient httpClient = new DefaultHttpClient(); Log.d(TAG, "socket.timeout=" + httpClient.getParams().getIntParameter(CoreConnectionPNames.SO_TIMEOUT, -1)); Log.d(TAG, "connection.timeout=" + httpClient.getParams().getIntParameter(CoreConnectionPNames.CONNECTION_TIMEOUT, -1)); httpClient.getParams().setParameter(CoreConnectionPNames.SO_TIMEOUT, new Integer(5 * 1000)); httpClient.getParams().setParameter(CoreConnectionPNames.CONNECTION_TIMEOUT, new Integer(5 * 1000)); Log.d(TAG, "socket.timeout=" + httpClient.getParams().getIntParameter(CoreConnectionPNames.SO_TIMEOUT, -1)); Log.d(TAG, "connection.timeout=" + httpClient.getParams().getIntParameter(CoreConnectionPNames.CONNECTION_TIMEOUT, -1)); // <uses-permission android:name="android.permission.INTERNET"/> // got android.os.NetworkOnMainThreadException, run at UI Main Thread HttpResponse response = httpClient.execute(httpPost); Log.d(TAG, "response=" + response.getStatusLine().getStatusCode()); } catch (Exception e) { Log.d(TAG, "got Exception. msg=" + e.getMessage(), e); } finally { ExceptionHandler.clearReport(); } Log.d(TAG, "upload finish"); } }); thread.setName("upload crash"); thread.start(); if (USE_DIALOG) { final AlertDialog.Builder alertDialogBuilder = setupAlertDialog(context); if (null != alertDialogBuilder) { alertDialogBuilder.setCancelable(false); final AlertDialog alertDialog = alertDialogBuilder.show(); /* while ( thread.isAlive() ) { Log.d( TAG, "thread tid=" + android.os.Process.myTid() + ",state=" + thread.getState() ); if ( ! thread.isAlive() ) { break; } { try { Thread.sleep( 1 * 1000 ); } catch ( InterruptedException e ) { Log.d( TAG, "got exception", e ); } } if ( null != alertDialog ) { if ( alertDialog.isShowing() ) { } else { if ( ! thread.isAlive() ) { break; } alertDialog.show(); } } if ( ! Thread.State.RUNNABLE.equals(thread.getState()) ) { break; } } if ( null != alertDialog ) { alertDialog.dismiss(); } */ } try { thread.join(); // must call. leak handle... thread = null; } catch (InterruptedException e) { Log.d(TAG, "got Exception", e); } } }