List of usage examples for android.widget Toast LENGTH_LONG
int LENGTH_LONG
To view the source code for android.widget Toast LENGTH_LONG.
Click Source Link
From source file:com.general.vvvv.cmr.MySplash.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_splash); dbLogin = new DbLogin(MySplash.this, DbLogin.DB_NAME, null, DbLogin.DB_VERSION); db_read = dbLogin.getReadableDatabase(); db_write = dbLogin.getWritableDatabase(); String identifier = null;/* w w w . java2s.c o m*/ TelephonyManager tm = (TelephonyManager) this.getSystemService(this.TELEPHONY_SERVICE); if (tm != null) { identifier = tm.getDeviceId(); } if (identifier == null || identifier.length() == 0) { identifier = Settings.Secure.getString(getContentResolver(), Settings.Secure.ANDROID_ID); } Toast.makeText(MySplash.this, "Your IMEI no:" + identifier, Toast.LENGTH_LONG).show(); System.out.println("IMEI no:" + identifier); Log.d("IMEI or Android id:", identifier); Cursor cursor = dbLogin.getData(db_read); if (cursor.getCount() > 0) { Intent intent = new Intent(MySplash.this, MyLogin.class); startActivity(intent); } else { Toast.makeText(MySplash.this, "Login database is empty", Toast.LENGTH_SHORT).show(); if (identifier != null) { new AsynchLogin().execute(identifier); } else { Toast.makeText(MySplash.this, "Unable to find your IMEI no.", Toast.LENGTH_LONG).show(); } } }
From source file:com.app.swaedes.swaedes.LoginPage.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.login_page); //check if the gps is enabled or not GPSTracker gps = new GPSTracker(this); if (!gps.canGetLocation) { gps.showSettingsAlert();// www .j a v a2 s . com } else { Toast.makeText(LoginPage.this, "This app uses the gps to locate your position", Toast.LENGTH_LONG) .show(); } Button btnSignIn = (Button) findViewById(R.id.button_signin); TextView btnSignUp = (TextView) findViewById(R.id.sign_up); //Views email = (EditText) findViewById(R.id.editText_login); password = (EditText) findViewById(R.id.editText_passwd); btnSignIn.setOnClickListener(this); btnSignUp.setOnClickListener(this); }
From source file:com.coderming.weatherwatch.gcm.MyGcmListenerService.java
/** * Called when message is received./*from w w w . jav a 2 s . c o m*/ * * @param from SenderID of the sender. * @param data Data bundle containing message data as key/value pairs. * For Set of keys use data.keySet(). */ @Override public void onMessageReceived(String from, Bundle data) { // Time to unparcel the bundle! if (!data.isEmpty()) { // TODO: gcm_default sender ID comes from the API console String senderId = getString(R.string.gcm_defaultSenderId); if (senderId.length() == 0) { Toast.makeText(this, "SenderID string needs to be set", Toast.LENGTH_LONG).show(); } // Not a bad idea to check that the message is coming from your server. if ((senderId).equals(from)) { // Process message and then post a notification of the received message. try { JSONObject jsonObject = new JSONObject(data.getString(EXTRA_DATA)); String weather = jsonObject.getString(EXTRA_WEATHER); String location = jsonObject.getString(EXTRA_LOCATION); String alert = String.format(getString(R.string.gcm_weather_alert), weather, location); sendNotification(alert); } catch (JSONException e) { // JSON parsing failed, so we just let this message go, since GCM is not one // of our critical features. } } Log.i(TAG, "Received: " + data.toString()); } }
From source file:com.chess.genesis.activity.UserStatsFrag.java
@Override public boolean handleMessage(final Message msg) { try {// ww w . j av a 2 s . c o m switch (msg.what) { case NetworkClient.USER_STATS: final JSONObject json = (JSONObject) msg.obj; if (json.getString("result").equals("error")) { progress.remove(); Toast.makeText(act, "ERROR:\n" + json.getString("reason"), Toast.LENGTH_LONG).show(); return true; } loadStats(json); progress.remove(); break; case StatsLookupDialog.MSG: final String username = (String) msg.obj; progress.setText("Retrieving Stats"); net.user_stats(username); new Thread(net).start(); break; } return true; } catch (final JSONException e) { throw new RuntimeException(e.getMessage(), e); } }
From source file:org.cccb.parallel.RoutesListActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_routes_list); Toast.makeText(this.getApplicationContext(), "Reading from the Internet", Toast.LENGTH_LONG).show(); AccessCCCBData task = new AccessCCCBData(); task.execute();/*from w w w . j a v a 2s .c o m*/ }
From source file:com.applechip.android.showcase.rest.HttpPostStringActivity.java
private void showResult(String result) { // display a notification to the user with the response message Toast.makeText(this, result, Toast.LENGTH_LONG).show(); }
From source file:in.udacity.learning.gcm.MyGcmListenerService.java
/** * Called when message is received./*from w w w. jav a 2s. c o m*/ * * @param from SenderID of the sender. * @param data Data bundle containing message data as key/value pairs. * For Set of keys use data.keySet(). */ @Override public void onMessageReceived(String from, Bundle data) { // Time to unparcel the bundle! if (!data.isEmpty()) { // TODO: gcm_default sender ID comes from the API console String senderId = getString(R.string.gcm_defaultSenderId); if (senderId.length() == 0) { Toast.makeText(this, "SenderID string needs to be set", Toast.LENGTH_LONG).show(); } // Not a bad idea to check that the message is coming from your server. if ((senderId).equals(from)) { // Process message and then post a notification of the received message. try { //String d = data.getString(EXTRA_DATA); String d2 = data.toString(); d2 = d2.replace("Bundle", ""); JSONArray jsonArray = new JSONArray(d2); JSONObject jsonObject = jsonArray.getJSONObject(0); String weather = jsonObject.getString(EXTRA_WEATHER); String location = jsonObject.getString(EXTRA_LOCATION); String alert = String.format(getString(R.string.gcm_weather_alert), weather, location); sendNotification(alert); } catch (JSONException e) { Log.e(TAG, e.toString()); } } Log.i(TAG, "Received: " + data.toString()); } }
From source file:net.primeranks.fs_viewer.fs_replay.GetUserList.java
@Override protected void onPostExecute(List<User> l) { if (l == null) { Toast.makeText(a, a.getString(R.string.errorGetUserList), Toast.LENGTH_LONG).show(); return;//from w w w.j a v a 2 s .c o m } String t = a.getString(R.string.returnedUserCount, l.size()); Toast.makeText(a, t, Toast.LENGTH_LONG).show(); a.setUserList(l); }
From source file:io.v.x.media_sharing.SendMediaTask.java
@Override protected Void doInBackground(Void... params) { try {/*from w w w . j a v a 2s . c o m*/ InputStream is = activity.getContentResolver().openInputStream(uri); MediaSharingClient client = MediaSharingClientFactory.getMediaSharingClient(targetName); // TODO(bprosnitz) Remove this option when possible. It is allows the app to connect // without having the proper blessings. Options opts = new Options(); opts.set(OptionDefs.SKIP_SERVER_ENDPOINT_AUTHORIZATION, true); String mimeType = activity.getIntent().getType(); TypedClientStream<byte[], Void, Void> stream = client.displayBytes(vContext, mimeType, opts); ClientByteOutputStream os = new ClientByteOutputStream(stream); IOUtils.copy(is, os); stream.finish(); Log.i(TAG, activity.getString(R.string.share_messsage_success)); activity.runOnUiThread(new Runnable() { @Override public void run() { Toast.makeText(activity, R.string.share_messsage_success, Toast.LENGTH_LONG).show(); } }); return null; } catch (IOException | VException e) { final String errorMessage = activity.getString(R.string.share_messsage_error) + ": " + e.toString(); Log.e(TAG, errorMessage); activity.runOnUiThread(new Runnable() { @Override public void run() { Toast.makeText(activity, errorMessage, Toast.LENGTH_LONG).show(); } }); throw new RuntimeException(e); } }
From source file:com.example.carrie.carrie_test1.scandrug.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_scandrug); cameraView = (SurfaceView) findViewById(R.id.cameraView); cameraView.setZOrderMediaOverlay(true); holder = cameraView.getHolder();/*from ww w .j a va 2 s .co m*/ barcode = new BarcodeDetector.Builder(this).setBarcodeFormats(Barcode.QR_CODE).build(); if (!barcode.isOperational()) { Toast.makeText(getApplicationContext(), "Sorry ,Couldn't set up the detector", Toast.LENGTH_LONG) .show(); this.finish(); } cameraSource = new CameraSource.Builder(this, barcode).setFacing(CameraSource.CAMERA_FACING_BACK) .setRequestedFps(24).setAutoFocusEnabled(true).setRequestedPreviewSize(1920, 1024).build(); cameraView.getHolder().addCallback(new SurfaceHolder.Callback() { @Override public void surfaceCreated(SurfaceHolder holder) { try { if (ContextCompat.checkSelfPermission(scandrug.this, android.Manifest.permission.CAMERA) == PackageManager.PERMISSION_GRANTED) { cameraSource.start(cameraView.getHolder()); } } catch (IOException e) { e.printStackTrace(); } } @Override public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) { } @Override public void surfaceDestroyed(SurfaceHolder holder) { } }); barcode.setProcessor(new Detector.Processor<Barcode>() { @Override public void release() { } @Override public void receiveDetections(Detector.Detections<Barcode> detections) { final SparseArray<Barcode> barcodes = detections.getDetectedItems(); if (barcodes.size() > 0) { int count; Intent intent = new Intent(); intent.putExtra("barcode", barcodes.valueAt(0)); Log.d("code", barcodes.valueAt(0).displayValue); urlcode = barcodes.valueAt(0).displayValue; Log.d("code2", barcodes.valueAt(0).displayValue); geturl(); setResult(RESULT_OK, intent); // cameraSource.stop(); // addNormalDialogEvent(); } } }); }