-2

I have completely forgotten how I set this up before on a different IDE and I lost the files from that. How do you setup this code to make it run. I need to put a try{ and a catch but where and how? Thanks for helping.

class UpdateText extends AsyncTask<String, Void, String>{

@Override
protected String doInBackground(String... strings) {
    BufferedReader br = new BufferedReader(new InputStreamReader(getResources().openRawResource(R.raw.stringtest)));
    String line = null;
    while ((line = br.readLine()) != null) {
        Log.i("TAG", line);
    }
    br.close();
}

}

ThePoloDoc
  • 340
  • 9
  • 23

1 Answers1

0

http://developer.android.com/reference/android/content/res/Resources.html#openRawResource%28int%29

can throw a ResourceNotFoundException

http://developer.android.com/reference/java/io/BufferedReader.html#close%28%29

can throw a IOException.

Which IDE are you using? Eclipse shows you all your uncaught exceptions.

type-a1pha
  • 1,891
  • 13
  • 19