not able to play file when set data source to the sdcard file

by Honest » Mon, 13 Apr 2009 17:55:06 GMT


Sponsored Links
 Hello,
I am trying to play file which is stored in SDCARD in emulator. I have
Linux O/S. So i need to provide command in run configuration.

I am providing following parameter.

-sdcard /usr/android/sdcard/mysdcard.iso -audio oss
[i]

The following is my code to play file.

try
{
mMediaPlayer.setDataSource("/sdcard/test_cbr.mp3");
mMediaPlayer.prepare(); // Giving error.
mMediaPlayer.start();

}
catch(Exception e)
{
System.out.println("exception="+e.toString());
}



It is giving me error when i am calling prepare(). Cans some one tell
me what could be wrong in it ? Am i using wrong separator in run
configuration ?


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



not able to play file when set data source to the sdcard file

by Nithin » Mon, 13 Apr 2009 20:10:22 GMT


 Hi,


Normally, this error occurs, when you didnt put sdcard in emulator.
Launch emulator with SDCard. You put the .mp3 file in "data/misc"
folder and try, if its working then the problem is launch emulator
with SDCard only..

Thanks
Nithin
nithinwarier.blogspot.com
--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


not able to play file when set data source to the sdcard file

by Honest » Mon, 13 Apr 2009 21:30:51 GMT


 Thanks nitin for your quick reply. From you suggestion i solved my
problem but i am not geting why it is not able to access file from
sdcard even if the file is available there so there should be
something wrong in it. I also added the command line paramiter which i
am passing so please take a look and let me know if you found
something wrong in it.



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



Other Threads

1. If I want to dynamically display graphics or text in layout, can I still use xml or I have to hard code?

As per subject, any idea?

Many thanks.

-- 

2. RSS feed by HttpURLConnection - html issue

I would like to read RSS feed by following coding:

        /** Get data from the list feed */
        private void GetListFeed() {
                // Get the XML
                URL url;
                try {
                        String ListFeed = getString(R.string.rss_blog);

                        url = new URL(ListFeed);

                        URLConnection connection = url.openConnection();

                        HttpURLConnection httpConnection = (HttpURLConnection) 
connection;
                        httpConnection.setReadTimeout(5000);

                        int responseCode = httpConnection.getResponseCode();

                        if (responseCode == HttpURLConnection.HTTP_OK) {

                                InputStream in = 
httpConnection.getInputStream();

                                DocumentBuilderFactory dbf = 
DocumentBuilderFactory
                                                .newInstance();
                                DocumentBuilder db = dbf.newDocumentBuilder();

                                // Parse the feed.
                                Document dom = db.parse(in);
                                Element docEle = dom.getDocumentElement();

                                // Get a list of each entry.
                                NodeList nl = 
docEle.getElementsByTagName("item");
                                if (nl != null && nl.getLength() > 0) {
                                        int k = nl.getLength();

                                        for (int i = 0; i < k; i++) {
                                                Element entry = (Element) 
nl.item(i);

                                                        Element title = 
(Element) entry
                                                                        
.getElementsByTagName("title").item(0);

                                                        Element description = 
(Element) entry
                                                                        
.getElementsByTagName("description")
                                                                        
.item(0);;

                                                        strTitle = 
title.getFirstChild().getNodeValue()
                                                                        
.trim().toString();

                                                        strDescription = 
description.getFirstChild()
                                                                        
.getNodeValue().trim().toString();



                                                }

                                        }
                                }

                        }
                } catch (MalformedURLException e) {
                        e.printStackTrace();
                } catch (IOException e) {
                        e.printStackTrace();
                } catch (ParserConfigurationException e) {
                        e.printStackTrace();
                } catch (SAXException e) {
                        e.printStackTrace();
                } finally {
                }
        }

However, it description contains html symbol, such as <br />, it will
stop read and display any thing before it.
For example: abc defg hi <br /> jkl mn opq
At android device, it will shows "abc defg hi" only.

I would appreciate if you guys can help me solve this issue. .....



-- 

3. wifi - dhcpcd gateway dsn1 dsn2 server address are getting 0.0.0.0

4. How can get the latest version of google apks (market ,gmail ,yotube)

5. Kompetisi Ide Aplikasi Untuk Acer Liquid

6. Ternyata sinyal iphone 4 lancar jayaaa

7. Is it possible to get sensor data at regular intervals?