ViewFlipper not working inside a class which extends LinearLayout

by Nithin » Thu, 22 Apr 2010 22:59:00 GMT

Sponsored Links

When I tried to create a ViewFlipper inside a class which extends
LinearLayout, its throwing an exception

"java.lang.RuntimeException: Can't create handler inside thread that
has not called Looper.prepare()".

I am creating the ViewFlipper using,

ViewFlipper flipper = new ViewFlipper(ctContext);

But when I create the ViewFlipper in a class which extends Activity,
its working normally. What may the reason ?



ViewFlipper not working inside a class which extends LinearLayout

by Streets Of Boston » Fri, 23 Apr 2010 01:25:50 GMT

 What thread is calling 'new ViewFlipper(ctContext)'?
Is it the main UI-thread?
If not, the calling thread must have a message-loop associated with it
(A looper-thread).
If it's not a looper-thread, you can't call 'new
ViewFlipper(ctContext)' this way.


Sponsored Links

ViewFlipper not working inside a class which extends LinearLayout

by Nithin » Fri, 23 Apr 2010 02:07:54 GMT

 Thanks for your reply.. solved the issue..

I put the flipper creation code inside the runOnUIThread() and its
working fine..


On Apr 22, 10:25pm, Streets Of Boston <>

> >

Other Threads

1. Do I need to protect my code from possible database create/upgrade race conditions?

I have an activity with 2 background threads accessing the same
database.  In each background thread I am using SQLiteOpenHelper to
open the database.  Do I need to worry about onCreate and onUpgrade
potentially being called on each thread?


2. Samsung Galaxy isn麓t working af ter update - whole system error!!!

Hi everybody,
A few minutes ago I have updated my Samsung Galaxy with the "New PC
Studio" for Germany (not Android 1.6!!!).
After that, my mobile restarted and now the whole system isnt
There always appers an error message that process
has stopped unexpectedly.
Normaly( when I bought this phone ) I was able to tap to Wait, but now
there is no way to do it.
Now I can only tap to close but then it cuttes all my conections.
This wouldnt be the problem if it appeared only one time, but

Do you know what to do now???

Will the problem be fixed with Android 1.6, which (I hope) will appear
in Germany the next days???

Thanks in advance

3. sdcard mounted ok, but get "Unable to open trace file '/sdcard/x.trace", why?

4. onActivityResult() : delivering data problem

5. We do believe in Google !

6. Cursor.moveToPosition(0) is false even with content

7. Notification - Getting Pending Notifications