简体   繁体   English

动态地从用户输入向数组列表添加值

[英]adding values to the arraylist from userinput dynamically

How can we add the data to java objects dynamically by taking the input from user?我们如何通过从用户那里获取输入来动态地将数据添加到 java 对象中? without using database is that possible?不使用数据库有可能吗? if possible how ?如果可能怎么办? show with small example thanks in advance显示小例子提前致谢

Button button=(Button)findViewById(R.id.myButton);
EditText myText=(EditText)findViewById(R.id.myEditText);
button.setOnClickListener(new OnClickListener(){public void onClick(View v){
myArrayList.add(myText.getText().toString());

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM