ViewFlipper not working inside a class which extends LinearLayout

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


Sponsored Links
 Hi,

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 ?

Nithin

--



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..

Nithin

On Apr 22, 10:25pm, Streets Of Boston <flyingdutc...@gmail.com>



> >



Other Threads

1. Stable contact identity & CONTENT_LOOKUP_URI

In the course of moving to the 2.0 cotnact APIs, I've stumbled across
CONTENT_LOOKUP_URI :

http://developer.android.com/reference/android/provider/ContactsContract.Contacts.html#CONTENT_LOOKUP_URI

"As long as the contact's row ID remains the same, this URI is
equivalent to CONTENT_URI. If the contact's row ID changes as a result
of a sync or aggregation, this URI will look up the contact using
indirect information "

Currently, we store contact IDs to identify particular contacts. If I
read this right, contact IDs will no longer be stable in the world of
2.0, and we will need to store a lookup URI (or at least a LOOKUP_KEY
and a row ID) in order to identify a contact in a stable way.

That would be a substantial change in our code. So, before I rush off
to do it, I'd love to find out if a contact row ID change is going to
be a routine thing (say, on every sync), or if it will be a very rare
thing (say, when two contacts are manually combined into one, or some
even rarer exception).

Any clues ?

Thanks,

Richard

-- 

2. Problem running a compiled/packaged-with-v1.6 application on v1.5

Lance,

Digging further showed that it was the problem with my "theme customization".

The default "preference_category.xml" is referring to 
"listSeparatorTextViewStyle" as its style. But I've customized the 
"listSeparatorTextViewStyle" and for whatever reason it does not correctly 
inherit the "layout_width" and "layout_hight" attributes from Android default 
theme.

In my "themes.xml":
        <item 
name="android:listSeparatorTextViewStyle">@style/Widget.TextView.ListSeparator</item>

In my "styles.xml":
    <style name="Widget.TextView.ListSeparator" 
parent="android:Widget.TextView.ListSeparator">
        <item name="android:background">@drawable/blue_header</item>
    </style>

Solution: I just copied all the attributes from Android default 
"Widget.TextView.ListSeparator" and the problem got fixed! No other changes, 
including the ones I just mentioned in my previous reply, are needed:

    <style name="Widget.TextView.ListSeparator" 
parent="android:Widget.TextView">
        <item name="android:background">@drawable/blue_header</item>

        <item name="android:layout_width">fill_parent</item>
        <item name="android:layout_height">25dip</item>
        <item name="android:textStyle">bold</item>
        <item name="android:textColor">?android:attr/textColorSecondary</item>
        <item name="android:textSize">14sp</item>
        <item name="android:gravity">center_vertical</item>
        <item name="android:paddingLeft">5sp</item>
    </style>

And I guess this is the final solution for those whom want to customize their 
"ListView"s (and the related separator). But I still can't understand why this 
occurs when the build/packaging platform is not the same as the deployment one. 
Hope someone from Android engineering team answers me.

Best Regards,
Armond



----- Original Message ----


> > 

3. Persisting a context menu after screen rotation

4. No rule to make target 'iso_img'

5. OMX component registration

6. How do I package a shared Java library?

7. Curhat... ;-)