Display TextFile

by perumal316 » Thu, 21 Jan 2010 10:36:11 GMT

Sponsored Links

Suppose I have a text file in /data folder, is there any way I can
display the textfile to user through an app?

Thanks In Advance,

Display TextFile

by TreKing » Fri, 22 Jan 2010 00:05:56 GMT


Sure. If you want to do this yourself, just read the contents of the file
and dump it to a TextView or something you can show in an Activity or a

If you want to use a separate app, create an Intent with a URI created from
the path to the file and call startActivity with that Intent. The user can
then choose which app to use to open the file, of the ones that are capable
of handling that file type.

TreKing - Chicago transit tracking app for Android-powered devices

Sponsored Links

Display TextFile

by perumal316 » Fri, 22 Jan 2010 10:10:40 GMT

 Yah I have tried using TextView but I am getting blank screen. Is it
correct to use the following code to access the file in /data

File file = new File(Environment.getDataDirectory(),"/data/

After which I did the reading by line and displaying using TextView
but getting blank screen



Display TextFile

by TreKing » Sat, 23 Jan 2010 03:45:13 GMT


Not really, use openFileInput() (I think that's the name, should be
something like that) to get an InputStream. Write out what you're getting
from the stream to the log to make sure the reading is successful before
trying to show it in the TextView.

TreKing - Chicago transit tracking app for Android-powered devices


Other Threads

1. About GPS Support on Android

Hi All,

I have couple of things to clarify:

1. What are the GPS Applications currently part of Android ?

2. As on Emulator , I am not able to run maps applications as there is no
GPS Driver and hardware connected. How can I use google maps on emulator ?

3. Providing GPS HAL interface gps_get_hardware_interface will be sufficient
to connect GPS Drive with Application Framework and upper application in
Android ?

4. Is there any basic test application for GPS on Android ? not necessary
maps kind of application.

Any more information related to GPS on Android is welcome.


_-_Mayank Rana_-_


2. Can't retrieve page with HttpClient

Have a weird problem - I'm trying to read a page from my web site but
for some reason it just can't find it.  I can navigate to my page in a
browser no problem but if I use the same URL in HttpClient I get the
404 (File not found) from my host service. Any clues?

Here is the code I use - seems pretty straightforward

        HttpClient client = new DefaultHttpClient();
        HttpGet getMethod = new HttpGet(strURL);
        try {
                HttpResponse response = client.execute(getMethod);
                Log.d(LOG_TAG, "Response Code " + Integer.toString
                        Log.d(LOG_TAG, "WTF - 404");

                String res = EntityUtils.toString(response.getEntity());
                Log.d(LOG_TAG, res);

3. need android source code

4. Amazon MP3 Intent URI

5. SQLite database samples

6. Android & J2ME project

7. Getting File Descriptor For Pipe