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.gigathinking.simpleapplock.ResetUnlockMethod.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.layout_reset); getActionBar().setDisplayHomeAsUpEnabled(true); mDialog = new ProgressDialog(this, ProgressDialog.STYLE_SPINNER); mDialog.setIndeterminate(true);//from w ww. j av a2 s .c o m prefs = PreferenceManager.getDefaultSharedPreferences(this); mResetReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { prefs.edit().putString(AppLockApplication.LOCKTYPE, AppLockApplication.LOCKTYPE_PIN).commit(); prefs.edit() .putString(AppLockApplication.PASSWORD, intent.getStringExtra(AppLockApplication.PASSWORD)) .commit(); Toast.makeText(context, getString(R.string.pin_reset), Toast.LENGTH_LONG).show(); startActivity(new Intent(Intent.ACTION_MAIN).addCategory(Intent.CATEGORY_HOME) .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK)); //startActivity(new Intent(ResetUnlockMethod.this,UnlockWithPIN.class).putExtra("test","test")); finish(); } }; LocalBroadcastManager.getInstance(this).registerReceiver(mResetReceiver, new IntentFilter(AppLockApplication.RESET_UNLOCK)); if (!PreferenceManager.getDefaultSharedPreferences(this).getBoolean(getString(R.string.register_complete), false)) { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setMessage(getString(R.string.reset_register_device)); builder.setTitle(getString(R.string.info)); builder.setPositiveButton(getString(R.string.register), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { new Register().execute(); if (mDialog != null) { mDialog.setMessage(getString(R.string.register_ongoing)); mDialog.show(); } dialog.dismiss(); } }); builder.setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); finish(); Intent intent = new Intent(Intent.ACTION_MAIN); intent.addCategory(Intent.CATEGORY_HOME); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); } }); builder.create().show(); } else { if (mDialog != null) { mDialog.setMessage(getString(R.string.connect_to_server)); mDialog.show(); } new DoRequestReset().execute(); } }
From source file:de.kartheininger.markerclustering.AbstractMapActivity.java
protected boolean readyToGo() { int status = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this); if (status == ConnectionResult.SUCCESS) { if (getVersionFromPackageManager(this) >= 2) { return (true); } else {//w ww. j a va2 s .co m Toast.makeText(this, R.string.activity_maps_noMaps, Toast.LENGTH_LONG).show(); finish(); } } else if (GooglePlayServicesUtil.isUserRecoverableError(status)) { ErrorDialogFragment.newInstance(status).show(getSupportFragmentManager(), TAG_ERROR_DIALOG_FRAGMENT); } else { Toast.makeText(this, R.string.activity_maps_noMaps, Toast.LENGTH_LONG).show(); finish(); } return (false); }
From source file:com.applechip.android.showcase.rest.HttpPostJsonXmlActivity.java
private void showResult(String result) { if (result != null) { // display a notification to the user with the response message Toast.makeText(this, result, Toast.LENGTH_LONG).show(); } else {// www . j a va 2 s . c om Toast.makeText(this, "I got null, something happened!", Toast.LENGTH_LONG).show(); } }
From source file:br.com.cams7.siscom.member.MemberEdit.java
public void addListenerOnSave() { bSave = (Button) findViewById(R.id.bSave); bSave.setOnClickListener(new OnClickListener() { @Override/*www .j a v a 2 s . co m*/ public void onClick(View view) { // Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri // .parse("http://www.mkyong.com")); // startActivity(browserIntent); Log.v(TAG, "Save button clicked"); if (validate()) { new HttpAsyncTask().execute(URL); Toast.makeText(getBaseContext(), getString(R.string.msg_enter_some_data), Toast.LENGTH_LONG) .show(); finish(); } } }); }
From source file:org.teleportr.activity.Autocompletion.java
/** Called when the activity is first created. */ @Override//from w w w . j a va 2 s .com public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setTitle(getString(R.string.downloads_activity_titel)); getPreferenceManager().setSharedPreferencesName("autocompletion"); setPreferenceScreen(getPreferenceManager().createPreferenceScreen(this)); File dir = new File(Environment.getExternalStorageDirectory().getPath() + "/teleporter"); if (!dir.exists()) dir.mkdir(); final Map<String, ?> vals = getPreferenceManager().getSharedPreferences().getAll(); if (vals.isEmpty() && dir.list().length > 0) Toast.makeText(this, getString(R.string.inform_sdcard), Toast.LENGTH_LONG).show(); // clean up (autocompletion downloads deleted on sdcard) getPreferenceManager().getSharedPreferences().edit().clear().commit(); for (String file : dir.list()) { CheckBoxPreference c = new CheckBoxPreference(this); getPreferenceScreen().addItemFromInflater(c); c.setKey(file); c.setTitle(file.split("_")[0]); c.setSummary(file.substring(file.indexOf("_") + 1, file.lastIndexOf("."))); if (vals.containsKey(file)) { c.setChecked((Boolean) vals.get(file)); } } if (getPreferenceScreen().getPreferenceCount() == 0) new FetchNearbyDownloads().execute(""); }
From source file:io.cloudmatch.demo.pinchanddrag.PADServerEventListener.java
@Override public void onConnectionError(final Exception error) { Log.d(TAG, "onConnectionError"); String msg = "connection error"; if (error instanceof CloudMatchInvalidCredentialException) { msg = "The API Key and APP Id that you are using seem to be incorrect. Are you running the latest version of CloudMatch Demo?"; } else if (error instanceof CloudMatchConnectionException) { msg = error.getMessage();/*ww w . ja v a 2 s . c o m*/ } Toast.makeText(mActivity, msg, Toast.LENGTH_LONG).show(); }
From source file:com.example.clienttest.AbstractGreenhouseActivity.java
protected void displayNetworkError() { Toast toast = Toast.makeText(this, "A problem occurred with the network connection while attempting to communicate with Greenhouse.", Toast.LENGTH_LONG); toast.setGravity(Gravity.CENTER, 0, 0); toast.show();/* w w w. ja va2 s . c om*/ }
From source file:com.citrus.sdk.webops.SavePayOption.java
@Override protected void onPostExecute(Void aVoid) { super.onPostExecute(aVoid); if (TextUtils.equals(result, "success")) { Toast.makeText(activity.getApplicationContext(), "Payment Option Saved.", Toast.LENGTH_LONG).show(); }//from www.j av a 2s. c o m }
From source file:io.cloudmatch.demo.swipeandcolor.SACServerEventListener.java
@Override public void onConnectionError(final Exception error) { Log.d(TAG, "onConnectionError"); String msg = "connection error"; if (error instanceof CloudMatchInvalidCredentialException) { msg = "The API Key and APP Id that you are using seem to be incorrect." + " Are you running the latest version of CloudMatch Demo?"; } else if (error instanceof CloudMatchConnectionException) { msg = error.getMessage();/*ww w . j av a 2 s . com*/ } Toast.makeText(mActivity, msg, Toast.LENGTH_LONG).show(); }
From source file:mp.paschalis.LentBookActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); app = (App) getApplication();/*from w ww . j ava2 s . c o m*/ setContentView(R.layout.activity_lent_book); getSupportActionBar().setDisplayHomeAsUpEnabled(true); // Get arguments (User,Destination,ISBN) final Bundle extras = getIntent().getExtras(); try { final String isbn = extras.getString(App.ExtrasForLentBookActivityISBN); fromEditBookActivity = true; gotISBN = isbn; } catch (Exception e) { Toast.makeText(LentBookActivity.this, "Something went wrong. Please report this", Toast.LENGTH_LONG) .show(); fromEditBookActivity = false; LentBookActivity.this.finish(); } progressBarLentButton = (ProgressBar) findViewById(R.id.progressBarLentButton); buttonLentBook = (Button) findViewById(R.id.buttonLentBook); editTextDestinationUsername = (EditText) findViewById(R.id.editTextDestinationUser); textViewLentResult = (TextView) findViewById(R.id.textViewLentResult); editTextDestinationUsername.addTextChangedListener(new TextWatcher() { @Override public void onTextChanged(CharSequence s, int start, int before, int count) { } @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void afterTextChanged(Editable s) { if (editTextDestinationUsername.getText().length() >= 4) { buttonLentBook.setEnabled(true); } else { buttonLentBook.setEnabled(false); } } }); buttonLentBook.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { DataClassLentABook data = new DataClassLentABook(); data.destinationUser = editTextDestinationUsername.getText().toString(); data.isbn = gotISBN; new AsyncTaskLentABook().execute(data); } }); }