Java Code Examples for android.widget.Toast

The following code examples are extracted from open source projects. You can click to vote up the examples that are useful to you.

Example 1

From project AlarmApp-Android, under directory /src/org/alarmapp/util/.

Source file: ActivityUtil.java

  18 
vote

public static void displayToast(final Activity activity,final String text,final int duration){
  activity.runOnUiThread(new Runnable(){
    public void run(){
      Toast toast=Toast.makeText(activity,text,duration);
      toast.show();
    }
  }
);
}
 

Example 2

From project Android-GifStitch, under directory /src/com/phunkosis/gifstitch/dialogs/.

Source file: DialogHelper.java

  18 
vote

public static void showHint(final Context c,String hintText,boolean makeItAQuickOne){
  int duration=makeItAQuickOne ? Toast.LENGTH_SHORT : Toast.LENGTH_LONG;
  Toast t=Toast.makeText(c,hintText,duration);
  t.setGravity(Gravity.CENTER_VERTICAL,0,0);
  t.show();
}
 

Example 3

From project 2Degrees-Toolbox, under directory /ActionBarSherlock/src/com/actionbarsherlock/internal/view/menu/.

Source file: ActionMenuItemView.java

  17 
vote

@Override public boolean onLongClick(View v){
  if (hasText()) {
    return false;
  }
  final int[] screenPos=new int[2];
  final Rect displayFrame=new Rect();
  getLocationOnScreen(screenPos);
  getWindowVisibleDisplayFrame(displayFrame);
  final Context context=getContext();
  final int width=getWidth();
  final int height=getHeight();
  final int midy=screenPos[1] + height / 2;
  final int screenWidth=context.getResources().getDisplayMetrics().widthPixels;
  Toast cheatSheet=Toast.makeText(context,mItemData.getTitle(),Toast.LENGTH_SHORT);
  if (midy < displayFrame.height()) {
    cheatSheet.setGravity(Gravity.TOP | Gravity.RIGHT,screenWidth - screenPos[0] - width / 2,height);
  }
 else {
    cheatSheet.setGravity(Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL,0,height);
  }
  cheatSheet.show();
  return true;
}
 

Example 4

From project 4308Cirrus, under directory /Extras/actionbarsherlock/src/com/actionbarsherlock/internal/view/menu/.

Source file: ActionMenuItemView.java

  17 
vote

@Override public boolean onLongClick(View v){
  if (hasText()) {
    return false;
  }
  final int[] screenPos=new int[2];
  final Rect displayFrame=new Rect();
  getLocationOnScreen(screenPos);
  getWindowVisibleDisplayFrame(displayFrame);
  final Context context=getContext();
  final int width=getWidth();
  final int height=getHeight();
  final int midy=screenPos[1] + height / 2;
  final int screenWidth=context.getResources().getDisplayMetrics().widthPixels;
  Toast cheatSheet=Toast.makeText(context,mItemData.getTitle(),Toast.LENGTH_SHORT);
  if (midy < displayFrame.height()) {
    cheatSheet.setGravity(Gravity.TOP | Gravity.RIGHT,screenWidth - screenPos[0] - width / 2,height);
  }
 else {
    cheatSheet.setGravity(Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL,0,height);
  }
  cheatSheet.show();
  return true;
}
 

Example 5

From project ActionBarSherlock, under directory /library/src/com/actionbarsherlock/internal/view/menu/.

Source file: ActionMenuItemView.java

  17 
vote

@Override public boolean onLongClick(View v){
  if (hasText()) {
    return false;
  }
  final int[] screenPos=new int[2];
  final Rect displayFrame=new Rect();
  getLocationOnScreen(screenPos);
  getWindowVisibleDisplayFrame(displayFrame);
  final Context context=getContext();
  final int width=getWidth();
  final int height=getHeight();
  final int midy=screenPos[1] + height / 2;
  final int screenWidth=context.getResources().getDisplayMetrics().widthPixels;
  Toast cheatSheet=Toast.makeText(context,mItemData.getTitle(),Toast.LENGTH_SHORT);
  if (midy < displayFrame.height()) {
    cheatSheet.setGravity(Gravity.TOP | Gravity.RIGHT,screenWidth - screenPos[0] - width / 2,height);
  }
 else {
    cheatSheet.setGravity(Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL,0,height);
  }
  cheatSheet.show();
  return true;
}
 

