toast

Android: 2 toasts same time

Ok, I have 1 custom toast (xml layout) and it works great: LayoutInflater inflater = getLayoutInflater(); View layout = inflater.inflate(R.layout.custom_toast, (ViewGroup) findViewById(R.id.toast_layout)); ImageView image = (ImageView) layout.findViewById(R.id.logo); image.setImageResource(R.drawable.logo); t...

Why doesn't the 'toast' message work, in Android? Cannot fix bug, please help!

Hi, Imagine I have the following code that runs as a background processor for an android application: public class Background extends Service { public void popup (String message, int duration) { Toast.makeText(this, message, duration).show(); } class BackgroundChecker extends TimerTask { public vo...

how to add a layout to the toast

i create a user-defined toast,and i want to get the xml of layout from the layout package,but if i used the code below,there comes a problem:InflateException,i had used many ways to get the layout but fail.the code is below,thanks public class ImageTextToast extends Toast { private Context context; private String text; ...

Toast does not display when used in catch block

I noticed that a toast isn't displayed when it's used inside a catch block. Does anyone know how to show toasts when catching exceptions? An Example: try { // try to open a file } catch (FileNotFoundException e) { Toast.makeText(this, R.string.txt_file_not_found, Toast.LENGTH_LONG); return; // cancel processing } ...