Libraryless. Click here for Pure Java version (321L/3K/10K).
!752 import android.view.*; import android.widget.*; import android.content.*; p {androidUI(r { ListView lv = new ListView(androidActivity()); lv.setAdapter(new MyAdapter(androidActivity (), new S[] {"a", "b", "c", "d"})); lv.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> arg0, View arg1, int position, long id) { androidShowText (str(position)); } }); androidShow (lv); }); } sclass MyAdapter extends ArrayAdapter<String> { public MyAdapter(Context context, String[] strings) { super(context, -1, -1, strings); } @Override public View getView(int position, View convertView, ViewGroup parent) { LinearLayout listLayout = new LinearLayout(getContext ()); listLayout.setLayoutParams(new AbsListView.LayoutParams( AbsListView.LayoutParams.FILL_PARENT, AbsListView.LayoutParams.WRAP_CONTENT)); listLayout.setId(View.generateViewId()); TextView listText = new TextView(getContext()); listText.setId(View.generateViewId()); listLayout.addView(listText); listText.setText(super.getItem(position)); return listLayout; } }
Began life as a copy of #1004464
download show line numbers debug dex old transpilations
Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, crvwmplrxojx, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, nbgitpuheiab, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1004466 |
Snippet name: | Android ListView Demo II (with strings, onClick, works) |
Eternal ID of this version: | #1004466/1 |
Text MD5: | 4d6e8839f2029ed9a755e6b68a1e97c4 |
Transpilation MD5: | b5129f799ed739c8c4ea6c2706711f18 |
Author: | stefan |
Category: | javax / eleu |
Type: | JavaX source code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2016-11-05 06:32:04 |
Source code size: | 1403 bytes / 51 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 624 / 658 |
Referenced in: | [show references] |