Example 6

From project Amantech, under directory /Android/action_bar_sherlock/src/com/actionbarsherlock/internal/view/menu/.

Source file: ActionMenuItemView.java

  17 
vote

@Override public boolean onLongClick(View v){
  if (hasText()) {
    return false;
  }
  final int[] screenPos=new int[2];
  final Rect displayFrame=new Rect();
  getLocationOnScreen(screenPos);
  getWindowVisibleDisplayFrame(displayFrame);
  final Context context=getContext();
  final int width=getWidth();
  final int height=getHeight();
  final int midy=screenPos[1] + height / 2;
  final int screenWidth=context.getResources().getDisplayMetrics().widthPixels;
  Toast cheatSheet=Toast.makeText(context,mItemData.getTitle(),Toast.LENGTH_SHORT);
  if (midy < displayFrame.height()) {
    cheatSheet.setGravity(Gravity.TOP | Gravity.RIGHT,screenWidth - screenPos[0] - width / 2,height);
  }
 else {
    cheatSheet.setGravity(Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL,0,height);
  }
  cheatSheet.show();
  return true;
}
 

Example 7

From project andlytics, under directory /actionbarsherlock/src/com/actionbarsherlock/internal/view/menu/.

Source file: ActionMenuItemView.java

  17 
vote

@Override public boolean onLongClick(View v){
  if (hasText()) {
    return false;
  }
  final int[] screenPos=new int[2];
  final Rect displayFrame=new Rect();
  getLocationOnScreen(screenPos);
  getWindowVisibleDisplayFrame(displayFrame);
  final Context context=getContext();
  final int width=getWidth();
  final int height=getHeight();
  final int midy=screenPos[1] + height / 2;
  final int screenWidth=context.getResources().getDisplayMetrics().widthPixels;
  Toast cheatSheet=Toast.makeText(context,mItemData.getTitle(),Toast.LENGTH_SHORT);
  if (midy < displayFrame.height()) {
    cheatSheet.setGravity(Gravity.TOP | Gravity.RIGHT,screenWidth - screenPos[0] - width / 2,height);
  }
 else {
    cheatSheet.setGravity(Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL,0,height);
  }
  cheatSheet.show();
  return true;
}
 

Example 8

From project android-cropimage, under directory /src/com/android/camera/.

Source file: CropImage.java

  17 
vote

public void run(){
  mImageMatrix=mImageView.getImageMatrix();
  Bitmap faceBitmap=prepareBitmap();
  mScale=1.0F / mScale;
  if (faceBitmap != null && mDoFaceDetection) {
    FaceDetector detector=new FaceDetector(faceBitmap.getWidth(),faceBitmap.getHeight(),mFaces.length);
    mNumFaces=detector.findFaces(faceBitmap,mFaces);
  }
  if (faceBitmap != null && faceBitmap != mBitmap) {
    faceBitmap.recycle();
  }
  mHandler.post(new Runnable(){
    public void run(){
      mWaitingToPick=mNumFaces > 1;
      if (mNumFaces > 0) {
        for (int i=0; i < mNumFaces; i++) {
          handleFace(mFaces[i]);
        }
      }
 else {
        makeDefault();
      }
      mImageView.invalidate();
      if (mImageView.mHighlightViews.size() == 1) {
        mCrop=mImageView.mHighlightViews.get(0);
        mCrop.setFocus(true);
      }
      if (mNumFaces > 1) {
        Toast t=Toast.makeText(CropImage.this,R.string.multiface_crop_help,Toast.LENGTH_SHORT);
        t.show();
      }
    }
  }
);
}
 

