Method of add gives error for ArrayList
. It isn't adding.
public List<String> arrayList;
...
arrayList = new ArrayList<String>();
...
savenumberButton.setOnClickListener(new View.OnClickListener()
{
public void onClick(View v)
{
String str = numberText.getText().toString();
Integer cout = listView.getCount()+ 1;
String str1 = cout.toString().concat("."+str);
try {
arrayList.add(listView.getCount(), str1);
} catch (Exception e) {
Log.w("Error", "arraylist.add is not running!");
}
arrayAdapter.notifyDataSetChanged();
Toast.makeText(getApplicationContext(), "Data Saved", Toast.LENGTH_SHORT).show();
blockNumberText.setText(" ");
}
});
...
arrayList.add(listView.getCount() - 1, str1);