Good Morning Personal I have a fragment containing a listview where it clears the data coming from a webservice. In the onclick method I have the following code where I pass some values to another activity according to the code below.
ltwPacote.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long
id) {
JsonObject obj = (JsonObject) parent.getItemAtPosition(position);
String codigo = obj.get("i_cdpacote").getAsString();
String descricaopacote = obj.get("c_descricao").getAsString();
String preco = obj.get("n_precopacote").getAsString();
String regra = obj.get("c_regra").getAsString();
Intent intent = new Intent(getActivity(), VisualizaPacote.class);
intent.putExtra("i_cdpacote", codigo);
intent.putExtra("c_descricao", descricaopacote);
intent.putExtra("n_precopacote", preco);
intent.putExtra("c_regra", regra);
startActivity(intent);
In my activity, Visualize Package has the following code:
Intent intent = getIntent();
String descricao = intent.getStringExtra("descricaopacote");
String preco = intent.getStringExtra("preco");
String regra =intent.getStringExtra("regra");
TextView txtdescricaopacote = (TextView) findViewById(R.id.txtPacote);
txtdescricaopacote.setText(descricao);
TextView txtpreco = (TextView) findViewById(R.id.txtPreco);
txtpreco.setText(preco);
TextView txtregra = (TextView) findViewById(R.id.txtRegra);
txtregra.setText(regra);
It turns out that by clicking on the list item to see the details these parameters are not appearing in the Visualization activity. If anyone could guide me, thank you.