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. why I can not use ksoap with web service

I use ksoap with web service in Andrid.
java code:

package com.WsReader;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Button;

// ksoap2 import
import org.ksoap2.SoapEnvelope;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.AndroidHttpTransport;
import org.ksoap2.serialization.PropertyInfo;

public class WsReader extends Activity {

        private static final String SOAP_ACTION = "http://tempuri.org/
HelloWorld";//"AddIntegers";
    private static final String METHOD_NAME =
"HelloWorld";//"AddIntegers";
    private static final String NAMESPACE = "http://tempuri.org/";
    private static final String URL = "http://192.168.100.123/
AsapWebRun/AsapService/wf.asmx";//"http://wiki.tuxpan.com:8069/axis2/
services/Simple";

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setTheme(android.R.style.Theme_Dialog);
        setContentView(R.layout.main);

        // cmdCalculate button
        final Button cmdcal = (Button) findViewById
(R.id.cmdCalculate);
        cmdcal.setOnClickListener(new Button.OnClickListener(){
                public void onClick(View v){
                        ((TextView)findViewById(R.id.lblStatus)).setText("...
Invoking Web Service ...");
                        String 
stA=((EditText)findViewById(R.id.numberA)).getText
().toString();
                        String 
stB=((EditText)findViewById(R.id.numberB)).getText
().toString();
                        /*
                        Integer a=null;
                        Integer b=null;
                        try
                        {
                                a=Integer.valueOf(stA);
                                b=Integer.valueOf(stB);
                        }
                        catch(Exception ex){}
                        if(a==null || b==null){
                                
((TextView)findViewById(R.id.lblStatus)).setText("Only
Integer numbers please...");
                        }
                        */
                        // ksoap
                        SoapObject request=new 
SoapObject(NAMESPACE,METHOD_NAME);
                        /*
                        SoapObject inAddIntegers=new SoapObject
(NAMESPACE,"GetAuthorizationTicket");
                        inAddIntegers.addProperty("userID", stA);
                        inAddIntegers.addProperty("userPass", stB);
                        
request.addProperty("GetAuthorizationTicket",inAddIntegers);
                        */
                        SoapSerializationEnvelope envelope=new
SoapSerializationEnvelope(SoapEnvelope.VER11);
                        envelope.dotNet=true;
                        envelope.setOutputSoapObject(request);
                        AndroidHttpTransport androidHttpTransport=new
AndroidHttpTransport(URL);
                        try
                        {
                                androidHttpTransport.call(SOAP_ACTION, 
envelope);
                                Object result=envelope.getResponse();
                                ((TextView)findViewById(R.id.lblStatus)).setText
(result.toString());
                        }
                        catch(Exception ex){
                                
((TextView)findViewById(R.id.lblStatus)).setText("Error:
"+ex.getClass().getName()
                                                +":"+ex.getMessage());

                        }
                }
        });
    }// end of onCreate
}// end of class WsReader


=======================================

.net web service code:
---------------------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;


[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.None)]
// [System.Web.Script.Services.ScriptService]
public class wf : System.Web.Services.WebService
{

    public wf()
    {

    }

    [SoapRpcMethod(), WebMethod]
    public string HelloWorld()
    {
        return "Hello World";
    }
}

//////////////////////////////////////////////////////////////////////////////

when I run the application in emulator,It cannot successful.
then I write a normal java application

// ksoap2 import
import org.ksoap2.SoapEnvelope;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.AndroidHttpTransport;
import org.ksoap2.serialization.PropertyInfo;

public class WfReader
{
        private static final String SOAP_ACTION = "http://tempuri.org/
HelloWorld";//"AddIntegers";
    private static final String METHOD_NAME =
"HelloWorld";//"AddIntegers";
    private static final String NAMESPACE = "http://tempuri.org/";
    private static final String URL = "http://192.168.100.123/
AsapWebRun/AsapService/wf.asmx";//"http://wiki.tuxpan.com:8069/axis2/
services/Simple";

        public static void main(String[] args)
        {
                System.out.println("Hello World!");
                SoapObject request=new SoapObject(NAMESPACE,METHOD_NAME);
                /*
                SoapObject inAddIntegers=new SoapObject
(NAMESPACE,"GetAuthorizationTicket");
                inAddIntegers.addProperty("userID", stA);
                inAddIntegers.addProperty("userPass", stB);
                request.addProperty("GetAuthorizationTicket",inAddIntegers);
                */
                SoapSerializationEnvelope envelope=new SoapSerializationEnvelope
(SoapEnvelope.VER11);
                envelope.dotNet=true;
                envelope.setOutputSoapObject(request);
                AndroidHttpTransport androidHttpTransport=new 
AndroidHttpTransport
(URL);
                try
                {
                        androidHttpTransport.call(SOAP_ACTION, envelope);
                        Object result=envelope.getResponse();
                        System.out.println(result.toString());
                }
                catch(Exception ex){
                        System.out.println("errorquot;);
                        System.out.println(ex.getMessage());
                }
        }
}


=====================================
run it ,the error is:

Hello World!
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/
commons/httpclient/methods/RequestEntity
        at org.ksoap2.transport.AndroidHttpTransport.getServiceConnection
(AndroidHttpTransport.java:89)
        at org.ksoap2.transport.AndroidHttpTransport.call
(AndroidHttpTransport.java:38)
        at WfReader.main(WfReader.java:31)
Caused by: java.lang.ClassNotFoundException:
org.apache.commons.httpclient.methods.RequestEntity
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClassInternal(Unknown Source)
        ... 3 more


why?????????????

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

2. Trouble install adb driver on Vista 32-bit

I am trying to get the USB driver that is used by ADB installed on
Vista, 32-bit. (I downloaded this android_usb_windows.zip from the
developer site). The driver does not install, and this is the message
from Vista:

Windows found driver software for your device but encountered an error
while attempting to install it.
- HTC Dream Composite ADB Interface.
Access is denied.

Is anybody else facing this problem. I have tried on 3 different
computers all running Vista, with the same results. I do not have a
computer running XP at hand.

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

3. Strong type R.drawable

4. Reuse Drawables

5. running native program on android

6. Error in AndroidManifest.xml and some other xml files

7. how to emulate sim card in emulate tools