[android-developers] Re: MediaPlayer suddenly stopped working in Android 4.2

2013-02-14 Thread Alex Lockwood
The emulated directory you see in the pathname doesn't mean he is using 
the emulator. This directory structure was modified in API 17 due to the 
addition of multiuser support.

I'm having the same problem... trying to figure it out now.

On Thursday, February 14, 2013 3:46:37 PM UTC-5, bob wrote:

 Have you tried it on a real device or just the emulator?



 On Thursday, February 14, 2013 11:38:22 AM UTC-6, Brill Pappin wrote:

 I've been working on an app that plays MP3 files and have started with 
 out with the lowest supported android version and working upward toward JB.

 For some reason the MediaPlayer starts generating an error in Android 4.2 
 when it has been working just fine until now.
 Nobody seems to know what has changed or how to work around it. The only 
 suggestions I've found so far are to do with permissions, but unless they 
 have changed radically for external storage, the MediaPlayer should have 
 permission to read the files.

 Here is some relevant information. Notice there is no stack trace, just a 
 message printed out.
 (I've included some of my debugging output for reference).

 02-14 12:24:05.210: I/MessageListFragment(29567): *** FILE [exists:true]: 
 file:///storage/emulated/0/Android/data/com.primaltech.vvm/files/audio/V2013011508.mp3
 02-14 12:24:06.001: D/MessageListFragment(29567): Local data file: id=1, 
 rid=V2013011508, 
 uri=file:///storage/emulated/0/Android/data/com.primaltech.vvm/files/audio/V2013011508.mp3
 02-14 12:24:06.001: D/MessageListFragment(29567): Preparing to play: 
 file:///storage/emulated/0/Android/data/com.primaltech.vvm/files/audio/V2013011508.mp3
 02-14 12:24:06.011: E/MediaPlayer(29567): error (1, -2147483648)
 02-14 12:24:06.051: E/MediaPlayer(29567): Error (1,-2147483648)
 02-14 12:24:06.051: E/MessageListFragment(29567): what: 
 MediaPlayer.MEDIA_ERROR_UNKNOWN

 So far I have seen this on both a Nexus 7 and a Nexus 4 running JB 4.2.1, 
 it seems to work fine for the prior versions that I've been able to test 
 (4.0.4, 4.1.1).






-- 
-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
Android Developers group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [android-developers] Re: LoaderCallbacks.onLoadFinished unnecessarily called twice when rotating

2012-07-08 Thread Alex Lockwood
It might be because onQueryTextChange is being called on orientation 
changes... so restartLoader is called each time, thus resulting in two 
calls to onLoadFinished. I haven't tested this, but I suspect it is the 
problem here. I forgot my USB cable at work but I'll try to remember to 
test it out. I doubt it is a bug though... it seems like the last 
LoaderManager bug should have been squashed a long time ago, given that it 
has been over a year since HoneyComb's release.

Alex

On Monday, July 2, 2012 4:49:50 PM UTC-4, Malcolm Evershed wrote:

 Your issue sounds like it could be different than mine since I'm generally 
 seeing onLoadFinished() called in initLoader(). You might want to do more 
 web or StackOverflow searching or search the Android bug database -- I 
 think somewhere I read about a problem where onLoadFinished() would not be 
 called, but I think it only happens if you don't do the stuff that 
 CursorLoader does. In other words, to solve your issue, you might have to 
 copy a bunch of code from CursorLoader.

 As to my issue, I never reported it since there didn't seem to be any 
 interest in it. I just worked around it in my app.

 Thanks.

 On Mon, Jul 2, 2012 at 5:17 AM, szakalinhoPL szakali...@gmail.com wrote:

 Hi, I noticed same situation,  I'm not an expert but it seems like a bug 
 because behaviour of onLoadFinished is not normal according to 
 documentation which says that onLoadFinished should be called in 
 initLoader, but it never does. In very simple application it happens as 
 well. Did you report it or find out an answer?


 On Wednesday, April 11, 2012 11:05:41 PM UTC+1, Malcolm Evershed wrote:

 *[My apologies if this is posted twice, it has been a few days and my 
 original post didn't show up yet, so I'm attempting to post again]*


 I think I've found an issue where LoaderManager.LoaderCallbacks**D.*
 onLoadFinished*() will be called unnecessarily twice when rotating the 
 device. *Is this expected behavior or should I open a bug?*

  

 This can easily be reproduced by running *ApiDemos *- *App *- *Loader 
 *- *Cursor *(which corresponds to the *LoaderCursor.java* example) and 
 rotating the device.

  

 1) Here's the first location where onLoadFinished() is called:

  

 LoaderCursor$**CursorLoaderListFragment.**onLoadFinished(Loader, 
 Cursor) line: 159

 LoaderCursor$**CursorLoaderListFragment.**onLoadFinished(Loader, 
 Object) line: 1

 LoaderManagerImpl$LoaderInfo.**callOnLoadFinished(Loader, Object) line: 
 438

 *LoaderManagerImpl$LoaderInfo.reportStart() line: 318 *   

 LoaderManagerImpl.**doReportStart() line: 778

 LoaderCursor$**CursorLoaderListFragment(**Fragment).performStart() 
 line: 1534

 FragmentManagerImpl.**moveToState(Fragment, int, int, int) line: 
 862

 FragmentManagerImpl.**moveToState(int, int, int, boolean) line: 
 1032

 FragmentManagerImpl.**moveToState(int, boolean) line: 1014

 FragmentManagerImpl.**dispatchStart() line: 1771

 *LoaderCursor(Activity).performStart()* line: 4481

 ActivityThread.**performLaunchActivity(**ActivityThread$**ActivityClientRecord,
  
 Intent) line: 1929

 ActivityThread.**handleLaunchActivity(**ActivityThread$**ActivityClientRecord,
  
 Intent) line: 1981

 ActivityThread.**handleRelaunchActivity(**ActivityThread$**ActivityClientRecord)
  
 line: 3351

 ActivityThread.access$700(**ActivityThread, 
 ActivityThread$**ActivityClientRecord) 
 line: 123

 ActivityThread$H.**handleMessage(Message) line: 1151

 ActivityThread$H(Handler).**dispatchMessage(Message) line: 99

 Looper.loop() line: 137

 ActivityThread.main(String[]) line: 4424

 Method.invokeNative(Object, Object[], Class, Class[], Class, int, 
 boolean) line: not available [native method]

 Method.invoke(Object, Object...) line: 511

 ZygoteInit$**MethodAndArgsCaller.run() line: 784

 ZygoteInit.main(String[]) line: 551

 NativeStart.main(String[]) line: not available [native method]

  

 Basically, as the Activity is starting up, *Activity.performStart*() 
 calls mFragments.dispatchStart() which eventually calls 
 Fragment.performStart(), which then calls mLoaderManager.doReportStart()
 **. Ultimately, *LoaderManagerImpl$LoaderInfo.reportStart*() checks if 
 the loader has been started and whether *mReportNextStart *is set (it 
 was set when Fragment.performDestroyView() was called on the old fragment) 
 and then it'll call onLoadFinished().

  

 2) Here's the second location where onLoadFinished() is called during 
 the same rotation:

  

 LoaderCursor$**CursorLoaderListFragment.**onLoadFinished(Loader, 
 Cursor) line: 159

 LoaderCursor$**CursorLoaderListFragment.**onLoadFinished(Loader, 
 Object) line: 1

 LoaderManagerImpl$LoaderInfo.**callOnLoadFinished(Loader, Object) line: 
 438

 *LoaderManagerImpl$LoaderInfo.finishRetain() line: 

[android-developers] When should I have more than one fragment implement LoaderManager.LoaderCallbacksCursor?

2011-12-26 Thread Alex Lockwood
I am having a difficult time figuring out which fragments in my
application should and should not be implementing
LoaderManager.LoaderCallbacksCursor. Under what circumstances should
I have a fragment implement these callback methods, as opposed to, for
example, simply fetching data with a ContentProvider?

For example, say I wanted to write an app for Android Tablets that
consists of two Fragments: 1) a ListFragment that displays a list of
people (left side of screen), and 2) a Fragment that displays the
selected person's information (right side of screen). Assume that the
first ListFragment implements all of the callback methods correctly
and that all of the data is stored in the same database. Should the
second Fragment implement the callback methods as well, or is it
sufficient to perform a query within the ListFragment class and pass
it along to the second Fragment when a list item is selected? What's
the difference?

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