Example 9

From project Absolute-Android-RSS, under directory /src/com/AA/Activities/.

Source file: AAWidget.java

  15 
vote

/** 
 * Saves all the data that is gathered from the setting dialog
 */
private void acceptChanges(){
  Bundle extras=getIntent().getExtras();
  int appWidgetId=0;
  Editor edit=settings.edit();
  if (extras == null) {
    Toast.makeText(this,"Uh oh. Something weird just happened\n" + "Try again",Toast.LENGTH_LONG).show();
    this.finish();
    return;
  }
  appWidgetId=extras.getInt(AppWidgetManager.EXTRA_APPWIDGET_ID,AppWidgetManager.INVALID_APPWIDGET_ID);
  if (rb_center.isChecked())   edit.putInt("" + appWidgetId,R.drawable.widget_layout_top_centered);
  edit.putInt("widgetCount",settings.getInt("widgetCount",0) + 1);
  edit.putLong("freq",sb_freq.getProgress() + 1);
  edit.commit();
  Intent resultValue=new Intent();
  resultValue.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID,appWidgetId);
  setResult(RESULT_OK,resultValue);
  AAWidgetProvider.launchService(this);
  this.finish();
}
 

Example 10

From project ActionBarCompat, under directory /ActionBarCompatSample/src/sk/m217/actionbarcompatsample/.

Source file: ActionBarCompatSampleActivity.java

  15 
vote

@Override public boolean onCreateOptionsMenu(Menu menu){
  MenuInflater menuInflater=getMenuInflater();
  menuInflater.inflate(R.menu.options,menu);
  if (mMenu != null) {
    return super.onCreateOptionsMenu(menu);
  }
  mMenu=menu;
  MenuItem item=mMenu.findItem(R.id.menu_search);
  if (item != null) {
    MenuItemCompat.setOnActionExpandListener(item,new MenuItemCompat.OnActionExpandListenerCompat(){
      @Override public boolean onMenuItemActionExpand(      MenuItem item){
        Toast.makeText(ActionBarCompatSampleActivity.this,"onMenuItemActionExpand()",Toast.LENGTH_SHORT).show();
        return true;
      }
      @Override public boolean onMenuItemActionCollapse(      MenuItem item){
        Toast.makeText(ActionBarCompatSampleActivity.this,"onMenuItemActionCollapse()",Toast.LENGTH_SHORT).show();
        return true;
      }
    }
);
  }
  EditText editText=(EditText)MenuItemCompat.getActionView(item);
  if (editText != null) {
    editText.setText(R.string.menu_search);
  }
  item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener(){
    @Override public boolean onMenuItemClick(    MenuItem item){
      Toast.makeText(ActionBarCompatSampleActivity.this,"onMenuItemClick()",Toast.LENGTH_LONG).show();
      return false;
    }
  }
);
  item.setIcon(R.drawable.ic_action_search).setTitle(R.string.menu_search).setIntent(null).setVisible(true).setEnabled(true);
  return super.onCreateOptionsMenu(menu);
}
 

Example 11

From project agit, under directory /agit/src/main/java/com/madgag/agit/.

Source file: BlobViewFragment.java

  15 
vote

public void displayBlob(){
  Uri data=Uri.parse("file://" + tempFile.getAbsolutePath());
  Intent intent=new Intent(android.content.Intent.ACTION_VIEW);
  intent.setDataAndType(data,mimeType);
  if (isIntentAvailable(getActivity(),intent)) {
    startActivity(intent);
  }
 else {
    Spanned messageHtml=fromHtml(getString(R.string.no_viewer_available_for_file,boldCode(nameString)));
    Toast.makeText(getActivity(),messageHtml,Toast.LENGTH_LONG).show();
  }
  getActivity().finish();
}
 

Example 12

From project AirCastingAndroidClient, under directory /src/main/java/pl/llp/aircasting/activity/.

