List of usage examples for android.widget Toast LENGTH_SHORT
int LENGTH_SHORT
To view the source code for android.widget Toast LENGTH_SHORT.
Click Source Link
From source file:com.dedipower.portal.android.AddTicketReply.java
public void onCreate(Bundle savedInstanceState) { API.SessionID = getIntent().getStringExtra("sessionid"); ticketid = getIntent().getStringExtra("ticketid"); dialog = new ProgressDialog(this); dialog.setMessage("Loading..."); super.onCreate(savedInstanceState); setContentView(R.layout.addticketreply); final Handler handler = new Handler() { public void handleMessage(Message msg) { dialog.dismiss();//from w ww .ja v a 2 s .c o m if (TicketID == 0) { Toast.makeText(AddTicketReply.this, "Ticket Reply Failed. Please try again later or email request@dedipower.com", Toast.LENGTH_LONG).show(); } else { Toast.makeText(AddTicketReply.this, "Reply added! Returning to main screen...", Toast.LENGTH_SHORT).show(); finish(); } } }; final Thread submitReply = new Thread() { public void run() { try { TicketID = API.ReplyToTicket(ticketid, Message); } catch (JSONException e) { TicketID = 0; } handler.sendEmptyMessage(0); } }; Button AddReplyButton = (Button) findViewById(R.id.AddReplyButton); AddReplyButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { dialog.show(); EditText MessageET = (EditText) findViewById(R.id.Message); Message = MessageET.getText().toString(); submitReply.start(); } }); }
From source file:com.ddpclient.spiovesan.ddpclient.LogService.java
@Override public int onStartCommand(Intent intent, int flags, int startId) { super.onStartCommand(intent, flags, startId); // Get the location manager locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); // Define the criteria how to select the locatioin provider -> use // default//from w ww. ja va 2 s . c o m Criteria criteria = new Criteria(); provider = locationManager.getBestProvider(criteria, false); location = locationManager.getLastKnownLocation(provider); locationManager.requestLocationUpdates(provider, 400, 1, this); //Announcement about starting Toast.makeText(this, "Starting the Log Service: " + provider, Toast.LENGTH_SHORT).show(); //Start a Background thread isRunning = true; Thread backgroundThread = new Thread(new BackgroundThread()); backgroundThread.start(); // We want this service to continue running until it is explicitly // stopped, so return sticky. return START_STICKY; }
From source file:net.networksaremadeofstring.pulsant.portal.AddTicketReply.java
public void onCreate(Bundle savedInstanceState) { API.SessionID = getIntent().getStringExtra("sessionid"); ticketid = getIntent().getStringExtra("ticketid"); dialog = new ProgressDialog(this); dialog.setMessage("Loading..."); super.onCreate(savedInstanceState); setContentView(R.layout.addticketreply); final Handler handler = new Handler() { public void handleMessage(Message msg) { dialog.dismiss();/*from w w w.j a va2 s .co m*/ if (TicketID == 0) { Toast.makeText(AddTicketReply.this, "Ticket Reply Failed. Please try again later or email request@Pulsant.com", Toast.LENGTH_LONG).show(); } else { Toast.makeText(AddTicketReply.this, "Reply added! Returning to main screen...", Toast.LENGTH_SHORT).show(); finish(); } } }; final Thread submitReply = new Thread() { public void run() { try { TicketID = API.ReplyToTicket(ticketid, Message); } catch (JSONException e) { TicketID = 0; } handler.sendEmptyMessage(0); } }; Button AddReplyButton = (Button) findViewById(R.id.AddReplyButton); AddReplyButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { dialog.show(); EditText MessageET = (EditText) findViewById(R.id.Message); Message = MessageET.getText().toString(); submitReply.start(); } }); }
From source file:com.emorym.android_pusher.DeprecatedPusherSampleActivity.java
/** Called when the activity is first created. */ @Override// w w w . j a v a2s .c om public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mContext = this; setContentView(R.layout.main); // This Handler is going to deal with incoming messages mHandler = new Handler() { @Override public void handleMessage(Message msg) { super.handleMessage(msg); Bundle bundleData = msg.getData(); if (bundleData.getString("type").contentEquals("pusher")) { try { JSONObject message = new JSONObject(bundleData.getString("message")); Log.d("Pusher Message", message.toString()); Toast.makeText(mContext, message.toString(), Toast.LENGTH_SHORT).show(); } catch (Exception e) { e.printStackTrace(); } } } }; mPusher = new Pusher(mHandler); mPusher.connect(PUSHER_APP_KEY); // Setup some toggles to subscribe/unsubscribe from our 2 test channels final ToggleButton test1 = (ToggleButton) findViewById(R.id.toggleButton1); final ToggleButton test2 = (ToggleButton) findViewById(R.id.toggleButton2); final Button send = (Button) findViewById(R.id.send_button); test1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (test1.isChecked()) mPusher.subscribe(PUSHER_CHANNEL_1); else mPusher.unsubscribe(PUSHER_CHANNEL_1); } }); test2.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (test2.isChecked()) mPusher.subscribe(PUSHER_CHANNEL_2); else mPusher.unsubscribe(PUSHER_CHANNEL_2); } }); send.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { EditText channelName = (EditText) findViewById(R.id.channel_name); EditText eventName = (EditText) findViewById(R.id.event_name); EditText eventData = (EditText) findViewById(R.id.event_data); try { JSONObject data = new JSONObject(); data.put("data", eventData.getText().toString()); mPusher.send(eventName.getText().toString(), data, channelName.getText().toString()); } catch (Exception e) { e.printStackTrace(); } } }); }
From source file:cn.net_show.doctor.activity.AuthActivity.java
@Override protected void onCreate(Bundle arg0) { // TODO Auto-generated method stub app = (MyApplication) getApplication(); httpUtil = HttpUtil.getInstance();//from w w w . j a va2 s.c o m jUtils = JsonUtils.getInstance(); mHandler = new Handler(getMainLooper()) { @Override public void handleMessage(Message msg) { switch (msg.what) { case 1: if (pd != null & pd.isShowing()) { pd.dismiss(); } Toast.makeText(AuthActivity.this, msg.obj.toString(), Toast.LENGTH_SHORT).show(); break; case 2: break; default: break; } } }; setContentView(R.layout.activity_auth); rdgroup = (RadioGroup) findViewById(R.id.radiogroup); authImage = (ImageButton) findViewById(R.id.authImage); rdgroup.setOnCheckedChangeListener(this); type = (TextView) findViewById(R.id.tv_type); super.onCreate(arg0); }
From source file:com.krayzk9s.imgurholo.activities.ImgurLinkActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); destroyed = false;//from ww w .java 2 s . c o m if (getActionBar() != null) getActionBar().setDisplayHomeAsUpEnabled(true); Intent intent = getIntent(); String action = intent.getAction(); String type = intent.getType(); Log.d("New Intent", intent.toString()); if (Intent.ACTION_SEND.equals(action) && type != null) { if (type.startsWith("image/")) { Toast.makeText(this, R.string.toast_uploading, Toast.LENGTH_SHORT).show(); Intent serviceIntent = new Intent(this, UploadService.class); if (intent.getExtras() == null) finish(); serviceIntent.setData((Uri) intent.getExtras().get("android.intent.extra.STREAM")); startService(serviceIntent); finish(); } } else if (Intent.ACTION_SEND_MULTIPLE.equals(action)) { Log.d("sending", "sending multiple"); Toast.makeText(this, R.string.toast_uploading, Toast.LENGTH_SHORT).show(); ArrayList<Parcelable> list = intent.getParcelableArrayListExtra(Intent.EXTRA_STREAM); Intent serviceIntent = new Intent(this, UploadService.class); serviceIntent.putParcelableArrayListExtra("images", list); startService(serviceIntent); finish(); } else if (Intent.ACTION_VIEW.equals(action) && intent.getData() != null && intent.getData().toString().startsWith("http://imgur.com/a")) { String uri = intent.getData().toString(); album = uri.split("/")[4]; Log.d("album", album); Fetcher fetcher = new Fetcher(this, "/3/album/" + album, ApiCall.GET, null, apiCall, ALBUM); fetcher.execute(); } else if (Intent.ACTION_VIEW.equals(action) && intent.getData().toString().startsWith("http://imgur.com/gallery/")) { String uri = intent.getData().toString(); final String album = uri.split("/")[4]; if (album.length() == 5) { Log.d("album", album); Fetcher fetcher = new Fetcher(this, "/3/album/" + album, ApiCall.GET, null, apiCall, ALBUM); fetcher.execute(); } else if (album.length() == 7) { Log.d("image", album); Fetcher fetcher = new Fetcher(this, "/3/gallery/image/" + album, ApiCall.GET, null, apiCall, IMAGE); fetcher.execute(); } } else if (Intent.ACTION_VIEW.equals(action) && intent.getData().toString().startsWith("http://i.imgur")) { String uri = intent.getData().toString(); final String image = uri.split("/")[3].split("\\.")[0]; Log.d("image", image); Fetcher fetcher = new Fetcher(this, "/3/image/" + image, ApiCall.GET, null, apiCall, IMAGE); fetcher.execute(); } }
From source file:com.manning.androidhacks.hack016.MainActivity.java
public void bottomLeft(View v) { Toast toast = Toast.makeText(this, "Bottom Left!", Toast.LENGTH_SHORT); toast.setGravity(Gravity.BOTTOM | Gravity.LEFT, 0, 0); toast.show();//from w w w. jav a 2 s. c o m }
From source file:jp.co.brilliantservice.android.writertdtext.HomeActivity.java
@Override protected void onResume() { super.onResume(); mNfcAdapter = NfcAdapter.getDefaultAdapter(this); if (mNfcAdapter == null) { Toast.makeText(getApplicationContext(), "not found NFC feature", Toast.LENGTH_SHORT).show(); finish();/* w w w . ja va2s . c om*/ return; } if (!mNfcAdapter.isEnabled()) { Toast.makeText(getApplicationContext(), "NFC feature is not available", Toast.LENGTH_SHORT).show(); finish(); return; } PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, new Intent(this, getClass()), 0); IntentFilter[] intentFilter = new IntentFilter[] { new IntentFilter(NfcAdapter.ACTION_TECH_DISCOVERED), }; String[][] techList = new String[][] { { android.nfc.tech.NdefFormatable.class.getName() }, { android.nfc.tech.Ndef.class.getName() } }; mNfcAdapter.enableForegroundDispatch(this, pendingIntent, intentFilter, techList); }
From source file:com.mobshep.ITLS3.InsufficientTLS3.java
@Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.layout);//from w w w.j ava2s . co m referenceXML(); if (isNetworkAvailable() == false) { Toast networkError = Toast.makeText(InsufficientTLS3.this, "No Network Connection Detected.", Toast.LENGTH_SHORT); networkError.show(); } }
From source file:com.arthackday.killerapp.util.Util.java
public void popup(String msg) { CharSequence text = msg;// w w w .j a v a2s . c o m int duration = Toast.LENGTH_SHORT; Toast toast = Toast.makeText(activity, text, duration); toast.show(); }