I'm developing a service scheduling system and in a ListView I get the data from a client and move on to a Query Activity. I created an edit menu and would like to pass this same data to the new activity, but I can only open the Activity without passing the data of this client.
Can you help me?
The code is attached. In this activity it selects an item from the list and throws the client object to a second activity, which is just for querying the data:
public class AgendadoDiaActivity extends AppCompatActivity {
private ListView listadeAtendimentos;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_agendado_dia);
listadeAtendimentos = (ListView) findViewById(R.id.lista_atendimentos);
listadeAtendimentos.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> lista, View item, int position, long id) {
Clientes cliente = (Clientes) listadeAtendimentos.getItemAtPosition(position);
Intent pesquisa = new Intent(AgendadoDiaActivity.this, ViewCadastroAtendimentosActivity.class);
pesquisa.putExtra("cliente", cliente);
startActivity(pesquisa);
}
});
In the onCreate of this Activity it takes the object that I sent in the extra and populates through the fill-in () method the items in the list.
public class ViewCadastroActivitiesActivity extends AppCompatActivity {
private HelperViewCadastroAtendimentos helper;
private HelperCadastroAtendimentos helperCadastro;
private Clientes cliente;
private Intent pesquisa;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_view_cadastro_atendimentos);
helper = new HelperViewCadastroAtendimentos(this);
pesquisa = getIntent();
cliente = (Clientes) pesquisa.getSerializableExtra("cliente");
if(cliente != null){
helper.preencheFormulario(cliente);
}
}
In this activity you have an edit button, which calls another editing activity. It is in it that I can not get these same data and play the values of bd.