Source file: AirCastingActivity.java

  15 
vote

@Subscribe public void onEvent(AudioReaderErrorEvent event){
  runOnUiThread(new Runnable(){
    @Override public void run(){
      Toast.makeText(context,R.string.mic_error,Toast.LENGTH_LONG).show();
    }
  }
);
}
 

Example 13

From project Airports, under directory /src/com/nadmm/airports/.

Source file: DownloadActivity.java

  15 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  mDbManager=DatabaseManager.instance(this);
  mDownloadTask=null;
  mHandler=new Handler();
  setContentView(createContentView(R.layout.download_list_view));
  View footer=inflate(R.layout.download_footer);
  mListView=(ListView)findViewById(android.R.id.list);
  mListView.addFooterView(footer);
  mListView.setFooterDividersEnabled(true);
  Button btnDownload=(Button)findViewById(R.id.btnDownload);
  btnDownload.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      checkNetworkAndDownload();
    }
  }
);
  Button btnDelete=(Button)findViewById(R.id.btnDelete);
  btnDelete.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      checkDelete();
    }
  }
);
  Intent intent=getIntent();
  if (intent.hasExtra("MSG")) {
    String msg=intent.getStringExtra("MSG");
    Toast.makeText(this,msg,Toast.LENGTH_LONG).show();
  }
  checkData(false);
}
 

Example 14

From project aksunai, under directory /src/org/androidnerds/app/aksunai/.

Source file: Aksunai.java

  15 
vote

public void connectToServer(long id,String name){
  ConnectivityManager manager=(ConnectivityManager)getSystemService(Context.CONNECTIVITY_SERVICE);
  NetworkInfo info=manager.getActiveNetworkInfo();
  if (info == null || !info.isConnected()) {
    Toast.makeText(Aksunai.this,getString(R.string.no_network_connection),Toast.LENGTH_LONG).show();
    return;
  }
  Intent i=new Intent(Aksunai.this,ChatActivity.class);
  i.putExtra("id",id);
  i.putExtra("title",name);
  startActivity(i);
}
 

Example 15

From project Alerte-voirie-android, under directory /src/com/fabernovel/alertevoirie/.

Source file: AddCommentActivity.java

  15 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  requestWindowFeature(Window.FEATURE_LEFT_ICON);
  setContentView(R.layout.layout_add_comment);
  getWindow().setFeatureDrawableResource(Window.FEATURE_LEFT_ICON,R.drawable.icon_nouveau_rapport);
  final EditText commentField=(EditText)findViewById(R.id.EditText_comment);
  commentField.setText(getIntent().getStringExtra(IntentData.EXTRA_COMMENT));
  ((TextView)findViewById(R.id.TextView_remaining_chars)).setText((140 - commentField.getText().length()) + " car. restant");
  commentField.addTextChangedListener(new TextWatcher(){
    public void afterTextChanged(    Editable s){
      ((TextView)findViewById(R.id.TextView_remaining_chars)).setText((140 - commentField.getText().length()) + " car. restant");
    }
    public void beforeTextChanged(    CharSequence s,    int start,    int count,    int after){
    }
    public void onTextChanged(    CharSequence s,    int start,    int before,    int count){
    }
  }
);
  findViewById(R.id.Button_validate).setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      if (commentField.getText().toString().trim().length() > 0) {
        Intent result=new Intent();
        result.putExtra(IntentData.EXTRA_COMMENT,commentField.getText().toString());
        setResult(RESULT_OK,result);
        finish();
      }
 else {
        Toast.makeText(getApplicationContext(),"Veuillez entrer un commentaire",Toast.LENGTH_SHORT).show();
      }
    }
  }
);
}
 

Example 16

From project alljoyn_java, under directory /samples/android/contacts/ContactsClient/src/org/alljoyn/bus/samples/contacts_client/.

Source file: ContactsClient.java

  15 
vote

