posted 7 years ago
Hi all,
I want to display one activity which has one ImageView displaying an image. I want to display that just for 5 seconds the move on to another activity.
I tried using thread mechanism. But did not work.
Following is my code.
Please help.
I want to display one activity which has one ImageView displaying an image. I want to display that just for 5 seconds the move on to another activity.
I tried using thread mechanism. But did not work.
Following is my code.
Please help.
posted 7 years ago
I don't understand how you are expecting that code to work. You are starting a new thread which is sleeping for 3 seconds and then dying. That won't stop the main thread to stop. What might work for you is you start the intent inside the thread that you started...
SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Hardik Trivedi
Ranch Hand
Posts: 252
posted 7 years ago
You need to pass a Context as first argument to the Intent constructor; instead you passed a Runnable.
For e.g.: you can move the following two lines inside run after the sleep call:
Hardik Trivedi wrote:Hi Ankit,
I triead that too.It gives The constructor Intent(new Runnable(){}, Class<Choices>) is undefined error.
Can you tell me what this error is. And Is there any inner mechanism to display activity for specific time period.
You need to pass a Context as first argument to the Intent constructor; instead you passed a Runnable.
For e.g.: you can move the following two lines inside run after the sleep call:
[List of FAQs] | [Android FAQ] | [Samuh Varta]

It is sorta covered in the JavaRanch Style Guide. |