I am developing an Android project and I have the following code segments which collects information into an "array":
//setup array containing submitted form data
ArrayList<NameValuePair> data = new ArrayList<NameValuePair>();
data.add( new BasicNameValuePair("name", formName.getText().toString()) );
data.add( new BasicNameValuePair("test", "testing!") );
//send form data to CakeConnection
AsyncConnection connection = new AsyncConnection();
connection.execute(data);
My problem is how to read the individual members of that data list in my AsyncConnection class?
You should simply iterate over the list to get access to each NameValuePair
. With the getName()
and getValue()
methods you can retrieve the individual parameters of every pair.
for (NameValuePair nvp : data) {
String name = nvp.getName();
String value = nvp.getValue();
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With