JAVA/android_studio
2024. 9. 16. 11:09
https://stackoverflow.com/questions/31279216/how-to-add-an-item-to-a-listview-with-each-button-click
How to add an item to a ListView with each Button click
This is the code I'm working on, it should simply add an item in a ListView (w/ array) each time the Button is clicked. The text inserted by the user on a EditText should be added to the list each ...
stackoverflow.com
Button buttonPlus = (Button)findViewById(R.id.buttonPlus); buttonPlus.setOnClickListener( new Button.OnClickListener() { @Override public void onClick(View v) { arrayNames.add(0, namesText.getText().toString()); adapterNames.notifyDataSetChanged(); namesText.setText(""); } } ); |
'JAVA > android_studio' 카테고리의 다른 글
Android service not restarted when app back from idle state (0) | 2024.09.16 |
---|---|
Permission Denial: startForeground requires android.permission.FOREGROUND_SERVICE (0) | 2024.09.16 |
JAVA, TimeFormat string , [Java/Android] 현재 날짜, 시간 출력 SimpleDateFormat (0) | 2024.09.16 |
서비스 ForegroundService , BackgroundService (0) | 2024.09.10 |
핸들러 , Handler (1) | 2024.09.10 |