@Override public void handleMessage(Message msg){
switch (msg.what) {
case MESSAGE_DISPLAY_ALL_CONTACTS:
    mContactNames=(NameId[])msg.obj;
  mContactsListAdapter.clear();
mGetContactsBtn.setText(getString(R.string.update_contacts));
for (int i=0; i < mContactNames.length; i++) {
mContactsListAdapter.add(mContactNames[i].displayName);
}
break;
case MESSAGE_DISPLAY_CONTACT:
mAddressEntry=(Contact)msg.obj;
showDialog(DIALOG_CONTACT);
break;
case MESSAGE_POST_TOAST:
Toast.makeText(getApplicationContext(),(String)msg.obj,Toast.LENGTH_LONG).show();
break;
case MESSAGE_START_PROGRESS_DIALOG:
mDialog=ProgressDialog.show(ContactsClient.this,"","Finding Contacts Service.\nPlease wait...",true,true);
break;
case MESSAGE_STOP_PROGRESS_DIALOG:
mDialog.dismiss();
break;
default :
break;
}
}
 

Example 17

From project AmDroid, under directory /AmDroid/src/main/java/com/jaeckel/amenoid/.

Source file: AmenDetailFragmentActivity.java

  15 
vote

private void startShowOnMapActivity(){
  Double lat=getCurrentStatement().getObjekt().getLat();
  Double lng=getCurrentStatement().getObjekt().getLng();
  String label=getCurrentStatement().getObjekt().getName().replaceAll("\\(","").replaceAll("\\)","");
  final String uriString="https://maps.google.com/maps?q=" + lat + ','+ lng+ "("+ label+ ")"+ "&z=15";
  Log.d(TAG,"uriString for show on map: " + uriString);
  Intent showOnMapIntent=new Intent(Intent.ACTION_VIEW,Uri.parse(uriString));
  try {
    startActivity(showOnMapIntent);
  }
 catch (  ActivityNotFoundException anf) {
    toast("No activity found to view " + uriString,Toast.LENGTH_LONG);
  }
}
 

Example 18

From project and-bible, under directory /AndBible/src/net/bible/android/control/bookmark/.

Source file: BookmarkControl.java

  15 
vote

@Override public boolean bookmarkCurrentVerse(){
  boolean bOk=false;
  if (CurrentPageManager.getInstance().isBibleShown() || CurrentPageManager.getInstance().isCommentaryShown()) {
    Key currentVerse=CurrentPageManager.getInstance().getCurrentBible().getSingleKey();
    if (getBookmarkByKey(currentVerse) != null) {
      Toast.makeText(BibleApplication.getApplication().getApplicationContext(),R.string.bookmark_exists,Toast.LENGTH_SHORT).show();
    }
 else {
      BookmarkDto bookmarkDto=new BookmarkDto();
      bookmarkDto.setKey(currentVerse);
      BookmarkDto newBookmark=addBookmark(bookmarkDto);
      if (newBookmark != null) {
        Toast.makeText(BibleApplication.getApplication().getApplicationContext(),R.string.bookmark_added,Toast.LENGTH_SHORT).show();
        bOk=true;
      }
 else {
        Dialogs.getInstance().showErrorMsg(R.string.error_occurred);
      }
    }
  }
  return bOk;
}
 

Example 19

From project android-aac-enc, under directory /src/com/todoroo/aacenc/.

Source file: Main.java

  15 
vote

private void play(){
  MediaPlayer mediaPlayer=new MediaPlayer();
  try {
    mediaPlayer.setDataSource(M4A_FILE);
    mediaPlayer.prepare();
    mediaPlayer.start();
  }
 catch (  IllegalArgumentException e) {
    throw new RuntimeException(e);
  }
catch (  IllegalStateException e) {
    throw new RuntimeException(e);
  }
catch (  IOException e) {
    throw new RuntimeException(e);
  }
  Toast.makeText(Main.this,"Playing Audio",Toast.LENGTH_LONG).show();
}
 

