I've got it working now, I used this code to finish it:

FileInputStream fIn = openFileInput("news.txt");
                InputStreamReader isr = null;
                char[] inputBuffer = new char[255];
                String data = null;

                try{
                          isr = new InputStreamReader(fIn);
                          isr.read(inputBuffer);
                          data = new String(inputBuffer);
                          Toast.makeText(getBaseContext(), "Settings
read",Toast.LENGTH_SHORT).show();
                          }
                          catch (Exception e) {
                          e.printStackTrace();
                          Toast.makeText(getBaseContext(), "Settings not
read",Toast.LENGTH_SHORT).show();
                          }
                          finally {
                             try {
                                    isr.close();
                                    fIn.close();
                                    } catch (IOException e) {
                                    e.printStackTrace();
                                    }
                          }
                          setContentView(R.layout.latestnews);
                          TextView tv = (TextView)findViewById(R.id.somenews);
                          tv.setText(data);

Thanks very much for all your help. It is much appreciated.



On Mar 22, 4:23 pm, Mark Murphy <mmur...@commonsware.com> wrote:
> murphy wrote:
> > I've added in also the line FileInputStream fIn = openFileInput
> > ("news.txt"); but I don't know what to do with it once I open it to be
> > able to display it in my TextView in a new screen.
>
> http://www.exampledepot.com/egs/java.io/ReadLinesFromFile.html
>
> --
> Mark Murphy (a Commons Guy)http://commonsware.com
> Warescription: Three Android Books, Plus Updates, $35/Year
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to