Android customizing ViewFlipper...
Posted
by wearysamurai
on Stack Overflow
See other posts from Stack Overflow
or by wearysamurai
Published on 2010-06-13T20:53:51Z
Indexed on
2010/06/13
21:02 UTC
Read the original article
Hit count: 489
So I'm having pretty much exactly the problem described here:
http://code.google.com/p/android/issues/detail?id=6191
and until the ViewFlipper issue in 2.1 and 2.2 has been resolved, I'm attempting to customize my own ViewFlipper in the manner described:
@Override
protected void onDetachedFromWindow() {
try {
super.onDetachedFromWindow();
}
catch (IllegalArgumentException e) {
// Call stopFlipping() in order to kick off updateRunning()
stopFlipping();
}
}
But I've never done this sort of thing before and am hoping to get a little guidance (as my own efforts are coming up short).
Here's what I have so far.
FixedFlipper.java:
import android.content.Context;
import android.util.AttributeSet;
import android.widget.ViewFlipper;
public class FixedFlipper extends ViewFlipper{
public FixedFlipper(Context context){
super(context);
}
public FixedFlipper(Context context, AttributeSet attrs){
super(context, attrs);
}
@Override
protected void onDetachedFromWindow(){
try{
super.onDetachedFromWindow();
}catch(Exception e){
super.stopFlipping();
}
}
}
main.xml:
<com.site.TestApp.FixedFlipper
style="@style/body" android:id="@+id/flipper">
...
</com.site.TestApp.FixedFlipper>
And in my activity, I invoke it like so:
FixedFlipper flipper = (FixedFlipper)findViewById(R.id.flipper);
It seems like it should be pretty straightforward, but I keep getting this:
Binary XML file line #4: Error inflating class com.site.TestApp.FixedFlipper
I appreciate any suggestions. I've been chasing my tail for hours trying to figure out what piece of the puzzle I'm missing.
© Stack Overflow or respective owner