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.wms.opensource.images3android.manager.MenuManager.java
public static void displayImageProcessOptionsMenu(final Context context, final Image image, final Bitmap bitmap, final ReviewImageManager manager) { IconContextMenu cm = new IconContextMenu(context, R.menu.image_process_options_menu); cm.setOnIconContextItemSelectedListener(new IconContextItemSelectedListener() { @SuppressWarnings("deprecation") @Override/*from w w w. jav a 2 s. c o m*/ public void onIconContextItemSelected(MenuItem item, Object info) { if (item.getItemId() == R.id.action_hint) { // Position 0 is the indication for selecting a template, so we do nothing } else if (item.getItemId() == R.id.action_save_to_gallery) { MediaStore.Images.Media.insertImage(context.getContentResolver(), bitmap, image.getId(), ""); Toast.makeText(context, context.getString(R.string.saveToGallaryCompleted), Toast.LENGTH_LONG) .show(); } else if (item.getItemId() == R.id.action_set_as_wall_paper) { try { context.setWallpaper(bitmap); Toast.makeText(context, context.getString(R.string.setWallPaperCompleted), Toast.LENGTH_LONG).show(); } catch (IOException e) { } } else if (item.getItemId() == R.id.action_delete) { manager.dismiss(); // Delete image DeleteImageTask task = new DeleteImageTask(context, image.getBaseUrl(), image.getImagePlantId(), image.getId()); task.execute(); } } }); cm.show(); }
From source file:fi.mikuz.boarder.gui.internet.Register.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.internet_register); this.setVolumeControlStream(AudioManager.STREAM_MUSIC); mSubmit = (Button) findViewById(R.id.submit); mUserName = (EditText) findViewById(R.id.userName); mUserPassword = (EditText) findViewById(R.id.userPassword); mUserPassword2 = (EditText) findViewById(R.id.userPassword2); mUserEmail = (EditText) findViewById(R.id.userEmail); mSubmit.setOnClickListener(new OnClickListener() { public void onClick(View v) { if (!mUserPassword.getText().toString().equals(mUserPassword2.getText().toString())) { Toast.makeText(Register.this, "The passwords don't match", Toast.LENGTH_LONG).show(); } else if (mUserPassword.length() < 6) { Toast.makeText(Register.this, "Password length must be at least 6 characters", Toast.LENGTH_LONG).show(); } else { try { mWaitDialog = new TimeoutProgressDialog(Register.this, "Waiting for response", TAG, false); HashMap<String, String> sendList = new HashMap<String, String>(); sendList.put(InternetMenu.USERNAME_KEY, mUserName.getText().toString()); sendList.put(InternetMenu.PASSWORD_KEY, Security.passwordHash(mUserPassword.getText().toString())); sendList.put(InternetMenu.EMAIL_KEY, mUserEmail.getText().toString()); new ConnectionManager(Register.this, InternetMenu.mRegistrationURL, sendList); } catch (NoSuchAlgorithmException e) { mWaitDialog.dismiss(); String msg = "Couldn't hash the password"; Toast.makeText(Register.this, msg, Toast.LENGTH_LONG).show(); Log.e(TAG, msg, e);/*from w w w. j ava2s. c o m*/ } } } }); }
From source file:no.ntnu.idi.socialhitchhiking.myAccount.MyAccountMeActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); isUserInitialized = false;//from w ww . java2 s . c o m isImageInitialized = false; try { // Setting the loading layout setContentView(R.layout.main_loading); // Getting the user from the database user = getApp().getUser(); userLoader = new UserLoader(this).execute(); // Adding image of the driver // Execute the Asynctask: Get image from url and add it to the ImageView getImage = new GetImage(picture, this).execute(user.getPictureURL()); } catch (NullPointerException e) { Toast.makeText(this, "A server error occured.", Toast.LENGTH_LONG).show(); } }
From source file:fi.mikuz.boarder.gui.internet.Settings.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.internet_settings); this.setVolumeControlStream(AudioManager.STREAM_MUSIC); @SuppressWarnings("unchecked") HashMap<String, String> lastSession = (HashMap<String, String>) getIntent() .getSerializableExtra(InternetMenu.LOGIN_KEY); try {/* ww w .j a va2 s .co m*/ mUserId = lastSession.get(InternetMenu.USER_ID_KEY); mSessionToken = lastSession.get(InternetMenu.SESSION_TOKEN_KEY); } catch (NullPointerException e) { Toast.makeText(Settings.this, "Please login", Toast.LENGTH_LONG).show(); Settings.this.finish(); } Button changePassword = (Button) findViewById(R.id.change_password); changePassword.setOnClickListener(new OnClickListener() { public void onClick(View v) { LayoutInflater inflater = (LayoutInflater) Settings.this.getSystemService(LAYOUT_INFLATER_SERVICE); View layout = inflater.inflate(R.layout.internet_settings_alert_change_password, (ViewGroup) findViewById(R.id.alert_settings_root)); final EditText oldPasswordInput = (EditText) layout.findViewById(R.id.oldPasswordInput); final EditText newPassword1Input = (EditText) layout.findViewById(R.id.newPassword1Input); final EditText newPassword2Input = (EditText) layout.findViewById(R.id.newPassword2Input); Button submitButton = (Button) layout.findViewById(R.id.submitButton); AlertDialog.Builder builder = new AlertDialog.Builder(Settings.this); builder.setView(layout); builder.setTitle("Change password"); submitButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { String oldPasswordText = oldPasswordInput.getText().toString(); String newPassword1Text = newPassword1Input.getText().toString(); String newPassword2Text = newPassword2Input.getText().toString(); if (!newPassword1Text.equals(newPassword2Text)) { Toast.makeText(Settings.this, "New passwords don't match", Toast.LENGTH_LONG).show(); } else if (newPassword1Text.length() < 6) { Toast.makeText(Settings.this, "Password length must be at least 6 characters", Toast.LENGTH_LONG).show(); } else { try { mWaitDialog = new TimeoutProgressDialog(Settings.this, "Waiting for response", TAG, false); HashMap<String, String> sendList = new HashMap<String, String>(); sendList.put(InternetMenu.PASSWORD_KEY, Security.passwordHash(newPassword1Text)); sendList.put(InternetMenu.OLD_PASSWORD_KEY, Security.passwordHash(oldPasswordText)); sendList.put(InternetMenu.USER_ID_KEY, mUserId); sendList.put(InternetMenu.SESSION_TOKEN_KEY, mSessionToken); new ConnectionManager(Settings.this, InternetMenu.mChangePasswordURL, sendList); } catch (NoSuchAlgorithmException e) { mWaitDialog.dismiss(); String msg = "Couldn't make md5 hash"; Toast.makeText(Settings.this, msg, Toast.LENGTH_LONG).show(); Log.e(TAG, msg, e); } } } }); builder.show(); } }); Button changeEmail = (Button) findViewById(R.id.change_email); changeEmail.setOnClickListener(new OnClickListener() { public void onClick(View v) { LayoutInflater inflater = (LayoutInflater) Settings.this.getSystemService(LAYOUT_INFLATER_SERVICE); View layout = inflater.inflate(R.layout.internet_settings_alert_change_email, (ViewGroup) findViewById(R.id.alert_settings_root)); final EditText passwordInput = (EditText) layout.findViewById(R.id.passwordInput); final EditText newEmailInput = (EditText) layout.findViewById(R.id.newEmailInput); Button submitButton = (Button) layout.findViewById(R.id.submitButton); AlertDialog.Builder builder = new AlertDialog.Builder(Settings.this); builder.setView(layout); builder.setTitle("Change email"); submitButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { String passwordText = passwordInput.getText().toString(); String newEmailText = newEmailInput.getText().toString(); try { mWaitDialog = new TimeoutProgressDialog(Settings.this, "Waiting for response", TAG, false); HashMap<String, String> sendList = new HashMap<String, String>(); sendList.put(InternetMenu.PASSWORD_KEY, Security.passwordHash(passwordText)); sendList.put(InternetMenu.EMAIL_KEY, newEmailText); sendList.put(InternetMenu.USER_ID_KEY, mUserId); sendList.put(InternetMenu.SESSION_TOKEN_KEY, mSessionToken); new ConnectionManager(Settings.this, InternetMenu.mChangeEmailURL, sendList); } catch (NoSuchAlgorithmException e) { mWaitDialog.dismiss(); String msg = "Couldn't make md5 hash"; Toast.makeText(Settings.this, msg, Toast.LENGTH_LONG).show(); Log.e(TAG, msg, e); } } }); builder.show(); } }); }
From source file:com.weiboa.activity.SignInActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.login);/* w w w. j av a 2 s . c o m*/ mContext = getApplicationContext(); mApplication = (WeiboAApplication) getApplication(); mDb = mApplication.getWeiboUserDB(); mWelcomeText = (TextView) findViewById(R.id.welcome); mSignInButton = (Button) findViewById(R.id.buttonLogin); mOAuthButton = (Button) findViewById(R.id.buttonOAuth); mOAuthConntect = new OAuthConntect(); mOAuthButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (!checkhadAccessToken()) { new OAuthAcquireRequestTokenTask().execute(); } else { Toast.makeText(SignInActivity.this, getText(R.string.do_not_need_authrize), Toast.LENGTH_LONG) .show(); } } }); mSignInButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (checkhadAccessToken()) { startActivity(new Intent(SignInActivity.this, TimeLineActivity.class)); } else { Toast.makeText(SignInActivity.this, getText(R.string.text_authrize_first), Toast.LENGTH_LONG) .show(); } } }); if (checkhadAccessToken()) { WeiboUser wu = WeiboUser.getInstance(mDb); if (wu.getUsername() != null) { mWelcomeText.setText("Welcome " + wu.getUsername()); } else { mWelcomeText.setText("Please first to authrize!"); } } else { mWelcomeText.setText("Please first to authrize!"); } }
From source file:mp.paschalis.RequestActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_request); getSupportActionBar().setDisplayHomeAsUpEnabled(true); app = (App) getApplication();/* w w w. j a v a 2 s . c o m*/ // Get arguments, to determine who opened this activity final Bundle extras = getIntent().getExtras(); try { dataClassActivities = (MainActivity.DataClassActivities) extras .get(App.ExtrasForRequestBookActivityFromActivitiesActivity); } catch (Exception e) { Toast.makeText(RequestActivity.this, R.string.msgErrorApplicationReport, Toast.LENGTH_LONG).show(); finish(); } // Get layout's Data TextView username = (TextView) findViewById(R.id.textViewActivityItemUsername); TextView date = (TextView) findViewById(R.id.textViewActivityItemDate); TextView acknowledgeTitle = (TextView) findViewById(R.id.textViewActivityItemAnswerTitle); TextView acknowledge = (TextView) findViewById(R.id.textViewActivityItemAnswer); TextView isbn = (TextView) findViewById(R.id.textViewActivityItemISBN); TextView title = (TextView) findViewById(R.id.textViewActivityItemTitle); TextView authors = (TextView) findViewById(R.id.textViewActivityItemAuthors); ImageView cover = (ImageView) findViewById(R.id.imageViewActivityBookCover); username.setText(dataClassActivities.username); date.setText(App.makeTimeStampHumanReadble(getApplicationContext(), dataClassActivities.book.dateOfInsert)); // Set Ack Status strings ExpandableAdapterActivityInfo.setStatusString(dataClassActivities.acknowledge, acknowledge, acknowledgeTitle); TextView tvnc = (TextView) findViewById(R.id.textViewNoCover); isbn.setText(dataClassActivities.book.isbn); title.setText(dataClassActivities.book.title); authors.setText(dataClassActivities.book.authors); // show The Image and save it to Library ImageLoader.DataClassDisplayBookCover bk = new ImageLoader.DataClassDisplayBookCover(); bk.iv = cover; bk.isCover = true; bk.tv = tvnc; bk.pb = (ProgressBar) findViewById(R.id.progressBarLoadCover); bk.book = dataClassActivities.book; App.imageLoader.DisplayCover(bk); buttonHybrid = (Button) findViewById(R.id.buttonRequestHybrid); buttonContact = (Button) findViewById(R.id.buttonRequestContact); buttonContact.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(RequestActivity.this, SendMessageActivity.class); intent.putExtra(App.ExtrasForSendMessage_DestinationUser, dataClassActivities.username); startActivity(intent); } }); progressBarHybrid = (ProgressBar) findViewById(R.id.progressBarRequestHybridButton); switch (dataClassActivities.type) { case IncomingRequest: // Other user wants my books if (dataClassActivities.acknowledge == App.REQUESTS_ANSWER_DINT_ANSWER_YET) { hButtonReplyRequest(); buttonHybrid.setText(R.string.reply); } else if (dataClassActivities.acknowledge == App.REQUESTS_ANSWER_POSITIVE) { hButtonLentABook(); } else { hButtonDeleteRequest(); } break; case OutgoingRequest: // I want a book that belongs to other user if (dataClassActivities.acknowledge == App.REQUESTS_ANSWER_DINT_ANSWER_YET) { hButtonDeleteRequest(); } else if (dataClassActivities.acknowledge == App.REQUESTS_ANSWER_POSITIVE) { hButtonHide(); } else { hButtonDeleteRequest(); } buttonHybrid.setText(R.string.deleteRequest); break; case BooksITook: // Book i lented from another user(took) hButtonHide(); break; case BooksIGave: // Book i lent to other user(gave) hButtonReturnBook(); break; default: break; } }
From source file:ch.gianulli.trelloapi.Card.java
/** * Moves this card to a different list. Attention: this operation does not update TrelloList * objects with a reference to this card. * <p/>/*from w w w .j a v a 2s . c o m*/ * This operation is asynchronous and handles errors itself. * * @param api * @param listId */ public void moveToListAsync(final TrelloAPI api, final String listId) { new AsyncTask<Void, Void, Boolean>() { @Override protected Boolean doInBackground(Void... voids) { try { LinkedHashMap<String, String> args = new LinkedHashMap<>(); args.put("value", listId); JSONObject result = api.makeJSONObjectRequest("PUT", "cards/" + mId + "/idList", args, true); if (result == null) { Log.i("TrelloAPI", "Error occurred when moving card: null result"); return false; } } catch (TrelloNotAccessibleException | TrelloNotAuthorizedException e) { Log.i("TrelloAPI", "Error occurred when moving card: ", e); return false; } return true; } @Override protected void onPostExecute(Boolean successful) { if (!successful) { Toast.makeText(api.getContext(), "Error: Card could not be moved.", Toast.LENGTH_LONG).show(); } } }.execute(); }
From source file:de.gadc.moneybeam.ReceiveRequestActivity.java
/** * This static method is used for the {@link ResultDelegate}. It provides a * quick way for toasting.//from www . j av a2s . com * * @param text * the id of the message to show */ public static void showToast(final int text) { activity.runOnUiThread(new Runnable() { public void run() { Toast.makeText(activity, text, Toast.LENGTH_LONG).show(); } }); }
From source file:com.github.wakhub.monodict.activity.bean.ActivityHelper.java
@UiThread public void showToastLong(String message) { Toast toast = Toast.makeText(activity.getApplicationContext(), message, Toast.LENGTH_LONG); toast.setGravity(Gravity.BOTTOM, 0, 0); toast.show();/*w ww . ja v a 2 s .c o m*/ }