I have a ListView
which has a single choice. I placed an add function for it. My code is:
public void add(){
String name = (allergytxt.getText().toString() + "\n" +
desctxt.getText().toString() + "\n" +
doctxt.getText().toString() + "\n" +
notxt.getText().toString());
if (!name.isEmpty() && name.length() > 0) {
adapter.add(name);
adapter.notifyDataSetChanged();
allergytxt.setText("");
desctxt.setText("");
doctxt.setText("");
notxt.setText("");
Toast.makeText(MainActivity.this, "added",Toast.LENGTH_SHORT).show();
}
}
Apparently the listview would only display 2 lines of text. Heeeelp. (I'm new to androdid studio and java by the way)