I have a Listview
in my activity
main when I click on a button, it adds data in my Listview
, so everything is correct.
How do I show this listview
to another activity
? I show other data ( EditText
) without problems, but listview
I could not.
I tried to use it to send the data:
public void EnviarParaResultadoActivity(View view){
EditText resultadoID = (EditText) findViewById(R.id.resultadoID);
EditText nomesorteioID = (EditText) findViewById(R.id.nomesorteioID);
ListView listView1 = (ListView)findViewById(R.id.listView1);
Bundle parametro = new Bundle();
parametro.putString("resultadoID", resultadoID.getText().toString());
parametro.putString("nomesorteioID", nomesorteioID.getText().toString());
parametro.putString("listView1", listView1.getContext().toString());
Intent intent = new Intent(this, ResultadoActivity.class);
intent.putExtras(parametro);
startActivity(intent);
}
and to receive the data:
public void ReceberParametros() {
Intent intent = getIntent();
if(intent != null){
Bundle parametros = intent.getExtras();
if(parametros != null){
String resultadoID = parametros.getString("resultadoID");
String nomesorteioID = parametros.getString("nomesorteioID");
String listview1 = parametros.getString("listview1");
TextView ResultadoTV = (TextView)findViewById(R.id.resultadoID);
TextView NomesorteioTV = (TextView) findViewById(R.id.nomesorteioID);
ListView listviewLV = (ListView) findViewById(R.id.listView1);
ResultadoTV.setText(" "+resultadoID);
NomesorteioTV.setText(" "+nomesorteioID);
listviewLV.setFilterText(" "+listview1);
}
}
}
TextView
data is displayed normally, but Listview
is not displayed. Can anyone help me?