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:sg.macbuntu.android.pushcontacts.SmsReceiver.java
@Override public void onReceive(Context context, Intent intent) { Bundle bundle = intent.getExtras();/*from ww w . java2s . c o m*/ SmsMessage[] msgs = null; String contact = ""; String sender = ""; String body = ""; String account = ""; SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); boolean pushPreference = prefs.getBoolean("cbPush", true); if (pushPreference) { if (bundle != null && accountExist(context)) { Object[] pdus = (Object[]) bundle.get("pdus"); msgs = new SmsMessage[pdus.length]; msgs[0] = SmsMessage.createFromPdu((byte[]) pdus[0]); contact = msgs[0].getOriginatingAddress(); body = msgs[0].getMessageBody().toString(); account = getAccount(context); sender = getNameFromPhoneNumber(context, contact); Toast.makeText(context, R.string.toast_push, Toast.LENGTH_LONG).show(); postData(account, contact, body, sender); } } }
From source file:com.easyauth.EasyAuth.MainActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); GCMRegistrar.checkDevice(this); if (BuildConfig.DEBUG) { GCMRegistrar.checkManifest(this); }/* ww w .j av a2 s. com*/ final String regId = GCMRegistrar.getRegistrationId(this); if (regId.length() == 0) { GCMRegistrar.register(this, SENDER_ID); } else { Log.d(getClass().getSimpleName(), "Existing registration: " + regId); if (BuildConfig.DEBUG) Toast.makeText(this, regId, Toast.LENGTH_LONG).show(); } registerView = (LinearLayout) findViewById(R.id.registerView); tokenView = (RelativeLayout) findViewById(R.id.tokenView); usernameEditText = (EditText) findViewById(R.id.usernameTextView); totpTokenTextView = (TextView) findViewById(R.id.totpTokenTextView); totpTokenTimerView = (TextView) findViewById(R.id.totpTokenTimerView); registerButton = (Button) findViewById(R.id.registerButton); SharedPreferences prefs = getSharedPreferences(Constants.EASYAUTH_PREFERENCES_KEY, Context.MODE_PRIVATE); String username = prefs.getString(Constants.EASYAUTH_USERNAME_KEY, ""); final String secret = prefs.getString(Constants.EASYAUTH_TOTP_SECRET_KEY, ""); // Show the token and the register new button if a username is already registered in the device. // Else show the username and register button. if (!username.isEmpty() && !secret.isEmpty()) { registerView.setVisibility(View.GONE); tokenView.setVisibility(View.VISIBLE); Thread t = new Thread() { @Override public void run() { try { while (!isInterrupted()) { runOnUiThread(new Runnable() { @Override public void run() { String totpToken = getTotpToken(secret); totpTokenTextView.setText(totpToken); long timeRemaining = getTotpTimeRemaining(); totpTokenTimerView.setText(String.valueOf(timeRemaining)); } }); Thread.sleep(1000); } } catch (InterruptedException e) { } } }; t.start(); } else { registerView.setVisibility(View.VISIBLE); tokenView.setVisibility(View.GONE); } }
From source file:com.liferay.tasks.activity.AddTaskActivity.java
protected void addTask(String task) { Session session = PrefsUtil.getSession(); AddTaskCallback callback = new AddTaskCallback(this); session.setCallback(callback);//from www . j a v a 2s . co m TasksentryService service = new TasksentryService(session); try { JSONObject serviceContext = new JSONObject(); serviceContext.put("scopeGroupId", PrefsUtil.getGroupId()); JSONObjectWrapper wrapper = new JSONObjectWrapper(serviceContext); service.addTasksEntry(task, 0, 0, 0, 0, 0, 0, 0, false, wrapper); } catch (Exception e) { String message = "Couldn't add task: " + e.getMessage(); Toast.makeText(this, message, Toast.LENGTH_LONG).show(); } }
From source file:com.mobshep.shepherdlogin.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); referenceXML();//from w w w . java 2 s. co m logPrefSession(); logProviderSession(); if (checkSession()) { Intent intent = new Intent(MainActivity.this, LoggedIn.class); startActivity(intent); } //TODO //Remove this and replace with AsyncTask StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build(); StrictMode.setThreadPolicy(policy); //end remove SharedPreferences SP = PreferenceManager.getDefaultSharedPreferences(getBaseContext()); String address = SP.getString("server_preference", "NA"); Toast addressTest = Toast.makeText(MainActivity.this, "Server Address : " + address, Toast.LENGTH_LONG); addressTest.show(); }
From source file:com.microsoft.graph.connect.ConnectActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Bundle extras = getIntent().getExtras(); if (extras != null) { AuthenticationManager.getInstance().processAuthorizationCode(getIntent(), this); }//w w w . j a v a 2 s.c o m setContentView(R.layout.activity_connect); setTitle(R.string.app_name); // set up our views mConnectButton = (Button) findViewById(R.id.connectButton); mConnectProgressBar = (ProgressBar) findViewById(R.id.connectProgressBar); mTitleTextView = (TextView) findViewById(R.id.titleTextView); mDescriptionTextView = (TextView) findViewById(R.id.descriptionTextView); // add click listener mConnectButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { showConnectingInProgressUI(); //check that client id and redirect have been configured if (!hasAzureConfiguration()) { Toast.makeText(ConnectActivity.this, getString(R.string.warning_client_id_redirect_uri_incorrect), Toast.LENGTH_LONG).show(); resetUIForConnect(); return; } connect(); } }); // Initialize AuthenticationManager AuthenticationManager.getInstance().setContextActivity(this); }
From source file:it.uniroma2.foundme.studente.DelAccountActivity.java
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_del_account); etMail = (EditText) findViewById(R.id.etMail); etPsw = (EditText) findViewById(R.id.etPsw); btConfirm = (Button) findViewById(R.id.btConfirm); btConfirm.setOnClickListener(new View.OnClickListener() { @Override//from w ww . j a v a2 s . c o m public void onClick(View arg0) { mail = etMail.getText().toString(); pass = etPsw.getText().toString(); if (!checkData(mail, pass)) { Toast.makeText(getApplicationContext(), Variables_it.FILL_FIELD, Toast.LENGTH_LONG).show(); } else { pass = computeSHAHash.sha1(pass); try { manageCourse(mail, pass); } catch (ExecutionException e) { e.printStackTrace(); } catch (InterruptedException e) { e.printStackTrace(); } } } }); }
From source file:org.starfishrespect.myconsumption.android.ui.CreateAccountActivity.java
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_create_account); editTextUsername = (EditText) findViewById(R.id.editTextUsername); editTextPassword = (EditText) findViewById(R.id.editTextPassword); editTextPassword2 = (EditText) findViewById(R.id.editTextPassword2); buttonCreateAccount = (Button) findViewById(R.id.buttonCreateAccount); buttonCreateAccount.setOnClickListener(new View.OnClickListener() { @Override/* w w w . ja v a 2s .c o m*/ public void onClick(View v) { if (!MiscFunctions.isOnline(CreateAccountActivity.this)) { MiscFunctions.makeOfflineDialog(CreateAccountActivity.this).show(); return; } if (editTextUsername.getText().toString().equals("") || editTextPassword.getText().toString().equals("") || editTextPassword2.getText().toString().equals("")) { Toast.makeText(CreateAccountActivity.this, getString(R.string.dialog_message_error_must_fill_all_fields), Toast.LENGTH_LONG) .show(); return; } if (!editTextPassword.getText().toString().equals(editTextPassword2.getText().toString())) { Toast.makeText(CreateAccountActivity.this, R.string.dialog_message_error_password_must_match, Toast.LENGTH_LONG).show(); return; } new AsyncTask<Void, Void, Integer>() { @Override protected Integer doInBackground(Void... params) { return createAccount(); } @Override protected void onPostExecute(Integer result) { if (result == 0) { setResult(RESULT_OK); finish(); } else { AlertDialog.Builder builder = new AlertDialog.Builder(CreateAccountActivity.this); builder.setTitle(R.string.dialog_title_error); builder.setPositiveButton(R.string.button_ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); switch (result) { case SimpleResponseDTO.STATUS_ALREADY_EXISTS: builder.setMessage(R.string.dialog_message_error_user_already_exists); break; default: builder.setMessage("An error has occurred. You might want to " + "check your internet connection or contact the application provider."); break; } builder.show(); } } }.execute(); } }); }
From source file:com.wms.ezyoukuuploader.sdk.activity.GetRefreshTokenActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.youku_login); progressBarLoading = (ProgressBar) findViewById(R.id.progressBarLoading); webviewYouku = (WebView) findViewById(R.id.webViewYouku); webviewYouku.setWebViewClient(new WebViewClient() { @Override/* ww w .j av a 2s .c o m*/ public boolean shouldOverrideUrlLoading(WebView view, String url) { String[] str = url.split("=")[1].split("&"); authorizationCode = str[0]; String refreshToken = getRefreshToken(); if (refreshToken != null) { Toast.makeText(getApplicationContext(), getString(R.string.loginSuccessful), Toast.LENGTH_LONG) .show(); finish(); } return false; } }); webviewYouku.setWebChromeClient(new WebChromeClient() { @Override public void onProgressChanged(WebView view, int progress) { if (progress == 100) { progressBarLoading.setVisibility(View.INVISIBLE); } } }); String url = YoukuConstants.YOUKU_AUTHORIZE_URL + "?" + YoukuConstants.PARAM_CLIENT_ID + "=" + getString(R.string.YOUKU_APP_CLIENT_ID) + "&" + YoukuConstants.PARAM_RESPONSE_TYPE + "=" + YoukuConstants.PARAM_AUTHORIZATION_CODE + "&" + YoukuConstants.PARAM_REDIRECT_URI + "=" + getString(R.string.YOUKU_APP_REDIRECT_URI); webviewYouku.loadUrl(url); Toast.makeText(this, getString(R.string.pleaseLogin), Toast.LENGTH_LONG).show(); }
From source file:com.granita.icloudcalsync.ui.setup.QueryServerDialogFragment.java
@Override public void onLoadFinished(Loader<ServerInfo> loader, ServerInfo serverInfo) { if (serverInfo.getErrorMessage() != null) Toast.makeText(getActivity(), serverInfo.getErrorMessage(), Toast.LENGTH_LONG).show(); else {/*from www. j a v a2s . c o m*/ ((AddAccountActivity) getActivity()).serverInfo = serverInfo; Fragment nextFragment; if (!serverInfo.getTodoLists().isEmpty() && !LocalTaskList.isAvailable(getActivity())) nextFragment = new InstallAppsFragment(); else nextFragment = new SelectCollectionsFragment(); getFragmentManager().beginTransaction().replace(R.id.right_pane, nextFragment).addToBackStack(null) .commitAllowingStateLoss(); } getDialog().dismiss(); }
From source file:edu.cwru.apo.Directory.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.directory);/*from w w w .jav a 2 s . c om*/ userTable = (TableLayout) findViewById(R.id.userTable); phoneDB = new PhoneOpenHelper(this); database = phoneDB.getWritableDatabase(); Cursor results = database.query("phoneDB", new String[] { "first", "last", "_id" }, null, null, null, null, "first"); if (results.getCount() < 1) { API api = new API(this); if (!api.callMethod(Methods.phone, this, (String[]) null)) { Toast msg = Toast.makeText(this, "Error: Calling phone", Toast.LENGTH_LONG); msg.show(); } } else loadTable(); }