Example 20

From project android-api_1, under directory /Example/src/com/example/CatchApiDemo/.

Source file: Dashboard.java

  15 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.main);
  final Button signInButton=(Button)findViewById(R.id.sign_in_button);
  signInButton.setOnClickListener(new OnClickListener(){
    public void onClick(    View v){
      showDialog(DIALOG_SIGN_IN);
    }
  }
);
  final Button fetchButton=(Button)findViewById(R.id.fetch_button);
  fetchButton.setOnClickListener(new OnClickListener(){
    public void onClick(    View v){
      if (mAccessToken == null) {
        Toast.makeText(Dashboard.this,"Not signed in!",Toast.LENGTH_SHORT).show();
      }
 else {
        new FetchNotesTask(getApplicationContext()).execute();
      }
    }
  }
);
  final Button createButton=(Button)findViewById(R.id.create_button);
  createButton.setOnClickListener(new OnClickListener(){
    public void onClick(    View v){
      if (mAccessToken == null) {
        Toast.makeText(Dashboard.this,"Not signed in!",Toast.LENGTH_SHORT).show();
      }
 else {
        showDialog(DIALOG_COMPOSE_NOTE);
      }
    }
  }
);
}
 

Example 21

From project Android-automation, under directory /TmtsApp/src/com/taobao/tmts/framework/app/.

Source file: ListViewActivity.java

  15 
vote

@Override public boolean onContextItemSelected(MenuItem item){
switch (item.getItemId()) {
case 0:
    Toast.makeText(this,"Item One",Toast.LENGTH_SHORT).show();
  break;
case 1:
Toast.makeText(this,"Item Two",Toast.LENGTH_SHORT).show();
break;
default :
break;
}
return super.onContextItemSelected(item);
}
 

Example 22

From project android-bankdroid, under directory /src/com/liato/bankdroid/.

Source file: SettingsActivity.java

  15 
vote

@Override public boolean onPreferenceChange(Preference pref,Object newValue){
  final String prefKey=pref.getKey();
  if ("notify_min_delta".equals(prefKey)) {
    Integer val;
    try {
      val=Integer.valueOf((String)newValue);
    }
 catch (    NumberFormatException e) {
      val=null;
    }
    if (val != null && val >= 0) {
      return true;
    }
 else {
      Toast.makeText(pref.getContext(),String.format(pref.getContext().getString(R.string.invalid_integer),newValue),Toast.LENGTH_LONG).show();
    }
    return false;
  }
  return false;
}
 

Example 23

From project android-client, under directory /xwiki-android-client/src/org/xwiki/android/client/blog/.

Source file: EditPostActivity.java

  15 
vote

private void showDialog(){
  dialog=new Dialog(this);
  dialog.getWindow().setFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND,WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
  dialog.setTitle("New Blog Post");
  LayoutInflater li=(LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  View dialogView=li.inflate(R.layout.blog_editor_dialog,null);
  dialog.setContentView(dialogView);
  dialog.show();
  Button okBtn=(Button)dialogView.findViewById(R.id.btn_blog_ok);
  etTitle=(EditText)dialogView.findViewById(R.id.et_blog_title);
  actvCategory=(AutoCompleteTextView)dialogView.findViewById(R.id.actv_blog_category);
  String[] categories={"Blog.Personal","Blog.News","Blog.Other"};
  ArrayAdapter<String> adapterCts=new ArrayAdapter<String>(this,R.layout.searchresults_list_item,categories);
  actvCategory.setAdapter(adapterCts);
  okBtn.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      title=etTitle.getText().toString();
      category=actvCategory.getText().toString();
      if (title == null || category == null || title.equals("") || category.equals("")) {
        Toast.makeText(getBaseContext(),"Please fill data",Toast.LENGTH_LONG).show();
      }
 else {
        mydoc=new BlogDocument("xwiki","Blog",title,category);
        dialog.dismiss();
      }
    }
  }
);
}
 

