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:Main.java
public static void displaySuccesToast(Activity activity) { Toast.makeText(activity, "Image saved to SD card", Toast.LENGTH_SHORT).show(); }
From source file:com.urucas.plugins.ToastPlugin.java
private void alert(String text, String duration, CallbackContext callbackContext) { Context context = this.cordova.getActivity(); int duration1; if (duration.toLowerCase().equals("long")) { duration1 = Toast.LENGTH_LONG;/*from w w w. j ava 2 s . c o m*/ } else { duration1 = Toast.LENGTH_SHORT; } Toast toast = Toast.makeText(context, text, duration1); toast.show(); }
From source file:MainActivity.java
private boolean isGooglePlayServicesAvailable() { GoogleApiAvailability googleApiAvailability = GoogleApiAvailability.getInstance(); int resultCode = googleApiAvailability.isGooglePlayServicesAvailable(this); if (resultCode != ConnectionResult.SUCCESS) { if (googleApiAvailability.isUserResolvableError(resultCode)) { googleApiAvailability.getErrorDialog(this, resultCode, PLAY_SERVICES_RESOLUTION_REQUEST).show(); } else {/*from ww w .j a v a 2s . com*/ Toast.makeText(MainActivity.this, "Unsupported Device", Toast.LENGTH_SHORT).show(); finish(); } return false; } return true; }
From source file:com.liferay.tasks.callback.DeleteTasksCallback.java
@Override public void onFailure(Exception e) { String message = "Coudn't delete tasks: " + e.getMessage(); Toast.makeText(_activity, message, Toast.LENGTH_SHORT).show(); }
From source file:MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); GridView gridView = new GridView(this); setContentView(gridView);// w w w . java2 s .c o m 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); gridView.setAdapter(countryAdapter); gridView.setNumColumns(2); gridView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { String s = ((TextView) view).getText() + " " + position; Toast.makeText(getApplicationContext(), s, Toast.LENGTH_SHORT).show(); } }); }
From source file:com.eyekabob.Checkin.java
public void submitButtonHandler(View v) { String venueName = ((EditText) findViewById(R.id.checkinVenue)).getText().toString(); if (venueName == null || "".equals(venueName.trim())) { Toast.makeText(this, "Venue name is required", Toast.LENGTH_SHORT).show(); return;//from w w w .ja va 2 s . c o m } Map<String, String> params = new HashMap<String, String>(); Venue venue = (Venue) getIntent().getExtras().get("venue"); params.put("venueId", String.valueOf(venue.getId())); params.put("venue", URLEncoder.encode(venueName)); String shout = ((EditText) findViewById(R.id.checkinShout)).getText().toString(); params.put("shout", URLEncoder.encode(shout)); String uri = EyekabobHelper.Foursquare.getUri("checkins/add", params); new JSONRequestTask("POST").execute(uri); }
From source file:com.liferay.tasks.callback.GetTasksCallback.java
@Override public void onFailure(Exception e) { String message = "Couldn't get tasks " + e.getMessage(); Toast.makeText(_activity, message, Toast.LENGTH_SHORT).show(); }
From source file:hongik.android.project.best.ReviewActivity.java
public void drawReview() throws Exception { String query = "func=beaconreview" + "&buid=" + buid; DBConnector conn = new DBConnector(query); conn.start();/*from w w w. j a va 2s . c o m*/ conn.join(); JSONObject jsonResult = conn.getResult(); boolean result = jsonResult.getBoolean("result"); if (!result) { Toast.makeText(this, "This store is not beacon store", Toast.LENGTH_SHORT).show(); finish(); return; } JSONObject json = jsonResult.getJSONArray("values").getJSONObject(0); sname = json.getString("SNAME"); addr = json.getString("ADDR"); license = json.getString("LICENSE#"); ((TextViewPlus) findViewById(R.id.review_title)).setText(sname); ((TextViewPlus) findViewById(R.id.review_address)).setText(addr); }
From source file:net.primeranks.fs_viewer.fs_replay.GetUserList.java
@Override protected void onPreExecute() { Toast.makeText(a, a.getString(R.string.notifyStartGetUserList), 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//from w w w . ja va 2 s. c o m 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(); updateWordList(); return true; } }); updateWordList(); }