我想知道如何將多個值放入ArrayList<NameValuePair>
。這是我的代碼,但它不起作用。有人幫我解釋一下ArraysList<NameValuePair>
。 這裏是我的代碼:如何將2個或更多的值放入ArrayList <NameValuePair>
public void OnClickForSave(View v) throws Exception {
String st = null;
String str = null;
String response = null;
String memberID = "000000007";
String teamID = "000007";
ArrayList<NameValuePair> postParameters = new ArrayList<NameValuePair>();
postParameters.add(new BasicNameValuePair("userID", memberID));
postParameters.add(new BasicNameValuePair("teamID", teamID));
if (v.getId() == (R.id.imgbtn_layout2)) {
Intent intent = new Intent(this, IntentTesting.class);
startActivity(intent);
}
if (v.getId() == (R.id.imgbtn_lsave)) {
if (txt_teamID.getText().toString().trim().equals(null)
|| txt_teamID.getText().toString().trim().equals("")) {
AlertDialog empty = createDialogEmpty(this, "Enter Team ID");
empty.show();
txt_teamID.selectAll();
txt_teamID.requestFocus();
}
else if (txt_teamID.getText().toString().trim().length() > 6) {
AlertDialog notFormat = createDialogEmpty(this, "More Than 6 Characters");
txt_teamID.selectAll();
txt_teamID.requestFocus();
notFormat.show();
} else {
try {
st = CustomHttpClient.executeHttpGet("http://192.168.200.14/football365/DBConnection.php");
str = CustomHttpClient.executeHttpGet("http://192.168.200.14/football365/responseJson.php");
response = CustomHttpClient.executeHttpPost("http://192.168.200.14/football/joinTeam.php",
postParameters);
} catch (JSONException e) {
e.printStackTrace();
}
}
}
}
什麼是'CustomHttpClient.executeHttpPost'?一個標準庫或你自己的類和方法? – ADTC