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.mobshep.shepherdlogin.LoggedIn.java
public void submitClicked(View v) { String apiKey = "thisIsTheAPIKey"; ArrayList<NameValuePair> postParameters = new ArrayList<NameValuePair>(); postParameters.add(new BasicNameValuePair("mobileKey", apiKey)); try {/*from w ww .java 2s.c o m*/ SharedPreferences SP = PreferenceManager.getDefaultSharedPreferences(getBaseContext()); String address = SP.getString("server_preference", "NA"); String res = CustomHttpClient.executeHttpPost(address + "/vulMobileAPI", postParameters); JSONObject jObject = new JSONObject(res.toString()); String response = jObject.getString("LEVELKEY"); response = response.replaceAll("\\s+", ""); Toast responseError = Toast.makeText(LoggedIn.this, response.toString(), Toast.LENGTH_SHORT); responseError.show(); if (res != null) { storedPref = getSharedPreferences("Sessions", MODE_PRIVATE); toEdit = storedPref.edit(); toEdit.putString("LEVELKEY", response); toEdit.commit(); } else { Toast.makeText(getBaseContext(), "Invalid API Key!", Toast.LENGTH_SHORT).show(); } } catch (Exception e) { Toast responseError = Toast.makeText(LoggedIn.this, e.toString(), Toast.LENGTH_LONG); responseError.show(); } }
From source file:com.example.android.camera2basic.CameraActivity.java
private boolean checkPlayServices(Activity activity) { int resultCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this); if (resultCode != ConnectionResult.SUCCESS) { if (GooglePlayServicesUtil.isUserRecoverableError(resultCode)) { GooglePlayServicesUtil.getErrorDialog(resultCode, activity, 9000).show(); } else {//w w w . j av a 2 s . c o m Toast.makeText(getApplicationContext(), "This device is not supported.", Toast.LENGTH_LONG).show(); } return false; } return true; }
From source file:com.grarak.romswitcher.Utils.Utils.java
public static void toast(Context context, String text, int time) { if (time == 1) { Toast.makeText(context, text, Toast.LENGTH_LONG).show(); } else {/*from w w w. j av a 2 s. co m*/ Toast.makeText(context, text, Toast.LENGTH_SHORT).show(); } }
From source file:com.networking.MyApplication.java
private void setVariableFromEnv() { try {//from w w w . ja va2s .c o m File sdcard = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS); File file = new File(sdcard, "env.txt"); if (!file.exists()) { Log.d(TAG, "Env file is not present in download folder"); Toast.makeText(getApplicationContext(), "Env file is not present in download folder", Toast.LENGTH_LONG).show(); return; } StringBuilder text = new StringBuilder(); try { BufferedReader br = new BufferedReader(new FileReader(file)); String line; while ((line = br.readLine()) != null) { text.append(line); text.append('\n'); } br.close(); try { JSONObject jsonObject = new JSONObject(text.toString()); ApiEndPoint.BASE_URL = jsonObject.getString("baseUrl"); ApiEndPoint.UPLOAD_IMAGE_URL = jsonObject.getString("uploadImageUrl"); } catch (JSONException e) { Log.d(TAG, "Check env file json in download folder"); Toast.makeText(getApplicationContext(), "Check env file json in download folder", Toast.LENGTH_LONG).show(); } } catch (IOException e) { Log.d(TAG, "Check env file in download folder"); Toast.makeText(getApplicationContext(), "Check env file in download folder", Toast.LENGTH_LONG) .show(); } } catch (Exception e) { Log.d(TAG, "Exception in loading settingVariableFromEnv"); Toast.makeText(getApplicationContext(), "Exception in loading settingVariableFromEnv", Toast.LENGTH_LONG).show(); } }
From source file:com.dfws.idea.ClosePcActivity.java
public void doResult(int action) { switch (action) { case RIGHT:/* www. j a v a 2 s. c o m*/ Toast.makeText(this, "?", Toast.LENGTH_LONG).show(); break; case LEFT: //pc Intent intent = new Intent(); intent.setClass(this, ListPcActivity.class); startActivity(intent); break; } }
From source file:eu.codeplumbers.cosi.activities.NoteDetailsActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_note_details); body = (RichEditor) findViewById(R.id.body); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar);/* w ww . j a v a2s .c o m*/ getSupportActionBar().setHomeButtonEnabled(true); getSupportActionBar().setDisplayShowHomeEnabled(true); body.setPlaceholder("Insert text here..."); body.setEnabled(true); setupEditor(); long noteId = getIntent().getLongExtra("noteId", -1); if (noteId != -1) { note = Note.load(Note.class, noteId); if (note != null) { body.setHtml(note.getContent()); getSupportActionBar().setSubtitle("Note details"); } else { Toast.makeText(this, "Something went terribly wrong... Can't load note information", Toast.LENGTH_LONG).show(); } } else { getSupportActionBar().setSubtitle("New note"); } }
From source file:com.example.run_tracker.LoginFragment.java
@Override public void onClick(View v) { // TODO Auto-generated method stub if (isEmpty(mUsername) || isEmpty(mPassword)) { Toast.makeText(getActivity(), "Fill all fields", Toast.LENGTH_LONG).show(); } else {/*from w w w . j a va2 s . co m*/ // request here Make_login_request(); } }
From source file:com.michael.feng.utils.YahooWeather4a.YahooWeatherUtils.java
private String getWeatherString(Context context, String woeidNumber) { String qResult = ""; String queryString = "http://weather.yahooapis.com/forecastrss?w=" + woeidNumber; HttpClient httpClient = new DefaultHttpClient(); HttpGet httpGet = new HttpGet(queryString); try {/* ww w . jav a 2 s . c o m*/ HttpEntity httpEntity = httpClient.execute(httpGet).getEntity(); if (httpEntity != null) { InputStream inputStream = httpEntity.getContent(); Reader in = new InputStreamReader(inputStream); BufferedReader bufferedreader = new BufferedReader(in); StringBuilder stringBuilder = new StringBuilder(); String stringReadLine = null; while ((stringReadLine = bufferedreader.readLine()) != null) { stringBuilder.append(stringReadLine + "\n"); } qResult = stringBuilder.toString(); } } catch (ClientProtocolException e) { e.printStackTrace(); Toast.makeText(context, e.toString(), Toast.LENGTH_LONG).show(); } catch (IOException e) { e.printStackTrace(); Toast.makeText(context, e.toString(), Toast.LENGTH_LONG).show(); } return qResult; }
From source file:com.chexiaoya.gaodemapdemo.SpeechSearchActivity.java
private void showToast(String message) { Toast.makeText(this, message, Toast.LENGTH_LONG).show(); }
From source file:com.browsertophone.ShareLink.java
public boolean handleMessage(Message msg) { Toast.makeText(mContext, msg.getData().getString(TOAST), Toast.LENGTH_LONG).show(); return true; }