show Toast in a Thread : Toast « UI « Android






show Toast in a Thread

  
/**
 * Copyright (C) 2010 christian
 * This file is part of Drupal Editor.
 *
 * Drupal Editor is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 2 of the License, or
 * (at your option) any later version.
 *
 * Drupal Editor is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Drupal Editor. If not, see <http://www.gnu.org/licenses/>.
 */
package ch.dissem.android.utils;

import android.content.Context;
import android.os.Handler;
import android.widget.Toast;

/**
 * @author christian
 * 
 */
public class ThreadingUtils {
  public static void showToast(Handler handler, final Context context,
      final int resId, final int duration) {
    handler.post(new Runnable() {
      public void run() {
        Toast.makeText(context, resId, duration).show();
      }
    });
  }
}

   
    
  








Related examples in the same category

1.Raise a Toast
2.Toast Message Demo
3.Using Toast.LENGTH_SHORT
4.Toast and Notification, vibrate and sound
5.Show Toast
6.Make Toast Text
7.Responsible for sending Toasts under all circumstances.
8.Toast.LENGTH_SHORT
9.AlertDialog vs Toast
10.Show long,short Toast
11.The Toast util class
12.Popup Debug Message