launching m3u playlist with intent

by Seb » Sun, 16 Aug 2009 21:11:31 GMT


Sponsored Links
 Hi,

Is there a way to launch a playlist whith intent?

I can retrieve the path of the m3u playlist with:
Cursor cursor = context.getContentResolver().query
(MediaStore.Audio.Playlists.EXTERNAL_CONTENT_URI, null, null, null,
null);
cursor.getString(cursor.getColumnIndex
(MediaStore.Audio.Playlists.DATA));

But, I can't launch this m3u file neither with Intent nor with
MediaPlayer.

Is there a way to do this?

Thanks in advance


--~--~---------~--~----~------------~-------~--~----~



launching m3u playlist with intent

by Marco Nelissen » Mon, 17 Aug 2009 03:23:56 GMT


 


No.


--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


launching m3u playlist with intent

by Marco Nelissen » Mon, 17 Aug 2009 03:30:16 GMT


 Well, OK, that's not entirely true. While you can't play an arbitrary
m3u file, you can play playlists that are in the database (which may
have come from m3u files originally, in which case there path is in
the _data column).
To see how, you can look at what happens when you put a shortcut to a
playlist on the home screen and then launch it.







--~--~---------~--~----~------------~-------~--~----~



launching m3u playlist with intent

by Seb » Mon, 17 Aug 2009 21:36:13 GMT


 Hi Marco,

Thank you very much for the response. You give me the key to find the
solution.

I had to study the code of PlaylistBrowserActivity to find the
solution.

I give it here if someone else search the solution:
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setComponent(new ComponentName
("com.android.music","com.android.music.PlaylistBrowserActivity"));
intent.setType(MediaStore.Audio.Playlists.CONTENT_TYPE);
intent.setFlags(0x10000000);
intent.putExtra("oneshot", false);
intent.putExtra("playlist", playlistid);
startActivity(intent);

and to retrieve the playlistid:
Cursor cursor = getContentResolver().query
(MediaStore.Audio.Playlists.EXTERNAL_CONTENT_URI, null, null, null,
null);
if (cursor != null) {
 if (cursor.moveToFirst()) {
  do {
     playlistid = cursor.getString(cursor.getColumnIndex
(MediaStore.Audio.Playlists._ID));
     playList.add(playlist);
     } while (cursor.moveToNext());
     cursor.close();
 }
}







--~--~---------~--~----~------------~-------~--~----~



launching m3u playlist with intent

by hav...@gmail.com » Fri, 11 Sep 2009 16:12:32 GMT


 Awesome. I love you! :)
This was just what I was looking for.







--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. How to Add new sensor support in Android sensor framework?

Hi Guys,

Can some one please point me towards any documentation/resources/
threads that can explain how a new sensor support can be added in
android sensor framework? I'll be grateful for your help in this
regard.


Kind Regards
Leo

-- 

2. How to execute code before exiting application

I would like to know how to execute code before exiting application.

My application is composed of several activities. When the user starts
the application (from the launcher menu or from a notification in the
status bar), he goes in an InitActivity where I process some
initializations. From user experience, application always restarts.

One of these initializations is to init a network manager and start a
thread that periodically sends a network request to notify a server
that application is active.

I need to process some end operations, like stopping this thread when
user quits application, for example by pressing the HOME key or BACK
key when he's in the root activity.

However, when the user press the HOME key, application is still
running in background.


Here are my questions :

Q1 : is it possible to execute code when exiting application (I see
the onTerminate() method of the class Application but it seems not to
be always called) ?

Q2 : Is it possible to force application exit (activity method finish
() only destroy the current activity, not the application) ?

Q3 : Is it possible to handle HOME key press (onKeyDown() is not
called when this button is pushed) ?

Thanks for your help.

-- 

3. Using MacOS X, Eclipse for Android development

4. Unable to debug Hello World Example

5. Tricorder app code download

6. ring app crash when using telephony manager to listen for calls

7. ssl.SSLException Not trusted server certificate httpclient