-1

I have a Custom Toast which i want it to be display for 10 seconds

this is my code:

                        LayoutInflater inflater = getLayoutInflater();
                        View layout = inflater.inflate(R.layout.custom_toast,
                                (ViewGroup) findViewById(R.id.toast_layout_root));

                        TextView text = (TextView) layout.findViewById(R.id.text);
                        text.setText("please wait.... ");
                        text.setTypeface(type);

                        Toast toast = new Toast(getApplicationContext());
                        toast.setGravity(Gravity.CENTER_VERTICAL, 0, 0);
                        toast.setDuration(10000);
                        toast.setView(layout);
                        toast.show();

but it doesn't work by setting toast.setDuration(10000); is anyone know what is wrong in my code or how can i do this in another way?

Sasa
  • 565
  • 5
  • 15
  • [http://stackoverflow.com/questions/14503727/how-can-i-show-a-toast-for-a-specific-duration](http://stackoverflow.com/questions/14503727/how-can-i-show-a-toast-for-a-specific-duration) – M D Mar 05 '15 at 06:22

1 Answers1

1

You can't do that. Toast have only two variants to go as you already know

private static final int LONG_DELAY = 3500; // 3.5 seconds
private static final int SHORT_DELAY = 2000; // 2 seconds

anyway the link in the comments points to the right answer, noticed that later

Etun
  • 403
  • 3
  • 8