Display TextFile

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


Sponsored Links
 Hi,

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,
Perumal



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
Dialog.

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
 http://sites.google.com/site/rezmobileapps/treking 


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
directory?

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

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

Regards,
Perumal






--



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
 http://sites.google.com/site/rezmobileapps/treking 

--



Other Threads

1. how to add some key actions from physical keyboard to androi

The G1 keyboard doesn't have those keys.






-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

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

2. Compiling against a *REAL* android.jar in eclipse???

Don't do that.  If you aren't writing an app but system code, use the
platform build system.

On Mon, Apr 27, 2009 at 7:29 PM, Peter Carpenter <





-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

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

3. PDF Documentation

4. Please unsubscribe joesensp...@gmail.com Was: Fwd: Android 1.5 SDK now available (Action Required)

5. How to launch a standard application in adb shell

6. Detecting Physical Keyboard (not Cupcake software keyboard)

7. How to monitor my app trafic?