Hi! I'm junior in andoid programming. I would like to make a application in which there is an edit text and if you write in a number and press a button, it would dinamically show as many textview lines as the given number. The problem is that I cannot number the textview lines. For example, if I write ten in the edit text and press the button than number 9 will appear at the beginning of all the lines. Could you help me with this problem?
My codes: The whole project: http://digitus.itk.ppke.hu/~dolat/DynamicListItems.zip Or: package com.novoda; import java.util.ArrayList; import java.util.HashMap; import android.app.ListActivity; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.SimpleAdapter; public class DynamicListItems extends ListActivity { private static final String ITEM_KEY = "key"; ArrayList<HashMap<String, String>> list = new ArrayList<HashMap<String, String>>(); private EditText newValue; private SimpleAdapter notes; private int szam = 0; private int[] tomb = new int[10]; private String[] key = new String[10]; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.dynamic_list); newValue = (EditText) findViewById(R.id.new_value_field); notes = new SimpleAdapter( this, list, R.layout.row, new String[] { ITEM_KEY }, new int[] { R.id.list_value }); Button ib = (Button) findViewById(R.id.button); ib.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { try { szam = Integer.valueOf(newValue.getText().toString()).intValue(); HashMap<String, String> item = new HashMap<String, String>(); list.clear(); for(int i = 0;i < szam;i++){ item.put(ITEM_KEY, i+". line"); list.add(item); } setListAdapter(notes); } catch (NullPointerException e) { Log.i("[Dinamikus elemek]", "Megpróbáltál hozzáadni egy null értéket."); } } }); } } Thanks, Attila -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe from this group, send email to android-developers+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.

