diff options
Diffstat (limited to 'testapps/libsTest/lib2/src/com/android/tests/libstest/lib2/Lib2.java')
-rw-r--r-- | testapps/libsTest/lib2/src/com/android/tests/libstest/lib2/Lib2.java | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/testapps/libsTest/lib2/src/com/android/tests/libstest/lib2/Lib2.java b/testapps/libsTest/lib2/src/com/android/tests/libstest/lib2/Lib2.java new file mode 100644 index 000000000..bb8e4db03 --- /dev/null +++ b/testapps/libsTest/lib2/src/com/android/tests/libstest/lib2/Lib2.java @@ -0,0 +1,43 @@ +package com.android.tests.libstest.lib2; + +import android.app.Activity; +import android.widget.TextView; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; + +public class Lib2 { + + public static void handleTextView(Activity a) { + TextView tv = (TextView) a.findViewById(R.id.lib2_text2); + if (tv != null) { + tv.setText(getContent()); + } + } + + private static String getContent() { + InputStream input = Lib2.class.getResourceAsStream("Lib2.txt"); + if (input == null) { + return "FAILED TO FIND Lib2.txt"; + } + + BufferedReader reader = null; + try { + reader = new BufferedReader(new InputStreamReader(input, "UTF-8")); + + return reader.readLine(); + } catch (IOException e) { + } finally { + if (reader != null) { + try { + reader.close(); + } catch (IOException e) { + } + } + } + + return "FAILED TO READ CONTENT"; + } +} |