diff options
Diffstat (limited to 'testapps/libsTest/app/src')
3 files changed, 64 insertions, 0 deletions
diff --git a/testapps/libsTest/app/src/com/android/tests/libstest/app/App.java b/testapps/libsTest/app/src/com/android/tests/libstest/app/App.java new file mode 100644 index 000000000..54e2a09de --- /dev/null +++ b/testapps/libsTest/app/src/com/android/tests/libstest/app/App.java @@ -0,0 +1,43 @@ +package com.android.tests.libstest.app; + +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 App { + + public static void handleTextView(Activity a) { + TextView tv = (TextView) a.findViewById(R.id.app_text2); + if (tv != null) { + tv.setText(getContent()); + } + } + + private static String getContent() { + InputStream input = App.class.getResourceAsStream("App.txt"); + if (input == null) { + return "FAILED TO FIND App.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"; + } +} diff --git a/testapps/libsTest/app/src/com/android/tests/libstest/app/App.txt b/testapps/libsTest/app/src/com/android/tests/libstest/app/App.txt new file mode 100644 index 000000000..084e7d0cc --- /dev/null +++ b/testapps/libsTest/app/src/com/android/tests/libstest/app/App.txt @@ -0,0 +1 @@ +SUCCESS-APP
\ No newline at end of file diff --git a/testapps/libsTest/app/src/com/android/tests/libstest/app/MainActivity.java b/testapps/libsTest/app/src/com/android/tests/libstest/app/MainActivity.java new file mode 100644 index 000000000..8992066bd --- /dev/null +++ b/testapps/libsTest/app/src/com/android/tests/libstest/app/MainActivity.java @@ -0,0 +1,20 @@ +package com.android.tests.libstest.app; + +import android.app.Activity; +import android.os.Bundle; + +import com.android.tests.libstest.lib1.Lib1; +import com.android.tests.libstest.lib2.Lib2; + +public class MainActivity extends Activity { + /** Called when the activity is first created. */ + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.main); + + App.handleTextView(this); + Lib1.handleTextView(this); + Lib2.handleTextView(this); + } +}
\ No newline at end of file |