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.piggate.samples.PiggateLogin.Activity_SingIn.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); _piggate = new Piggate(this, null); //Initialize the Piggate object setContentView(R.layout.activity_login); //EditTexts for user email and password editEmail = (EditText) findViewById(R.id.editText1); editPass = (EditText) findViewById(R.id.editText2); Button login = (Button) findViewById(R.id.buttonlogin2); final ImageButton return_button = (ImageButton) findViewById(R.id.return1); //Handles the top left back button of the activity return_button.setOnClickListener(new View.OnClickListener() { @Override//from w ww . j av a 2 s . c om public void onClick(View v) { onBackPressed(); } }); //OnClick listener for the login button //Handles the register request to the server with the email and password fields //and the login request if the fields are correct login.setOnClickListener(new View.OnClickListener() { @Override synchronized public void onClick(View v) { if (!handledClick) { handledClick = true; String email = editEmail.getText().toString(); String pass = editPass.getText().toString(); //If the internet connection is working if (checkInternetConnection() == true) { RequestParams params = new RequestParams(); params.put("email", email); params.put("password", pass); //Request of the Piggate object. Handles the register into the application // and the login with the user email and password _piggate.RequestOpenSession(params).setListenerRequest(new Piggate.PiggateCallBack() { //Method onComplete for JSONObject //When the request is correct start Activity_Logged activity @Override public void onComplete(int statusCode, Header[] headers, String msg, JSONObject data) { Toast.makeText(getApplicationContext(), msg, Toast.LENGTH_LONG).show(); Intent slideactivity = new Intent(Activity_SingIn.this, Activity_Logged.class); Bundle bndlanimation = ActivityOptions .makeCustomAnimation(getApplicationContext(), R.anim.flip1, R.anim.flip2) .toBundle(); startActivity(slideactivity, bndlanimation); } //Method onError for JSONObject //If there's an error with the request displays the error message to the user @Override public void onError(int statusCode, Header[] headers, String msg, JSONObject data) { Toast.makeText(getApplicationContext(), msg, Toast.LENGTH_LONG).show(); handledClick = false; } //Method onComplete for JSONArray @Override public void onComplete(int statusCode, Header[] headers, String msg, JSONArray data) { //Unused } //Method onError for JSONArray @Override public void onError(int statusCode, Header[] headers, String msg, JSONArray data) { //Unused } }).exec(); } else { //If the internet connection is not working Toast.makeText(getApplicationContext(), "Network is not working", Toast.LENGTH_LONG).show(); handledClick = false; } } } }); }
From source file:de.egore911.drilog.tasks.JsonLoadTask.java
@Override protected void onPostExecute(String json) { ShowDataAdapter result;//from w w w. j ava 2s . c o m JSONObject o = null; try { if (json != null) { o = new JSONObject(json); } } catch (JSONException e) { Log.e(getClass().getSimpleName(), e.getMessage(), e); exceptionMessage = e.getClass().getSimpleName() + ": " + e.getLocalizedMessage(); } result = (ShowDataAdapter) logviewFragment.getListAdapter(); if (result == null) { result = new ShowDataAdapter(activity, o, watchList); } else { result.updateElements(o, watchList); } if (exceptionMessage != null) { Toast.makeText(activity, exceptionMessage, Toast.LENGTH_LONG).show(); } activity.setTitle(result.channel); activity.updateDateText(DateUtil.getDateString(result.date == null ? new Date() : result.date)); ListView listView = null; int oldposition; try { listView = logviewFragment.getListView(); oldposition = listView.getFirstVisiblePosition(); } catch (IllegalStateException e) { oldposition = -1; } logviewFragment.setListAdapter(result); // Now do some scrolling String anchor = activity.getAnchor(); activity.setAnchor(null); if (anchor != null) { List<ListElement> listElements = result.getListElements(); int position = 0; for (ListElement listElement : listElements) { if (listElement instanceof Comment) { Comment c = (Comment) listElement; if (c.anchor.compareTo(anchor) >= 0) { result.anchor = c; break; } } position++; } if (listView != null) { //listView.smoothScrollToPosition(position); listView.setSelection(position); } } else { if (oldposition >= 0 && listView != null) { //listView.smoothScrollToPosition(oldposition); } } fragmentManager.beginTransaction().replace(R.id.content_frame, logviewFragment).commit(); // FIXME crashes on Android 21: activity.setSupportProgressBarIndeterminateVisibility(false); }
From source file:com.attentec.Login.java
/** * Show text that scanning the phone key failed. *//*w w w . ja va 2 s. co m*/ protected final void showFailedScan() { Toast.makeText(this, R.string.scan_fail, Toast.LENGTH_LONG).show(); }
From source file:com.guess.license.plate.Task.LoadingTaskConn.java
@Override protected void onPostExecute(ServerError result) { super.onPostExecute(result); loadingDialog.dismiss();//w w w . j a v a2s. co m if (result != null && !result.equals(ServerError.NO_ERROR)) { Toast toast = Toast.makeText(context, Language.GetServerErrorLanguage(result, context), Toast.LENGTH_LONG); toast.setGravity(Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL, 0, 0); toast.show(); } new CountDownTimer(TIMER, 1000) { public void onTick(long millisUntilFinished) { // Do nothing } public void onFinish() { activity.onTaskFinished(); } }.start(); }
From source file:com.piggate.samples.PiggateLoginApplication.Activity_SingUp.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); _piggate = new Piggate(this, null); //Initialize the Piggate object setContentView(R.layout.activity_register); //EditTexts for user email and password editEmail = (EditText) findViewById(R.id.editText1); editPass = (EditText) findViewById(R.id.editText2); final ImageButton return_button = (ImageButton) findViewById(R.id.return1); Button register = (Button) findViewById(R.id.buttonregister2); //Handles the top left back button of the activity return_button.setOnClickListener(new View.OnClickListener() { @Override// www.ja va 2 s .co m public void onClick(View v) { onBackPressed(); } }); //OnClick listener for the login button //Handles the register request to the server with the email and password fields //and the login request if the fields are correct register.setOnClickListener(new View.OnClickListener() { @Override synchronized public void onClick(View v) { if (!handledClick) { handledClick = true; String email = editEmail.getText().toString(); String pass = editPass.getText().toString(); //If the internet connection is working if (checkInternetConnection() == true) { RequestParams params = new RequestParams(); params.put("email", email); params.put("password", pass); //Request of the Piggate object. Handles the register into the application // and the login with the user email and password _piggate.RequestNewUser(params).setListenerRequest(new Piggate.PiggateCallBack() { //Method onComplete for JSONObject //When the request is correct start Activity_Logged activity @Override public void onComplete(int statusCode, Header[] headers, String msg, JSONObject data) { Toast.makeText(getApplicationContext(), msg, Toast.LENGTH_LONG).show(); Intent slideactivity = new Intent(Activity_SingUp.this, Activity_Logged.class); Bundle bndlanimation = ActivityOptions .makeCustomAnimation(getApplicationContext(), R.anim.flip1, R.anim.flip2) .toBundle(); startActivity(slideactivity, bndlanimation); } //Method onError for JSONObject //If there's an error with the request displays the error message to the user @Override public void onError(int statusCode, Header[] headers, String msg, JSONObject data) { Toast.makeText(getApplicationContext(), msg, Toast.LENGTH_LONG).show(); } //Method onComplete for JSONArray @Override public void onComplete(int statusCode, Header[] headers, String msg, JSONArray data) { //Unused } //Method onError for JSONArray @Override public void onError(int statusCode, Header[] headers, String msg, JSONArray data) { //Unused } }).exec(); } else { //If the internet connection is not working Toast.makeText(getApplicationContext(), "Network is not working", Toast.LENGTH_LONG).show(); } } } }); }
From source file:com.tapchatapp.android.app.ui.TapchatServiceStatusBar.java
@Subscribe public void onServiceError(ServiceErrorEvent event) { final Exception error = event.getError(); if (error instanceof HttpResponseException) { HttpResponseException httpError = (HttpResponseException) error; if (httpError.getStatusCode() == 403) { mService.logout();/* w w w . j a v a2 s . c o m*/ Toast.makeText(mActivity, R.string.unauthorized, Toast.LENGTH_LONG).show(); mActivity.startActivity(new Intent(mActivity, WelcomeActivity.class)); mActivity.finish(); return; } } new AlertDialog.Builder(mActivity).setTitle(R.string.error).setMessage(error.toString()) .setPositiveButton(android.R.string.ok, null).show(); }
From source file:com.jakebasile.android.linkshrink.ShortenUrl.java
private void shorten(SharedPreferences prefs, String longUrl) { // guard against bad input. if (longUrl == null || longUrl.length() == 0) { showBadInputToast();/*from w w w. ja v a 2s . c o m*/ return; } final String service = prefs.getString("service", GOOGL); String host = Uri.parse(longUrl).getHost(); if (host == null || host.length() == 0) { showBadInputToast(); return; } if (host.endsWith(service)) { onUrlAlreadyShortened(longUrl); finish(); return; } _handler = new Handler() { @Override public void handleMessage(Message msg) { switch (msg.what) { case 0: { if (_shortUrl != null) { onUrlShortened(_shortUrl); } else { String display = String.format(getResources().getString(R.string.unknownerror), service); Toast.makeText(getApplicationContext(), display, Toast.LENGTH_LONG).show(); } break; } case 1: { String display = String.format(getResources().getString(R.string.commerror), service); Toast.makeText(getApplicationContext(), display, Toast.LENGTH_LONG).show(); break; } case 2: { String display = String.format(getResources().getString(R.string.urlerror), service); Toast.makeText(getApplicationContext(), display, Toast.LENGTH_LONG).show(); break; } } finish(); return; } }; if (service.equalsIgnoreCase(ISGD)) { shortenWithIsgd(longUrl); } else if (service.equalsIgnoreCase(BITLY)) { shortenWithBitly(longUrl, prefs); } else if (service.equalsIgnoreCase(GOOGL)) { shortenWithGoogl(longUrl); } else { Toast.makeText(getApplicationContext(), R.string.badconfig, Toast.LENGTH_LONG).show(); finish(); } }
From source file:com.cssn.samplesdk.ShowDataActivity.java
private void loadResult() { if (DataContext.getInstance().getCardType() == CardType.DRIVERS_LICENSE) { if (DataContext.getInstance().getProcessedLicenseCard() != null) { setResultFields();//from www. ja va2 s . com } else { Toast.makeText(ShowDataActivity.this, Constants.ERROR_RESULT, Toast.LENGTH_LONG).show(); } } else if (DataContext.getInstance().getCardType() == CardType.DL_DUPLEX) { if (DataContext.getInstance().getProcessedLicenseCardDuplex() != null) { setResultFields(); } else { Toast.makeText(ShowDataActivity.this, Constants.ERROR_RESULT, Toast.LENGTH_LONG).show(); } } else if (DataContext.getInstance().getCardType() == CardType.MEDICAL_INSURANCE) { if (DataContext.getInstance().getProcessedMedicalCard() != null) { setResultFields(); } else { Toast.makeText(ShowDataActivity.this, Constants.ERROR_RESULT, Toast.LENGTH_LONG).show(); } } else if (DataContext.getInstance().getCardType() == CardType.PASSPORT) { if (DataContext.getInstance().getProcessedPassportCard() != null) { setResultFields(); } else { Toast.makeText(ShowDataActivity.this, Constants.ERROR_RESULT, Toast.LENGTH_LONG).show(); } } else { Toast.makeText(ShowDataActivity.this, Constants.ERROR_RESULT, Toast.LENGTH_LONG).show(); } }
From source file:com.appfirst.activities.details.AFServerDetail.java
@Override public boolean onOptionsItemSelected(MenuItem item) { String fieldName = item.toString(); if (data == null) { Toast.makeText(this, "Data is not available, please wait.", Toast.LENGTH_LONG); return super.onOptionsItemSelected(item); }/*from ww w .j a va 2 s .c o m*/ Log.i(TAG, String.format("Field change to: %s", fieldName)); if (fieldName == "Disk usage") { showDialog(DISK_DIALOG); } else if (fieldName == "CPU cores") { showDialog(CPU_DIALOG); } else if (fieldName == "Disk busy") { showDialog(DISK_BUSY_DIALOG); } return super.onOptionsItemSelected(item); }
From source file:com.toppatch.mv.ui.activities.LoginActivity2.java
@Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE) { startLoginCheck();/* w w w. j a va 2 s . com*/ Toast.makeText(getApplicationContext(), "Test Login", Toast.LENGTH_LONG).show(); return true; } return false; }