AudioManager, requestAudioFocus and video playback...

by sdphil » Fri, 14 Jan 2011 03:12:09 GMT


Sponsored Links
 Hi,

On Android 2.2.1, I am seeing a behavior I don't understand.  I am
making a call to requestAudioFocus()

mAudioManager.requestAudioFocus(mAudioFocusChangeListener,
AudioManager.STREAM_MUSIC, AudioManager.AUDIOFOCUS_GAIN);

So that when another media player takes over the audio, I can pause my
own audio playback.  If i use the music player, this works great.
However, when I try to play a video, I don't get the call in my focus
change listener.  Any ideas on why?

tia.

-- 



Re: AudioManager, requestAudioFocus and video playback...

by sdphil » Sat, 15 Jan 2011 23:39:59 GMT


 ping




-- 


Sponsored Links


Re: AudioManager, requestAudioFocus and video playback...

by sdphil » Thu, 20 Jan 2011 03:02:45 GMT


 ping.  anybody?  anybody?





-- 



Other Threads

1. IndexOutOfBoundsException when I call stopManagingCursor in an OnItemSelectedListener

Activity.performStop() contains the following loop (around line 3394
in the 1.0 SDK release and at
http://android.git.kernel.org/?p=platform/frameworks/base.git;a=blob;f=core/java/android/app/Activity.java;h=4dc4b6a48b85f9caad4234b8e29fafdc9260840c;hb=HEAD#l3504):

            final int N = mManagedCursors.size();
            for (int i=0; i<N; i++) {
                ManagedCursor mc = mManagedCursors.get(i);
                if (!mc.mReleased) {
                    mc.mCursor.deactivate();
                    mc.mReleased = true;
                }
            }

In my app, mc.mCursor.deactivate() calls (indirectly)
SimpleCursorAdapter.notifyDataSetInvalidated(), which calls
(indirectly) AdapterView.fireOnSelected(), which calls my
OnItemSelectedListener, which calls stopManagingCursor(), which
reduces the size of mManagedCursors, which makes the ArrayList.get()
call throw on the next iteration.

I'm calling stopManagingCursor to avoid the crash described at <http://
groups.google.com/group/android-developers/browse_thread/thread/
f6fabc180e8b517a/c04691d80f1e9135?lnk=gst&#c04691d80f1e9135> (and a
few other posts you can find by searching this group for
"SQLiteClosable").

I suspect this is a bug in Activity.performStop, which shouldn't
assume mManagedCursors is constant through a call to a user-provided
callback. Until the Android developers can fix the bug, I'm looking
for a workaround. Should I just abandon managed cursors, which don't
seem to work well with CursorAdapters? Is there a good way to prevent
my OnItemSelectedListener from being called during performStop()? Any
other ideas?

Thanks,
Jeffrey
--~--~---------~--~----~------------~-------~--~----~

2. know the architec

hi guys to know the
architec<http://architecdetail.blogspot.com/>
   * know the architec *

--~--~---------~--~----~------------~-------~--~----~
unsubscribe: android-porting+unsubscr...@googlegroups.com
website: 

3. IndexOutOfBoundsException when I call stopManagingCursor in an OnItemSelectedListener

4. Why do I sometimes get a null return, from ContentResolver query?

5. Bitmap is recycled but I didn't do it?

6. What's the trick to making ProximityAlerts work?

7. What's the trick to making ProximityAlerts work?