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.chess.genesis.dialog.GameDetailsDialog.java
private void saveToFile() { try {/*from w ww. j a v a 2s .co m*/ final String gamename = isOnline ? gamedata.getString("white") + " Vs. " + gamedata.getString("black") : gamedata.getString("name"); final String filename = gamename + ".txt"; final String str = GameParser.parse(gamedata).toString(); FileUtils.writeFile(filename, str); Toast.makeText(getContext(), "File Written To:\n" + filename, Toast.LENGTH_LONG).show(); } catch (final JSONException e) { Toast.makeText(getContext(), "Game Data Corrupt", Toast.LENGTH_LONG).show(); } catch (final FileNotFoundException e) { Toast.makeText(getContext(), "Can Not Open File", Toast.LENGTH_LONG).show(); } catch (final IOException e) { Toast.makeText(getContext(), "I/O Error", Toast.LENGTH_LONG).show(); } }
From source file:de.teambluebaer.patientix.activities.EndActivity.java
/** * This method creates the layout of the Activity, sets the fullscreenmode and * removes the titlebar. In here also the Views are referenced. * * @param savedInstanceState default parameter *///from w w w . ja v a 2 s .c o m @Override protected void onCreate(Bundle savedInstanceState) { //removes the titlebar in fullscreenmode requestWindowFeature(Window.FEATURE_NO_TITLE); super.onCreate(savedInstanceState); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); getWindow().addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD); setContentView(R.layout.activity_end); textViewEndtext = (TextView) findViewById(R.id.textViewEnd); Constants.TORESTART = false; Constants.LISTOFACTIVITIES.add(this); Constants.CURRENTACTIVITY = this; PrefUtils.setKioskModeActive(true, this); if (isFormula()) { String xml = Constants.GLOBALMETAANDFORM.toXMLString(); //set um parameterMap for RestPost to send formula data parameterMap.add(new BasicNameValuePair("formula", xml)); parameterMap .add(new BasicNameValuePair("patientID", Constants.GLOBALMETAANDFORM.getMeta().getPatientID())); Log.d("Response", Constants.GLOBALMETAANDFORM.getMeta().getPatientID()); Log.d("Response", xml); new SendFormula().execute(); } else { Toast.makeText(EndActivity.this, "Kein Formular vorhanden!", Toast.LENGTH_LONG).show(); textViewEndtext.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { Intent intent = new Intent(EndActivity.this, LoginActivity.class); startActivity(intent); PrefUtils.setKioskModeActive(false, EndActivity.this); finish(); return true; } }); } }
From source file:io.cloudmatch.demo.pinchanddrag.PADServerEventListener.java
@Override public void onMatchResponse(final MatchResponse response) { Log.d(TAG, "onMatchResponse: " + response); switch (response.mOutcome) { case ok://from w ww . jav a 2 s . c om mMatchedListener.onMatched(response.mGroupId); break; case fail: // is there a reason? switch (response.mReason) { case timeout: case uncertain: Toast.makeText(mActivity, "Match request timed out.", Toast.LENGTH_LONG).show(); break; case error: case unknown: default: Toast.makeText(mActivity, "Match request failed.", Toast.LENGTH_LONG).show(); break; } default: break; } }
From source file:fr.cph.stock.android.StockTrackerApp.java
/** * This function toast a toast "updated" message to the screen *///from w w w . ja v a2s . co m public void toast() { Context context = getApplicationContext(); CharSequence text = "Updated !"; int duration = Toast.LENGTH_LONG; Toast toast = Toast.makeText(context, text, duration); toast.show(); }
From source file:com.michael.feng.utils.YahooWeather4a.WOEIDUtils.java
private String queryYahooWeather(Context context, String queryString) { Log.d("tag", "QueryYahooWeather"); String qResult = ""; // queryString = Uri.encode(queryString); HttpClient httpClient = new DefaultHttpClient(); // return Uri.encode(queryString); HttpGet httpGet = new HttpGet(queryString); try {// w w w .j a va 2 s . com 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:me.biubiubiu.one.util.HttpHandler.java
License:asdf
public void post(String endPoint, RequestParams params) { AsyncHttpClient client = new AsyncHttpClient(); String url = getUrl(endPoint); if (DEBUG) {//from w w w. jav a 2 s . c o m final String fullUrl = AsyncHttpClient.getUrlWithQueryString(url, params); Log.d(TAG, "++++++++++++++++++++full url:" + fullUrl); } params.put("token", USER_TOKEN); showLoading(); client.post(url, params, new MyAsyncHttpResponseHandler(new ResponseHandler() { public void onSuccess(String result) { Toast.makeText(mContext, "???", Toast.LENGTH_LONG).show(); } }, 0)); }
From source file:edu.rit.csh.androidwebnews.PostSwipeableActivity.java
public void markStarred(View view) { int threadId = Integer.parseInt((String) view.getTag()); PostThread thread = findThisThread(rootThread, threadId); thread.starred();/* w w w .j a v a 2 s . c o m*/ ImageButton ib = (ImageButton) view; if (thread.getStarred()) { if (PreferenceManager.getDefaultSharedPreferences(this).getString("layout_pick", "default") .equals("dark")) { ib.setImageResource(R.drawable.webnews_star_dark); } else { ib.setImageResource(R.drawable.webnews_star_light); } Toast.makeText(getApplicationContext(), "Post starred", Toast.LENGTH_LONG).show(); } else { if (PreferenceManager.getDefaultSharedPreferences(this).getString("layout_pick", "default") .equals("dark")) { ib.setImageResource(R.drawable.webnews_unstar_dark); } else { ib.setImageResource(R.drawable.webnews_unstar_light); } Toast.makeText(getApplicationContext(), "Post un-starred", Toast.LENGTH_LONG).show(); } hc.markStarred(newsgroupName, threadId); }
From source file:com.tinyhydra.botd.BotdServerOperations.java
public static void CastVote(final Activity activity, final Handler handler, final String email, final String shopId, final String shopRef) { new Thread() { @Override/*from w w w . ja va 2 s. c o m*/ public void run() { try { URI uri = new URI(activity.getResources().getString(R.string.server_url)); HttpClient client = new DefaultHttpClient(); HttpPut put = new HttpPut(uri); JSONObject voteObj = new JSONObject(); // user's phone-account-email-address is used to prevent multiple votes // the server will validate. 'shopId' is a consistent id for a specific location // but can't be used to get more data. 'shopRef' is an id that changes based on // some criteria that google places has imposed, but will let us grab data later on // and various Ref codes with the same id will always resolve to the same location. voteObj.put(JSONvalues.email.toString(), email); voteObj.put(JSONvalues.shopId.toString(), shopId); voteObj.put(JSONvalues.shopRef.toString(), shopRef); put.setEntity(new StringEntity(voteObj.toString())); HttpResponse response = client.execute(put); InputStream is = response.getEntity().getContent(); int ch; StringBuffer sb = new StringBuffer(); while ((ch = is.read()) != -1) { sb.append((char) ch); } if (sb.toString().equals("0")) { Utils.PostToastMessageToHandler(handler, "Vote cast!", Toast.LENGTH_SHORT); // Set a local flag to prevent duplicate voting SharedPreferences settings = activity.getSharedPreferences(Const.GenPrefs, 0); SharedPreferences.Editor editor = settings.edit(); editor.putLong(Const.LastVoteDate, Utils.GetDate()); editor.commit(); } else { // The user shouldn't see this. The above SharedPreferences code will be evaluated // when the user hits the Vote button. If the user gets sneaky and deletes local data though, // the server will catch the duplicate vote based on the user's email address and send back a '1'. Utils.PostToastMessageToHandler(handler, "Vote refused. You've probably already voted today.", Toast.LENGTH_LONG); } GetTopTen(activity, handler, true); // Catch blocks. Return a generic error if anything goes wrong. //TODO: implement some better/more appropriate error handling. } catch (URISyntaxException usex) { usex.printStackTrace(); Utils.PostToastMessageToHandler(handler, "There was a problem submitting your vote. Poor signal? Please try again.", Toast.LENGTH_LONG); } catch (UnsupportedEncodingException ueex) { ueex.printStackTrace(); Utils.PostToastMessageToHandler(handler, "There was a problem submitting your vote. Poor signal? Please try again.", Toast.LENGTH_LONG); } catch (ClientProtocolException cpex) { cpex.printStackTrace(); Utils.PostToastMessageToHandler(handler, "There was a problem submitting your vote. Poor signal? Please try again.", Toast.LENGTH_LONG); } catch (IOException ioex) { ioex.printStackTrace(); Utils.PostToastMessageToHandler(handler, "There was a problem submitting your vote. Poor signal? Please try again.", Toast.LENGTH_LONG); } catch (JSONException jex) { jex.printStackTrace(); Utils.PostToastMessageToHandler(handler, "There was a problem submitting your vote. Poor signal? Please try again.", Toast.LENGTH_LONG); } } }.start(); }
From source file:heartware.com.heartware_master.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mDBAdapter = new DBAdapter(this); // adding invisible worker fragments: https://developer.android.com/guide/components/fragments.html mJboneHelper = new JawboneUpHelper(); FragmentManager fm = getFragmentManager(); fm.beginTransaction().add(mJboneHelper, JawboneUpHelper.TAG).commit(); mLoginDialog = new LoginDialogFragment(); mLoginDialog.show(getFragmentManager(), TAG); setupActionTabs();/* ww w .j a v a 2s . c o m*/ //get user calendar availability avail = checkEvents(); Toast.makeText(this, "Available: " + avail, Toast.LENGTH_LONG).show(); //send user availability to server //CalToServer calToServer = (CalToServer) new CalToServer().execute(new String(avail)); }
From source file:com.miz.functions.YoutubeTrailerSearch.java
@Override protected void onPostExecute(String result) { if (result != null) { if (YouTubeApiServiceUtil.isYouTubeApiServiceAvailable(mActivity) .equals(YouTubeInitializationResult.SUCCESS)) { Intent intent = YouTubeStandalonePlayer.createVideoIntent(mActivity, MizLib.getYouTubeApiKey(mActivity), MizLib.getYouTubeId(result), 0, false, true); mActivity.startActivity(intent); } else {//w w w. j a v a 2 s. c om Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(Uri.parse(result)); } } else { Toast.makeText(mActivity, mActivity.getString(R.string.errorSomethingWentWrong), Toast.LENGTH_LONG) .show(); } }