0
I have the Activity ActLevantamento
, where I created a custom layout using a class inherited from ArrayAdapter
, class AtributoArrayAdapter
.
In this custom layout, I have a button, and in the call of this button I call the Activity ActPlantaEncontrada
. The idea is to edit/insert values in ActPlantaEncontrada
and return this values to my AtributoArrayAdapter
. If it were an Activity calling another Activity I could utilize the startActivityForResult()
and get the return in the method onActivityResult()
, but it is not possible.
How to do this?
Below excerpt from the class Attributtoarrayadapter where I call Activity to edit/insert the values. The edition is not yet implemented.
Intent it = new Intent(context, ActPlantaEncontrada.class);
it.putExtra(Constants.PARAM_PERFIL_NOME, avh.stPerfilNome);
getContext().startActivity(it);
The difficulty arises because you are assigning a responsibility to the Arrayadapter that he should not have. Remember that an Adapter has only one responsibility: to act as an intermediary between a data source(array) and its visual representation(listview)
– ramaral
Really! I handled the event in Activity itself where I build the dynamic layout. Thank you very much.
– chuab_789
In programming when something we want to do gets complicated it’s usually because we’re taking the wrong approach.
– ramaral
Always good a second look to clear up where we’re going wrong.
– chuab_789