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. How to use with an image in the .apk ?


i'm a big newbie in developping Android application, and i just met my
first issue.

I'm trying to display an image from package resources with an intent
'ACTION_VIEW'. I set the data type to 'image/*' and the data to
'android.resource://com.mypackage.test/r.drawable.toto' where toto is
a jpg picture.

When i run the application, a new activity is launched (activity is
'view picture' from but no picture displayed and
it finally crash with a java.lang.NullPointerException.

I think my reference to the resource may be false but i didn't manage
to make it work. Any help would be appreciated.

Ps: i apologize for my poor english skills



2. read only time


I would like to implement a functionality in my game to give some daily
goodies. But user can easily abuse it by changing the date of the device
again and again. I know this can be easily implemented through some server.
Is there any way to handle it locally without the involvement of server or
network connectivity? Thanks

Best Regards,
Atif Gulzar

I  Unicode, zln 


3. how to set two colors Android list rows

4. crash in ListView.layoutChildren on display of onscreen keyboard


6. Basis SoftExpo 2010

7. News