I am trying to figure out how to add another string to my month array and display that in a list view dynamically via pressing the button. Currently I have no problem display the array I have specified, but I cant figure out a way to add my count variable which should be added to the array list after the button is clicked. Any ideas ? Thank's for the help!!!!
public class Test extends Activity implements OnClickListener,
OnItemClickListener {
Button test;
ListView list;
String month[] = { "January", "February", "March", "April", "May", "June",
"July", "August", "September", "October", "November", "December" };
public static int count = 0;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.test);
test = (Button) findViewById(R.id.button1);
test.setOnClickListener(this);
list = (ListView) findViewById(R.id.tlist);
list.setAdapter(new ArrayAdapter<String> (this,
android.R.layout.simple_list_item_1, month));
}
public void onClick(View v) {
// TODO Auto-generated method stub
switch (v.getId()) {
case R.id.button1:
count++;
//Add count value to end of array
break;
}
}
}