Example 24

From project android-context, under directory /defunct/.

Source file: ContextProximityActivity.java

  15 
vote

public boolean onLongClick(View v){
  ViewHolder holder=(ViewHolder)v.getTag();
  ContextListItem item=getItem(holder.index);
  clip.setText(item.getValue());
  Toast.makeText(mContext,item.getName() + "\n\nCopied: [" + item.getValue()+ "]",Toast.LENGTH_SHORT).show();
  return true;
}
 

Example 25

From project android-database-sqlcipher, under directory /src/net/sqlcipher/database/.

Source file: SqliteWrapper.java

  15 
vote

public static void checkSQLiteException(Context context,SQLiteException e){
  if (isLowMemory(e)) {
    Toast.makeText(context,e.getMessage(),Toast.LENGTH_SHORT).show();
  }
 else {
    throw e;
  }
}
 

Example 26

From project Android-File-Manager, under directory /src/com/nexes/manager/.

Source file: ApplicationBackup.java

  15 
vote

public void handleMessage(Message msg){
switch (msg.what) {
case SET_PROGRESS:
    mDialog.setMessage((String)msg.obj);
  break;
case FINISH_PROGRESS:
mDialog.cancel();
Toast.makeText(ApplicationBackup.this,"Applications have been backed up",Toast.LENGTH_SHORT).show();
break;
}
}
 

Example 27

From project Android-File-Manager-Tablet, under directory /src/com/nexes/manager/tablet/.

Source file: BluetoothActivity.java

  15 
vote

@Override public void handleMessage(Message msg){
  int progress=msg.arg1;
  int size=msg.arg2;
switch (msg.what) {
case DIALOG_UPDATE:
    String name=(String)msg.obj;
  mProgress.setMessage("Sending " + name);
mProgress.setMax(size);
mProgress.setProgress((mProgress.getProgress() + progress) / size);
break;
case DIALOG_CANCEL:
String error=(String)msg.obj;
mProgress.cancel();
Toast.makeText(BluetoothActivity.this,"Error, " + error,Toast.LENGTH_LONG).show();
break;
case DIALOG_FINISH:
mProgress.cancel();
Toast.makeText(BluetoothActivity.this,"Files successfully sent",Toast.LENGTH_LONG).show();
break;
}
}
 

Example 28

From project android-flash-cards, under directory /src/org/thomasamsler/android/flashcards/activity/.

Source file: MainActivity.java

  15 
vote

private void getExternal(){
  if (mActiveFragmentReference == SETUP_FRAGMENT) {
    showCardSetsFragment(true);
  }
  if (null == mCardSetsFragment) {
    Toast.makeText(getApplicationContext(),R.string.external_data_message_error,Toast.LENGTH_SHORT).show();
  }
 else {
    mCardSetsFragment.getFlashCardExchangeCardSets();
  }
}
 

Example 29

From project android-flip, under directory /FlipView/Demo/src/com/aphidmobile/flip/demo/views/.

Source file: NumberButton.java

  15 
vote

public NumberButton(Context context,final int n){
  super(context,null,R.attr.buttonStyleInset);
  setNumber(n);
  setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      Toast.makeText(v.getContext(),"Clicked button " + number,Toast.LENGTH_SHORT).show();
    }
  }
);
}
 

Example 30

From project android-joedayz, under directory /Proyectos/AndroidFoursquare/src/com/mycompany/fsq/.

Source file: Main.java

  15 
vote

@Override public void handleMessage(Message msg){
  mProgress.dismiss();
  if (msg.what == 0) {
    if (mNearbyList.size() == 0) {
      Toast.makeText(Main.this,"No nearby places available",Toast.LENGTH_SHORT).show();
      return;
    }
    mAdapter.setData(mNearbyList);
    mListView.setAdapter(mAdapter);
  }
 else {
    Toast.makeText(Main.this,"Failed to load nearby places",Toast.LENGTH_SHORT).show();
  }
}