The file extension and read per mission issue Hi, I am in the problem about reading data fr om some new file extensions, the problem is fis.read() gets -1 from the first run wit

by 100town » Sat, 24 Oct 2009 19:39:16 GMT


Sponsored Links
 Hi,

I am in the problem about reading data from some new file extensions,
the problem is fis.read() gets -1 from the first run without and
exceptions being thrown. Check the code below:
String path = sdcard/wanshuiqianshan.lrc
java.io.FileInputStream fis = null;
                try{
                        fis= new java.io.FileInputStream(path);
                        int c=0;
                        StringBuffer sb=new StringBuffer();
                        while(((c=fis.read())!=-1)){
                                sb.append((char)c);
                        }
                        Log.e("INFO", "Here 1;
                        return sb.toString();
                }catch(Exception ioe){
                        Log.e("EROOR", "file: "+path, ioe);
                        return null;
                }finally{
                        try{
                                fis.close();
                        }catch(Exception e){
                        }
                }
If I change the file extension to xt everything is all right. I
debugged into the android source then the code running into the native
C code so not any clue was found.

I searched in the group. Only some discuss leads to the cycle about
mime-type and file extensions which cannot help me.
I guess it is a build-in security mechanism about the undefined file
extension types. Can anybody help? Thanks.


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



Other Threads

1. IDE for Android

Hi,

Is there an IDE for android with which I can build the entire source
code of android and flash it on to my target board? I mean something
like Microsoft Visual Studio, with which we can build and flash binary
images for Windows CE.

Thanks,
RD.

-- 

2. To add an footer ImageView on a layout having ScrollView and relative layout

Hi every one,

I have an query that, if I add an image view by align parent then  it
sticks to ScrollView not to relative layout. My layout xml is as
follow

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
android:layout_height="fill_parent"
        android:id="@+id/dealScroll" android:background="@drawable/
whiteBackground"
        android:scrollbarFadeDuration="3000"
        android:scrollbarDefaultDelayBeforeFade="2000"
android:fadeScrollbars="true">

        <RelativeLayout android:layout_width="fill_parent"
                android:layout_height="fill_parent" 
android:id="@+id/dealRelative">

<Button android:layout_alignParentLeft="true"
                        android:id="@+id/merchantLocationButton"
                        android:layout_width="wrap_content"
android:layout_height="wrap_content"
                        android:layout_margin="5dp" 
android:background="@drawable/
merchant_loc_button"></Button>
                <Button android:layout_alignParentRight="true"
                        android:id="@+id/descriptionButton"
                        android:layout_width="wrap_content"
android:layout_height="wrap_content"
                        android:layout_margin="5dp"    
android:background="@drawable/
description_button"></Button>
                <ImageView android:src="@drawable/footer" 
android:scaleType="fitXY"
                        android:layout_alignParentBottom="true"
android:layout_width="fill_parent"
                        android:layout_height="wrap_content"></ImageView>

        </RelativeLayout>
</ScrollView>


What I am missing? plz help.

Thanks in adv
Sapna

-- 

3. invisible part of layout

4. setuid does not work - what am I doing wrong?

5. Kernel source for Telechips based tablets?

6. Drawing a scaled path without scaling the stroke width

7. does stagefright support subtitle and how to support subtitle in android