List of usage examples for android.widget Toast LENGTH_SHORT
int LENGTH_SHORT
To view the source code for android.widget Toast LENGTH_SHORT.
Click Source Link
From source file:cc.softwarefactory.lokki.android.utilities.DialogUtils.java
public static void addContact(final Context context) { final EditText input = new EditText(context); // Set an EditText view to get user input input.setSingleLine(true);/* w w w.j av a2s . c o m*/ input.setHint(R.string.contact_email_address); input.setInputType(InputType.TYPE_TEXT_VARIATION_WEB_EMAIL_ADDRESS); final AlertDialog addContactDialog = new AlertDialog.Builder(context) .setTitle(context.getResources().getString(R.string.add_contact)).setView(input) .setPositiveButton(R.string.ok, null).setNegativeButton(R.string.cancel, null).create(); addContactDialog.setOnShowListener(new DialogInterface.OnShowListener() { @Override public void onShow(DialogInterface dialog) { addContactDialog.getButton(AlertDialog.BUTTON_POSITIVE) .setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Editable value = input.getText(); if (value == null || value.toString().isEmpty()) { input.setError(context.getResources().getString(R.string.required)); return; } String email = value.toString(); try { ServerApi.allowPeople(context, email); Toast.makeText(context, R.string.contact_added, Toast.LENGTH_SHORT).show(); } catch (JSONException e) { e.printStackTrace(); } addContactDialog.dismiss(); } }); } }); addContactDialog.show(); }
From source file:mohammad.adib.oy.OyUtils.java
public static void showEmptyWarning(Context context) { Toast.makeText(context, context.getResources().getString(R.string.empty), Toast.LENGTH_SHORT).show(); }
From source file:com.ademsha.appnotifico.NotificationHubDataReceiver.java
@Override public void onReceive(Context context, Intent intent) { if (intent.getExtras() != null) { String command = intent.getStringExtra("command"); if (command.equals("get-all")) { String data = intent.getStringExtra("data"); JSONArray notifications;/*ww w. j av a 2s . c o m*/ try { notifications = new JSONArray(data); for (int i = 0; i < notifications.length(); i++) { JSONObject notification = notifications.getJSONObject(i); Toast.makeText(context, notification.toString(), Toast.LENGTH_SHORT).show(); } } catch (JSONException e) { e.printStackTrace(); } } else { Toast.makeText(context, command, Toast.LENGTH_SHORT).show(); } } }
From source file:hongik.android.project.best.ReviewDetailActivity.java
public void drawReview() { String query = "func=reviewdetail" + "&cid=" + cid + "&license=" + license; DBConnector conn = new DBConnector(query); conn.start();// ww w. j a v a 2 s . co m try { conn.join(); JSONObject jsonResult = conn.getResult(); boolean result = jsonResult.getBoolean("result"); if (!result) { Toast.makeText(this, "Can not bring data", Toast.LENGTH_SHORT).show(); return; } JSONObject json = jsonResult.getJSONArray("values").getJSONObject(0); ((TextViewPlus) findViewById(R.id.reviewdetail_title)).setText(json.getString("SNAME")); ((TextViewPlus) findViewById(R.id.reviewdetail_address)).setText(json.getString("ADDR")); ((TextViewPlus) findViewById(R.id.reviewdetail_author)).setText(cid); ((RatingBar) findViewById(R.id.reviewdetail_grade)) .setRating(Float.parseFloat(json.getString("GRADE"))); ((EditTextPlus) findViewById(R.id.reviewdetail_text)).setText(json.getString("NOTE")); ((TextViewPlus) findViewById(R.id.reviewdetail_date)).setText(json.getString("DAY")); } catch (Exception ex) { } }
From source file:MyWeatherService.java
void doToast(int resource) { Toast.makeText(this, resource, Toast.LENGTH_SHORT).show(); }
From source file:MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mDB = new DictionaryDatabase(this); mEditTextWord = (EditText) findViewById(R.id.editTextWord); mEditTextDefinition = (EditText) findViewById(R.id.editTextDefinition); Button buttonAddUpdate = (Button) findViewById(R.id.buttonAddUpdate); buttonAddUpdate.setOnClickListener(new View.OnClickListener() { @Override/* w ww .j a v a 2 s . c om*/ public void onClick(View v) { saveRecord(); } }); mListView = (ListView) findViewById(R.id.listView); mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { Toast.makeText(MainActivity.this, mDB.getDefinition(id), Toast.LENGTH_SHORT).show(); } }); mListView.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() { @Override public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) { Toast.makeText(MainActivity.this, "Records deleted = " + mDB.deleteRecord(id), Toast.LENGTH_SHORT) .show(); getSupportLoaderManager().restartLoader(0, null, MainActivity.this); return true; } }); getSupportLoaderManager().initLoader(0, null, this); mAdapter = new DictionaryAdapter(this, mDB.getWordList(), 0); mListView.setAdapter(mAdapter); }
From source file:MainActivity.java
public void confirmDelete(View view) { // String[] countries = new String[]{"China", "France", "Germany", "India", "Russia", "United Kingdom", "United States"}; // ListAdapter countryAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, countries); AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle("Delete") //.setIcon(R.mipmap.ic_launcher) .setMessage("Are you sure you?") // .setAdapter(countryAdapter, new DialogInterface.OnClickListener() { // @Override // public void onClick(DialogInterface dialog, int which) { // Toast.makeText(MainActivity.this, countries[which] + " clicked", Toast.LENGTH_SHORT).show(); // } // }) .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { Toast.makeText(MainActivity.this, "OK Pressed", Toast.LENGTH_SHORT).show(); }//w ww . ja v a 2 s . com }).setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { Toast.makeText(MainActivity.this, "Cancel Pressed", Toast.LENGTH_SHORT).show(); } }); builder.create().show(); }
From source file:com.miz.functions.TmdbTrailerSearch.java
@Override protected void onPreExecute() { Toast.makeText(mActivity, mActivity.getString(R.string.searching), Toast.LENGTH_SHORT).show(); }
From source file:com.opera.toast.ToastNotification.java
private void showToast(String message, CallbackContext callback) { Toast.makeText(cordova.getActivity().getApplicationContext(), message, Toast.LENGTH_SHORT).show(); callback.success(message); }
From source file:edu.stanford.mobisocial.dungbeetle.obj.action.SetProfileObjAction.java
public void onAct(Context context, DbEntryHandler objType, DbObj obj) { byte[] raw = obj.getRaw(); JSONObject objData = obj.getJson();/*from w w w . ja va 2s . c o m*/ if (raw == null) { String b64Bytes = objData.optString(PictureObj.DATA); raw = FastBase64.decode(b64Bytes); } Helpers.updatePicture(context, raw); Toast.makeText(context, "Set profile picture.", Toast.LENGTH_SHORT).show(); }