Wednesday, January 23, 2013

Re: [android-developers] Key should not be taken by activity till Toast is shown


On Wed, Jan 23, 2013 at 1:04 AM, Revathi Ramanan <revathiramanan30031987@gmail.com> wrote:
I trigger a toast message when a wrong number is entered by user in Edit Text box.
The toast duration is Toast.LENGTH_LONG.

My requirement is till the Toast is shown to the user, no Keys should be accepted by Edit Text.

For this, I am trying the below thing.
I am starting a thread and in the run() of Thread, I am calling sleep(Toast.LENGTH_LONG).

In the onKeyUp() of the activity, I am checking whether Thread is alive.

All the time thread state is returned as TERMINATED and isAlive() is returned as false.

I want a way for the activity not to take any keys till my toast is alive.

Any help would be really appreciated.

Might I suggest you change your requirement?

A toast is for a quick message that has no side-effect or requires interaction.

If you trigger a toast each time a wrong number is shown, you could potentially queue up a very long list of Toasts to show the user if they spammed the wrong number.

If you want to ensure that they've seen the message, and don't want to proceed until the message is viewed and dismissed, consider a dialog.

-------------------------------------------------------------------------------------------------
TreKing - Chicago transit tracking app for Android-powered devices

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment