1.

What is the use of Notification Chanel and how to create it?

Answer»

A toast can be displayed on the screen is defined by a flag as Duration. We can set duration SHORT or Long. The value for Short is 2.0 second and value for Long is 3.5 Second.

Context context = getApplicationContext(); Toast.makeText(context, "Testing Toast Message.", Toast.LENGTH_SHORT).show();

You can not directly change the duration of Toast Message which is showing in the show() method. But there is a workaround. You can use CountDownTimer Class or Handler Class to INCREASE display time of Toast.

  • Schedule a countdown until a time in the future, with regular notifications on INTERVALS ALONG the way.
  • you need to create a new WINDOW manager and show and hide the window for the desired duration using a handler


Discussion

No Comment Found

Related InterviewSolutions