[android-developers] Re: Custom checkable view
Ok, problem solved after having looked at the source of the CheckedTextView. I had to override the onCreateDrawableState and drawableStateChanged methods and it now works. On 5 nov, 15:30, Marc Poppleton marc.popple...@gmail.com wrote: Hi there, I'm writing a little custom view which can be in two states : checked, not checked. According to the state it is in, it's background changes. Quite straightforward sort of behavior. My class extends FrameLayout and implements the Checkable interface. In my toogle method I just calls the setChecked method with a boolean corresponding to the new state. My setChecked method simply sets a mChecked boolean and calls the refreshDrawableState method. Pressing the view should then toggle it back and forth between the states check, unchecked. The background of the FrameLayout is given a StateListDrawable in which I've defined a drawable item for the following states : state_pressed, state_focused, state_checked=true, state_checked=false. When I press my custom view, the background changes all right back and forth between the state_pressed=true and state_checked=false items. But state_checked=true is never called. What am I doing wrong? Thank you for your help, Marc -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Custom checkable view
Hi there, I'm writing a little custom view which can be in two states : checked, not checked. According to the state it is in, it's background changes. Quite straightforward sort of behavior. My class extends FrameLayout and implements the Checkable interface. In my toogle method I just calls the setChecked method with a boolean corresponding to the new state. My setChecked method simply sets a mChecked boolean and calls the refreshDrawableState method. Pressing the view should then toggle it back and forth between the states check, unchecked. The background of the FrameLayout is given a StateListDrawable in which I've defined a drawable item for the following states : state_pressed, state_focused, state_checked=true, state_checked=false. When I press my custom view, the background changes all right back and forth between the state_pressed=true and state_checked=false items. But state_checked=true is never called. What am I doing wrong? Thank you for your help, Marc -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] DialterFilter, what does this widget do?
Hi all, Browsing in the API I've stumbled upon the DialerFilter widget. Since I can't find much documentation about how to us it, let alone know what it does, I tried to use it in a little app just to see what comes out. I keep getting a IllegalStateException in the Layout builder about the DialterFilter needing a child EditText named hint. Looking at the source of the DialterFilter class I can see that the widget is indeed waiting for a EditText named hint, but not in my R.class but in the R.android.internal class. So adding a EditText named id+/hint in my layout XML file won't solve the problem. So how can I solve this problem? Would it be that DialterFilter is a private widget that we can't use but happens to be in the API documentation? I'm trying to build a clone of the Sense dialer (keypad at the bottom part of the screen, filtered contact list at the top part of the screen) and, according to its name, DialterFilter sounds like what I'm looking for. Thanks for you help, Marc -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Animating the background of a LinearLayout
Hello, Is there a way of being notified when a TransitionDrawable has finished its transition? I'm looking for a way to animate the background of a LinearLayout, switching it back and forth between two images thus creating a pulsating effect. TransitionDrawable works nicely, butonce. I tried stacking several 'item' in the XML defining the transition, but no luck. It justs fades from item 1 to item 2 and sits there. I'm wondering if I shouldn't implement a custom Animation. Any ideas? Thanks :) FYI : target platform is 1.5 -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Animating the background of a LinearLayout
Thanks, I'll see what I can do with a custom Drawable. On 27 avr, 12:53, skink psk...@gmail.com wrote: Marc Poppleton wrote: Hello, Is there a way of being notified when a TransitionDrawable has finished its transition? I'm looking for a way to animate the background of a LinearLayout, switching it back and forth between two images thus creating a pulsating effect. TransitionDrawable works nicely, butonce. I tried stacking several 'item' in the XML defining the transition, but no luck. It justs fades from item 1 to item 2 and sits there. yes, TransitionDrawable fades in/out two Drawables and you cannot make it work in repeat mode I'm wondering if I shouldn't implement a custom Animation. i would implement custom Drawable instead Any ideas? Thanks :) FYI : target platform is 1.5 -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group athttp://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Problem Starting New Activity
Hi, Where is the PHONE_STATE_CHANGED Intent defined? I can't find it anywhere in the documentation and am in a situation similar to Bnet's. I'm trying to get my Activity to pop-up when an incoming call occurs, I don't like the default view and want my own instead (I wish to display extra data about the callee than currently displayed). Thanks, Marc On 3 mar, 20:25, Marco Nelissen marc...@android.com wrote: On Tue, Mar 3, 2009 at 9:09 AM, Bnet tcb...@gmail.com wrote: I'm trying to call the SoundNotification.java from the PhoneStateListenerto test a default system notification sound. When a missed call state is true, the SoundNotification.java is called to play the sound or beep. I understand your point about the receiver dropping thephonestatelistenerand appreciate the feedback. Thanks again. OK, so it sounds like *what* you want to do (your MyPhoneStateListener and SoundNotification classes are part of *how* you want to do it) is to play a sound when a call is missed. So first you need to figure out if a call is missed. There are a number of ways to do that. You were trying to do this by using aPhoneStateListener, which is fine, but I don't think you actually need it. You already have a receiver for the PHONE_STATE_CHANGED Intent broadcast, and that Intent already contains an 'extra' that tells you the current state, so you shouldn't need to set up aPhoneStateListener. Then, since you're determining whether a call was missed by idle-ringing-idle transitions, you'll need some place to store the intermediate states, so that when the call state goes to idle again, you can check whether the previous state was offhook, and if not, play the sound. You could use a Service to keep track of the intermediate states, but a simpler solution might be to store/retrieve the previous state using a SharedPreference. However you want to do it is up to you, but you shouldn't rely on the broadcast receiver itself keeping any state for you. Once you've determined that a call was missed, you play the sound, probably using MediaPlayer. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---