startActivityForResult を使用して別のアクティビティを起動するアクティビティがあります。このステップは大丈夫です。次に、2 番目のアクティビティにマップがあり、ボタンがクリックされると、最初のアクティビティで使用されるバンドルにジオポイントの座標が渡され、EditText がフルフィルされます。関数 onActivityResult が最後まで実行された後、プログラムがクラッシュし、画面に「ソースが見つかりません」というメッセージが表示されます。
これは mapActivity の関数です:
public void ConfirmLoc(View v){
double lat = loc.getLatitudeE6()/1E6;
double lng = loc.getLongitudeE6()/1E6;
Intent ievloc = new Intent();
Bundle bevloc = new Bundle();
bevloc.putDouble("latitude",lat);
bevloc.putDouble("longitude",lng);
ievloc.putExtras(bevloc);
setResult(RESULT_OK,ievloc);
finish();
}
そして、これは最初のアクティビティの onActivityResult です:
protected void onActivityResult(int requestCode, int resultCode, Intent data){
if(requestCode==1){
if(resultCode==RESULT_OK){
EditText loc= (EditText) findViewById(R.id.LocalizacaoEvento);
bevloc = data.getExtras();
if(bevloc!=null){
String latitud = String.valueOf(bevloc.getDouble("latitude"));
String longitud = String.valueOf(bevloc.getDouble("longitude"));
loc.setText(latitud+" , "+longitud,TextView.BufferType.EDITABLE);
}
}
else if(resultCode==RESULT_CANCELED){
}
}
}
誰でも助けることができますか?ありがとう