I have a ListActivity and I want to set programmatically the text of a TextView that is inside my layout, I need to do this to all my lines.
This TextView will show the Currency Simbol for the current Locale on each line of the ListActivity.
Code snippet:
DepositoRepository repo = new DepositoRepository(this);
Cursor c = repo.getCursor();
adapter = new SimpleCursorAdapter(this, R.layout.deposito_list, c,
new String[] { Deposito.COLUNA_VALOR, Deposito.COLUNA_DATA },
new int[] { R.id.tvValorDeposito, R.id.tvDataDeposito });
setListAdapter(adapter);
What I want for all rows:
Currency moeda = Currency.getInstance(Locale.getDefault());
TextView tvMoeda = (TextView)findViewById(R.id.tvMoeda);
tvMoeda.setText(moeda.getSymbol(Locale.getDefault()));
You can use a Custom Adapter to your listView. If you want I can edit my answer and show you how to do this. Here is something that can put you on a right track. Adapt this code to your application.
And from your activity just call setListAdapter(adapter), adapter being your custom adapter.
Hope this helps!
EDIT: