1
How do I run an Activity and after closing it continue executing the code from where it stopped, example:
listmarcacoes.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView adapter, View viw, int posicao,long id) {
cursor.moveToPosition(posicao);
Intent intent = new Intent(getActivity(), EdicaoMarcacao.class);
Bundle params = new Bundle();
String resposta = cursor.getString(1).toString();
if(CalculoHora.isHojeData(resposta)){
Toast.makeText(getActivity(), "Use a aba RESGISTRO para marcações do dia!", Toast.LENGTH_SHORT).show();
} else {
params.putString("diafiltro", resposta);
intent.putExtras(params);
// Aqui quero que a execução aguarde a activity ser executada!
startActivity(intent);
// Aqui a execução continua apos o encerramento da actitity!
// Executanto posteriormente o metodo lista()
lista();
}
}
});
I need it this way because when I call Activity "Edicaomarcao" it changes the values of listview , this way when I close the second screen I want you to update the first.
Just to confirm, the code "onActivityResult" I put in the current Activity, right? , already the code for when finished put in Edicaimarcao.class, correct? but which Edicaimarcao.class method can I put in?
– Saulo Souza
That is correct. You take the Bundle passed by the current Activity and make changes in Edicaimarcao.class and then pass your answer through the Bundle, and then you finish this Activity.. then in the onActivityResult method you take the answer that is in the Bundle and then call the list() method to update the values of your listview.
– Pedro Rangel
It worked. Thank you!
– Saulo Souza