There are numerous ways to achieve this goal. I will suggest an approach that I consider efficient.
The ideal would be to implement your own version of ** Simplecursoradapter**, register a callback responsible for executing the desired action and pass on to this callback some data relating to your record, preferably an ID.
In your callback you run the operation using the received reference, in case you open a new Activity. Receive the reference in Activity and make a new query to DB with the reference.
1 - Tutorial to implement Simplecursoradapter
2 - Implement an interface in your Adapter to pass the info to your callback
public interface MyListener {
void setOnClickAdapter(final View view, final int myId );
}
3 - Register your system in the method bindView of your Adapter
@Override
public void bindView(final View view, final Context context, final Cursor cursor) {
//....
MyListener listener = (TaskListener)context;
listener.setOnClickAdapter( myTextView, id );
4 - In your Activity used as context implement the Adapter interface
@Override
public void setOnClickAdapter( final View view, final int id)
{
view.setOnClickListener( new View.OnClickListener )
@Override
public void onClick(View view) {
// Execute sua operação
}
}
When you click on an item from
ListView
he takes theposition
, why not take the Brazil Name and do a search in the bank to fill your object again?– Wellington Avelino
@daniel12345smith, please add the code of how you are filling this
ListView
will help a lot by doing this.– Luídne