如何將id中顯示的id傳遞給另一個地圖活動?如何傳遞用戶標識來映射列表適配器的活動?
好友列表:
地圖活動:
我已經在ListAdapter
btnLocate.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
stringID=getItem(position).getID();
Toast.makeText(context, "Friend ID"+stringID, Toast.LENGTH_LONG).show();
Intent mapScreen = new Intent(context, MapActivity.class);
mapScreen.putExtra("ID",getItem(position).getID());
context.startActivity(mapScreen);
}
});
做這個代碼和這些代碼MapActivity.java
@Override
protected String doInBackground(Void... params) {
String response;
Intent listScreen= getIntent();
Log.d(MainActivity.LOG_TAG,"UID List1"+ listScreen.getStringExtra("ID"));
String body = "UID=" + listScreen.getStringExtra("ID");
Log.d(MainActivity.LOG_TAG,"UID List2"+ listScreen.getStringExtra("ID"));
response = http.postRequest(HttpConfigs.URL_COORDINATES, body);
return response;
}`
是什麼意思*另一個地圖活動朋友列表*?對於當前的MapActivity,你做得很好。 – tahsinRupam
我想你應該先從你的MapActivity的創建方法中獲得你的ID,然後在你的AsyncTask中使用它。你的代碼看起來很好。 – Oussaki
@Waseem你在MapActivity中沒有獲得ID嗎?還是出現錯誤? –