Last active
August 17, 2022 13:02
-
-
Save JuniiiSays/9537323768ccd000a8eae930e4bffc32 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ArrayList<String> words = new ArrayList<String>(); | |
words.add("One"); | |
//Find the rootView of Numbers activity | |
LinearLayout rootView = findViewById(R.id.rootView); | |
//Create a TextView programmatically | |
TextView wordView = new TextView(this); | |
//Show first element of the ArrayList ib that TextView | |
wordView.setText(words.get(0)); | |
//Attach TextView with the rootView | |
rootView.addView(wordView); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
xmlns:tools="http://schemas.android.com/tools" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:id="@+id/rootView" | |
android:orientation="vertical" | |
android:padding="16dp" | |
tools:context=".NumbersActivity"> | |
</LinearLayout> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment