0
I have a list of countries of the type Listview, and when I click in Brazil I get the String "Brasil" with the "getItem(position)" but instead I would like to take another data, in the case the "BR" that is in the database. Does anyone have any idea how to catch him? Note: I am taking all the data from the database and using queries to extract results. Follow the code I’m using:
public void onItemClick(AdapterView<?> parent, View view, int position,
long id) {
String stringPaises = adapter.getItem(position);
Intent i = new Intent(this, Activity2.class);
i.putExtra("stringPaises", stringPaises);
startActivityForResult(i, 0);
}
As is your Adapter?
– ramaral
One way is to do a database search by passing the stringPaises
– Uzias
Put your Adapter and show how you’re going up to the bank inside
– Wellington Avelino
My Adapter receives a String from the bank and forms the listview. In the case of my question I am using the string "Brazil" as parameter to return a qwery with the list of states of Brazil that would be used in another listview, what I wanted was to use the string "BR" instead of using the string "Brazil" as parameter in qwery. "BR" is on the bench. I could use the parameter "Brazil" to search for this qwery "BR" but then I think I would be half pig, then I asked here to know if there is a more optimized way.
– daniel12345smith
Your Adapter is a Cursoradapter?
– ramaral
No. I used a String vector to do this job, my Adapter is from the basic same.
– daniel12345smith
Think about using one, so you can more easily access the (BD) data concerning the line you clicked.
– ramaral
good, I’ll try, but thanks man
– daniel12345smith