can't read mp3 file from sdcard

by zeeshan » Thu, 05 Mar 2009 17:53:23 GMT


Sponsored Links
 Hi Mates,

i am trying to write mp3 file in OutputStreamWriter.

here is the code:

String fileName="/sdcard/test_cbr.mp3";

byte [] buffer = new byte[1024*4];
int bytesRead = 0;

FileInputStream is = new FileInputStream(fileName);

// everything fine untill here

while( (bytesRead = is.read(buffer)) > 0) { // while condition is
false
                    wr.write(buffer,0,bytesRead);
                    wr.flush();
                }


it can access the file and makes the FileInputStream object but cann't
read. it doesn't go in While loop

any solution?

Thanks

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



can't read mp3 file from sdcard

by zeeshan » Thu, 05 Mar 2009 19:52:59 GMT


 its working now!
actually it was read permission problem.



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


Sponsored Links


Other Threads

1. layout issue......??

Hi all

I want to make a screen such that all time the data coming through
database need to be fixed in pre-designed pattern,
 i mean i have designed a layout(the code is given below)and in this
layout i want to fix the data  that i getting from database and the
data to be added in view should be increased automatically.

through coding i can set the data from database to the desired
position ...but how the no. of positions should be increased (these
positions should be same as previous one which i have created in
layout)...

i dont want to implement the list view......
simple page is fine.....


can anyone help me out


//CODE for xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/
android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >

<TextView
                android:id="@+id/name"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:textAppearance="?android:attr/textAppearanceMedium"
                android:background = "#99F0FFFF"
        android:layout_marginTop="30dip"
        android:text = "   Date n Time."
         android:layout_centerHorizontal="true"/>
 <TableLayout   xmlns:android="http://schemas.android.com/apk/res/
android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:id = "@+id/TableLayout_1"
    android:layout_below = "@+id/name"
    android:layout_marginTop="10dip">

 <TableRow android:layout_marginRight="10dip">
 <ImageView

        android:id="@+id/image"
        android:layout_marginLeft="10dip"
        android:layout_marginTop="10dip"
        android:layout_alignParentLeft="true"
        android:layout_width="70dip"
        android:layout_height="70dip"

 />
 <TextView
            android:id = "@+id/textRightToImage"
                android:layout_height="wrap_content"
                android:textAppearance="?android:attr/textAppearanceMedium"
                android:text = "...."
                android:layout_marginLeft="10dip" 
android:layout_marginTop="10dip"
android:layout_marginRight="20dip" android:layout_width="220dip"/>
 </TableRow>
</TableLayout>




</RelativeLayout>

//CODE
--~--~---------~--~----~------------~-------~--~----~

2. a problem occurs when uninstall preinstalled APIDemo of SDK following the way of troubleshooting

i met a problem when i am following " I can't install ApiDemos apps in
my IDE because of a signing error" according to
http://code.google.com/intl/zh-CN/android/kb/troubleshooting.html#apidemosreinstall.
I changed  the directory to sdk root as it said, and tried to
uninstall the preinstalled APIDemo, and after the command
./adb uninstall com.android.samples
 the screen prints :
DDM dispatch reg wait timeout
Can't dispatch DDM chunk 52454151: no handler defined
Can't dispatch DDM chunk 48454c4f: no handler defined
Failure

I guess it may be relevant to DDM, but I don't know where the exact
false locates. I am using Eclipse under ubuntu 8.10
--~--~---------~--~----~------------~-------~--~----~

3. Service permission and AndroidManifest.xml errors

4. ExpandableListAdapter problem

5. Skinning a Spinner

6. Adding native library to SDK

7. How to clear a notification when using a PendingIntent?