Skip to content

Instantly share code, notes, and snippets.

@Nkzn
Created May 8, 2015 07:47
Show Gist options
  • Select an option

  • Save Nkzn/205a6fb2946a1680a6d2 to your computer and use it in GitHub Desktop.

Select an option

Save Nkzn/205a6fb2946a1680a6d2 to your computer and use it in GitHub Desktop.
できるかなと思ったらできちゃったやつ
public class ListActivity extends AppCompatActivity {
@InjectView(R.id.list_view)
ListView listView;
public void onCreate(Bundle savedInstanceState) {
super(savedInstanceState);
ButterKnife.inject(this);
Observable.just(
R.string.listitem1,
R.string.listitem2,
R.string.listitem3,
R.string.listitem4,
R.string.listitem5)
.map(this::getString)
.collect(
() -> new ArrayAdapter<>(this, android.R.layout.simple_list_item_1),
ArrayAdapter::add)
.subscribe(listView::setAdapter);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment