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:de.tavendo.autobahn.simplerpc.SimpleRpcActivity.java
private void alert(String message) { Toast.makeText(getApplicationContext(), message, Toast.LENGTH_SHORT).show(); }
From source file:com.manning.androidhacks.hack016.MainActivity.java
public void upperLeft(View v) { Toast toast = Toast.makeText(this, "Upper Left!", Toast.LENGTH_SHORT); toast.setGravity(Gravity.TOP | Gravity.LEFT, 0, 0); toast.show();//from w ww . j a v a 2 s.c o m }
From source file:com.zeusky.star.star.java
public static void createSharePicDir() { boolean sdCardExist = Environment.getExternalStorageState().equals(android.os.Environment.MEDIA_MOUNTED); if (!sdCardExist) { Toast.makeText(m_instance, "???", Toast.LENGTH_SHORT).show(); } else {// ww w .j av a 2 s. com String dir = Environment.getExternalStorageDirectory() + File.separator + "zeusky.popstar"; Log.d("shareSDK", "I am need this dir " + dir); File snapShotDir = new File(dir); if (!snapShotDir.exists()) { snapShotDir.mkdir(); } methodsRun.injectOtherDir(dir + File.separator); } }
From source file:de.hhn.android.licenseplatedecoder.activities.OSMActivity.java
/** Called when the activity is first created. */ @Override/*from ww w . ja v a 2 s .c o m*/ public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.osmview); mapView = (MapView) findViewById(R.id.osmView); mapView.setBuiltInZoomControls(true); mapView.setMultiTouchControls(true); mapController = mapView.getController(); mapController.setZoom(2); RegionInformation regInfo = getIntent().getExtras().getParcelable("region-info"); String buildQuery = regInfo.getRegionName() + ", " + regInfo.getCountryName(); Toast.makeText(this, "Query: " + buildQuery, Toast.LENGTH_SHORT).show(); new ProcessQuery().execute(buildQuery); }
From source file:edu.rosehulman.gcmtutorialandroid.GcmBroadcastReceiver.java
@Override public void onReceive(Context context, Intent intent) { Bundle extras = intent.getExtras();/*from w w w . ja v a2s .co m*/ GoogleCloudMessaging gcm = GoogleCloudMessaging.getInstance(context); String messageType = gcm.getMessageType(intent); Log.d("GCM", "Message type:" + messageType); if (!extras.isEmpty()) { // has effect of unparcelling Bundle if (GoogleCloudMessaging.MESSAGE_TYPE_SEND_ERROR.equals(messageType)) { Toast.makeText(MainActivity.mMainActivity, "Error: " + extras.toString(), Toast.LENGTH_SHORT) .show(); } else if (GoogleCloudMessaging.MESSAGE_TYPE_DELETED.equals(messageType)) { Toast.makeText(MainActivity.mMainActivity, "Deleted message: " + extras.toString(), Toast.LENGTH_SHORT).show(); } else if (GoogleCloudMessaging.MESSAGE_TYPE_MESSAGE.equals(messageType)) { // If it's a regular GCM message, do some work. try { JSONObject jsonObj = new JSONObject(extras.getString("data")); MainActivity.mMainActivity.receivedGcmJson(jsonObj); // Log.d("GCM", "simple_string: " + jsonObj.getString("simple_string")); // Log.d("GCM", "int_value: " + jsonObj.getInt("int_value")); // Log.d("GCM", "float_value: " + jsonObj.getDouble("float_value")); } catch (JSONException e) { e.printStackTrace(); } } } }
From source file:edu.illinois.whereru.FriendBuilder.java
/** * Build friends list from DB data./*from w w w . jav a2 s . c o m*/ * * @param context application context */ public static void build(Context context) { try { JSONObject json = getFriendInfoFromDB(context); // get data from DB List<Profile> profiles = JSONObjectParser // extract profiles .parseDistinctProfile(json); List<OverlayItem> locations = JSONObjectParser // extract overlays .parseOverlayItems(json); for (Profile profile : profiles) { if (friends.containsKey(profile.getId())) { //If this friend already exists // update the profile of with possibly a new one Friend friend = friends.get(profile.getId()); friend.setProfile(profile); } else { // Create a new friend for with this profile friends.put(profile.getId(), new Friend(context, profile)); } } Friend friend = null; String prevId = ""; /* Update locations to corresponding friend object. * Assumes the data returned from DB is ordered by friend id. */ for (OverlayItem location : locations) { String id = ((MarkerOverlayItem) location).getId(); if (!prevId.equals(id)) { friend = friends.get(id); } friend.getOverlay().addOverlay(location); } } catch (Exception e) { e.printStackTrace(); Toast.makeText(context, "Couldn't load friend information...", Toast.LENGTH_SHORT).show(); } }
From source file:edu.stanford.mobisocial.dungbeetle.feed.presence.MusicPresence.java
@Override public void onPresenceUpdated(final Context context, final Uri feedUri, boolean present) { if (mShareMusic) { if (getFeedsWithPresence().size() == 0) { context.getApplicationContext().unregisterReceiver(mReceiver); Toast.makeText(context, "No longer sharing music", Toast.LENGTH_SHORT).show(); mShareMusic = false;/* w w w .j a va2 s .c om*/ } } else { if (getFeedsWithPresence().size() > 0) { IntentFilter iF = new IntentFilter(); iF.addAction("com.android.music.metachanged"); context.getApplicationContext().registerReceiver(mReceiver, iF); Toast.makeText(context, "Now sharing music", Toast.LENGTH_SHORT).show(); mShareMusic = true; } } }
From source file:com.github.fi3te.iliasdownloader.controller.Util.java
public static void openFile(File file, Activity forMessages) { if (file != null && forMessages != null && file.isFile()) { String extension = FilenameUtils.getExtension(file.getPath()); if (extension.length() > 0) { try { extension = extension.toLowerCase(); Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(Uri.fromFile(file), MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension)); intent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY); forMessages.startActivity(intent); } catch (ActivityNotFoundException anfe) { Toast.makeText(forMessages, forMessages.getResources().getString(R.string.unknown_type), Toast.LENGTH_SHORT).show(); }// w w w . j a v a2 s. co m } } }
From source file:com.perm.DoomPlay.AbstractVkItems.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.itemRefresh: if (isLoading) AbstractList.waitMessage(getBaseContext()); if (!MainScreenActivity.isRegister) Toast.makeText(getBaseContext(), getResources().getString(R.string.please_sign_in), Toast.LENGTH_SHORT).show(); else/*w w w . j av a 2 s . c o m*/ onClickRefresh(); return true; case R.id.itemInterrupt: cancelLoading(); return true; } return super.onOptionsItemSelected(item); }
From source file:com.manning.androidhacks.hack016.MainActivity.java
public void upperRight(View v) { Toast toast = Toast.makeText(this, "Upper Right!", Toast.LENGTH_SHORT); toast.setGravity(Gravity.TOP | Gravity.RIGHT, 0, 0); toast.show();//from w w w. ja v a 2 s .c om }