Skip to content

Instantly share code, notes, and snippets.

@abdurahmanadilovic
Created January 28, 2018 12:12
Show Gist options
  • Save abdurahmanadilovic/f61eed70684d16df3560150e7941a1f6 to your computer and use it in GitHub Desktop.
Save abdurahmanadilovic/f61eed70684d16df3560150e7941a1f6 to your computer and use it in GitHub Desktop.
Java manual map showcase
@Test
public void JavaMap() throws Exception{
List<String> listOfLinks = new ArrayList<>();
Context testContext = InstrumentationRegistry.getTargetContext();
listOfLinks.add("www.codingstoic.com");
listOfLinks.add("www.codingblast.com");
listOfLinks.add("www.kotlinlang.org");
listOfLinks.add("www.android.com");
List<TextView> listOfTextViews = new ArrayList<>();
for (String link: listOfLinks){
TextView tmpTextView = new TextView(testContext);
tmpTextView.setText(link);
listOfTextViews.add(tmpTextView);
}
ViewGroup rootView = new LinearLayout(testContext);
for (TextView textView : listOfTextViews){
rootView.addView(textView);
}
assertEquals(listOfLinks.get(0), listOfTextViews.get(0).getText().toString());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment