finish 를 하고 다시 돌아왔는데 


oncreate로 안돌아 와요.. ㅠㅠ 


느아.... ㅠㅠ 


A activity 에서 

B Activity 다이어 로그 로 넘어가서 


B 에서 취소를 누르면 


A 로 넘어가서 


A 에 있는 onCreate 로 넘어가야 하는데.. 


왜 안넘어 갈까요.. ㅠㅠ


소스를 첨부 해 봅니다. 


이게 A 소스 입니다. 


public class Second_main_map extends MapActivity implements LocationListener,

OnClickListener {


public LocationManager lm = null;

public Location loc = null;

public Criteria cr = null;

Context context = this;

Context m_context = this;

Toast toast = null;

String addr1 = null;

public static int PROCESS_ACTION = 0;


http_down_thread mThread;


SharedPreferences preferences;

SharedPreferences.Editor editor;


/*InterestringLocatinos funPlaces;*/


String GET_HOST_URL = GLV.GBL_GET_URL;


TextView txt_now_address, tv, tv2;


double longitude = 0.0, latitude = 0.0; // GPS x값,y값


public static final String CALL_TYPE_RESERVE = "1"; // 콜택시


CountDownTimer _mTimer; // 홈 화면 자동 새로고침.


private String provider = "";


int ActivityInit = 0; // 맨처음 onResume 작동안하게 하기 위함.


LocationManager locationMgr = null;

MapController mapControl;


private static MapView map = null;

private static List<Overlay> mo = null;

private static OverlayItem overlayitem = null;

private static HelloItemizedOverlay itemizedoverlay;


InterestringLocatinos funPlaces;

Button myinB, callDB;

String regId = ""; // gcm id

String getNumber = "";


Drawable marker;


String EditText_Longitude = null;

String EditText_Latitude = null;


@Override

public void onCreate(Bundle savedInstance) {

super.onCreate(savedInstance);

setContentView(R.layout.second_main_map);


GLV.GBL_HOME_TAB = 0;


map = (MapView) findViewById(R.id.map);

mapControl = map.getController();


// _mTimer.cancel(); // 타이머 정지


/*

* if(GLV.mParam.strPhoneNation.equals("")) GLV.mParam.strPhoneNation =

* "82";

*/


// 쿠키에 저장된 값

preferences = getSharedPreferences("saveCookie", Service.MODE_PRIVATE);

regId = preferences.getString("regId", "");

GLV.mParam.strPhoneNumber = "";

GLV.mParam.iPhoneGroup = preferences.getInt("phoneGroup", 0); // 그룹

GLV.mParam.strPhoneNation = preferences.getString("phoneNation", "82"); // 국가코드

GLV.mParam.strPhoneDn = preferences.getString("phoneDn", "2"); // 지역번호


// Intent 받기

Intent intent = getIntent();

String address = intent.getStringExtra("address");

String pos_x = intent.getStringExtra("pos_x");

String pos_y = intent.getStringExtra("pos_y");


tv2 = (TextView) findViewById(R.id.tv2);

tv2.setText(address);


tv = (TextView) findViewById(R.id.tv1);

tv.setText(addr1);


// 이미지 이름을 marker 로 지정해야 됩니다.

marker = getResources().getDrawable(R.drawable.marker_heare);

marker.setBounds(0, 0, marker.getIntrinsicWidth(),

marker.getIntrinsicHeight());


// map 종합 실행 2



funPlaces = new InterestringLocatinos(marker);

map.getOverlays().add(funPlaces);


ClickReceiver clickRecvt = new ClickReceiver(Second_main_map.this,

funPlaces);

map.getOverlays().add(clickRecvt);

s

TelephonyManager systemService = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);

getNumber = systemService.getLine1Number();

try {

if (getNumber.substring(0, 3).equals("+82")) {

String temp = getNumber.substring(3);

getNumber = "0" + temp;

} else if (getNumber.substring(0, 2).equals("82")) {

String temp = getNumber.substring(2);

getNumber = "0" + temp;

}

} catch (Exception e) {

e.printStackTrace();

}


// 현재 위치로 화면 보여주기

int x = (int) (Double.parseDouble(pos_x) * 1000000.0);

int y = (int) (Double.parseDouble(pos_y) * 1000000.0);


GeoPoint point = new GeoPoint(x, y);


mo = map.getOverlays();

mapControl.animateTo(point);

mapControl.setZoom(16);


Drawable drawable = this.getResources().getDrawable(R.drawable.marker);

HelloItemizedOverlay itemizedoverlay = new HelloItemizedOverlay(

drawable, this);

overlayitem = new OverlayItem(point, "내 위치", address);

itemizedoverlay.addOverlay(overlayitem);

mo.add(itemizedoverlay);

myinB = (Button) findViewById(R.id.myInfo_mainB);

findViewById(R.id.myInfo_mainB).setOnClickListener(this);


callDB = (Button) findViewById(R.id.drivercall_mainB);

findViewById(R.id.drivercall_mainB).setOnClickListener(this);


// 현재 위치 주소

txt_now_address = (TextView) findViewById(R.id.txt_where_map_text);

txt_now_address.setText(address);


// 목적지 주소

fnRefreshAction();


// GPS

Location cloc = null;


try {


cloc = checkGps();


} catch (Exception e) {

// TODO: handle exception

e.printStackTrace();


}


}


// /////////////////////////////////////////////////////////

public class ClickReceiver extends Overlay {

private static final String TAG = "ClickReceiver";

private Context context;

InterestringLocatinos temp;


public ClickReceiver(Context _context, InterestringLocatinos temp_) {

context = _context;

temp = temp_;

}


@Override

public boolean onTap(GeoPoint p, MapView mapView) {

// 설정 상태가 되야 찍힘


String address = "", get_X = "", get_Y = "";

final int yes = 0;

final int no = 1;

Context mContext;

Log.i("asdasdsadasdadadsadadsad" + mo.size());

if (mo.size() >= 0) {

mo.remove(1);


get_X = String.valueOf(p.getLatitudeE6() / 1000000f);

get_Y = String.valueOf(p.getLongitudeE6() / 1000000f);


GeoPoint setposition = new GeoPoint((int) p.getLatitudeE6(),

(int) p.getLongitudeE6());


temp.addOverlay(new OverlayItem(setposition, "Ma11gic",

"Mag11ic"));


address = getAddress(get_X, get_Y);


}


Intent intent = new Intent(Second_main_map.this,

Choose_area_dialog.class);

// intent.putExtra("addr1", address);

intent.putExtra("address", address);

intent.putExtra("pos_x", get_X);

intent.putExtra("pos_y", get_Y);

intent.putExtra(CONST.EXTRA_CALL_TYPE, CONST.CALL_TYPE_RESERVE);

startActivityForResult(intent, 1);

return true;


}


}


// 좌표로 주소 가져오기

public String getAddress(String pos_x, String pos_y) {

String country = "", area = "", addr1 = "";

double x = Double.valueOf(pos_x);

double y = Double.valueOf(pos_y);

try {

Geocoder geo = new Geocoder(m_context);

List<android.location.Address> addr = geo.getFromLocation(x, y, 10);

if (addr.size() > 0) {

country = addr.get(0).getCountryName();

area = addr.get(0).getAdminArea();

addr1 = addr.get(0).getAddressLine(0);

if (addr1.contains("대한민국")) {

addr1 = addr1.replace("대한민국", ""); // "대한민국" 빼기

}

}

} catch (IOException e) {

Log.e("TA", "IOException");

}


return addr1;

}


// map 사용 종합 2


protected void onResume() {


GLV.GBL_HOME_TAB = 0;


if (GLV.RETURN_FIRST) {

GLV.RETURN_FIRST = false;

finish();

}

if (GLV.MARKER_RESET) {

GLV.MARKER_RESET = false;

try{

if (mo != null) {

if(map == null){

map.getOverlays();

}

map.removeAllViews();

mo.remove(0);

Log.i("mapActivity Not null : " );

}

}catch (Exception e) {

e.printStackTrace();

}

}

Log.i("GLV.GBL_HOME_TAB:" + GLV.GBL_HOME_TAB);


super.onResume();

}


// 다른 액티비티가 실행될때

@Override

protected void onPause() {

super.onPause();

// 타이머 중지

/*

* if (_mTimer != null) _mTimer.cancel();

*/

// if(mBound){

// this.unbindService(mConnection);

// mBound = false;

// }

}


// 종료

@Override

protected void onDestroy() {

// 타이머 중지

super.onDestroy();

/*

* if (_mTimer != null) _mTimer.cancel();

*/

ActivityInit = 0;

/*

* try{ stopService(new Intent(this, GuardService.class));

* }catch(Exception e){ e.printStackTrace(); }

*/


// unregisterReceiver(mReceiver);


System.gc();

}


public void fnRefreshAction() {


fnGetGPS();

fnTxtAction("getgps");


}


// GPS 사용을 체크

private Location checkGps() {

// TODO Auto-generated method stub

lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE);


cr = new Criteria();

cr.setAccuracy(Criteria.ACCURACY_FINE); // ������ ��Ȯ��

cr.setPowerRequirement(Criteria.POWER_LOW); // ��� �Һ�

cr.setSpeedRequired(true); // �ӵ�

cr.setAltitudeRequired(true); // �?


provider = lm.getBestProvider(cr, true);

if (provider != null) {

loc = lm.getLastKnownLocation(provider);

}


if (loc == null || provider == null) { // GPS�����ڰ� ������ ������������

// Location ���� ����.

provider = LocationManager.NETWORK_PROVIDER;

loc = lm.getLastKnownLocation(provider);

}


if (loc == null) {

loc = lm.getLastKnownLocation(provider);

} else if (loc.getExtras() == null) {

this.provider = LocationManager.NETWORK_PROVIDER;

loc = lm.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);

}

lm.requestLocationUpdates(provider, 1000, 0, this);


return loc;

}



@Override

public void onProviderDisabled(String arg0) {

// TODO Auto-generated method stub


}


@Override

public void onProviderEnabled(String arg0) {

// TODO Auto-generated method stub


}


@Override

public void onStatusChanged(String arg0, int arg1, Bundle arg2) {

// TODO Auto-generated method stub


}


private void fnGetGPS() {

GLV.strPos_x = "";

GLV.strPos_y = "";


if (!GLV.mParam.glv_x.equals("0") && !GLV.mParam.glv_y.equals("0")) {

GLV.strPos_x = GLV.mParam.glv_x;

GLV.strPos_y = GLV.mParam.glv_y;

} else if (!GLV.mParam.glv_net_x.equals("0")

&& !GLV.mParam.glv_net_y.equals("0")) {

GLV.strPos_x = GLV.mParam.glv_net_x;

GLV.strPos_y = GLV.mParam.glv_net_y;

} else {

// 네트워크 연결 관리자의 핸들을 얻음

ConnectivityManager cm = (ConnectivityManager) context

.getSystemService(Context.CONNECTIVITY_SERVICE);


// 기본 모바일 네트워크 연결자(3g)관련 정보 얻음

NetworkInfo ni = cm.getNetworkInfo(ConnectivityManager.TYPE_MOBILE);

boolean isMobileConn = ni.isConnected();


// WIFI관련 정보를 얻습니다.

NetworkInfo ni2 = cm.getNetworkInfo(ConnectivityManager.TYPE_WIFI);

boolean isWifiConn = ni2.isConnected();


LocationManager mlocManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);

GPSProvider gps = new GPSProvider(mlocManager);


if (isMobileConn || isWifiConn) {


latitude = gps.getX();

longitude = gps.getY();


String temp_x = ""

+ Double.parseDouble(String.format("%.9f", latitude));

String temp_y = ""

+ Double.parseDouble(String.format("%.9f", longitude));


if (temp_x.equals("") || temp_y.equals("")) {

txt_now_address.setText("242번째 줄 에러");

} else if (temp_x.equals("0.0") || temp_y.equals("0.0")) {

txt_now_address.setText("244번째줄 에러");

} else if (temp_x.equals("0") || temp_y.equals("0")) {

txt_now_address.setText("246번째줄 에러");

} else {

GLV.strPos_x = temp_x;

GLV.strPos_y = temp_y;

}

} else {

GLV.strPos_x = "";

GLV.strPos_y = "";

txt_now_address.setText("255번째 줄 에러 ");

}

}

}


private synchronized void fnTxtAction(String str) {

String url = "";

// Test

if (str.equals("getgps")) {

if (GLV.strPos_x.equals("") || GLV.strPos_y.equals("")) {

return;

} else if (GLV.strPos_x.equals("-1") && GLV.strPos_y.equals("-1")) {

return;

} else if (GLV.strPos_x.equals("0") && GLV.strPos_y.equals("0")) {

return;

}


url = GLV.GBL_HTTP_ADDRESS_RESERVE + GLV.URL_PREFIX + "getgps.jsp?"

+ "mynum=" + getNumber + "&nat="

+ GLV.mParam.strPhoneNation + "&dn="

+ GLV.mParam.strPhoneDn + "&group="

+ GLV.mParam.iPhoneGroup + "&pos_x=" + GLV.strPos_x // "35.0645751953"

+ "&pos_y=" + GLV.strPos_y // "127.746749878";

+ "&new=1" + "&fr=2"; // fr=2 메시지 겟수


mThread = new http_down_thread(url, context, thread_handler);

mThread.start();

}

}


Handler thread_handler = new Handler() {

public void handleMessage(Message msg) {

String getdata = msg.getData().getString("strXml");


findDOMparseAction(getdata);

}

};


public void findDOMparseAction(String strXml) {

try {

int tmp5_file_pos = strXml.indexOf("<cmd>");

int tmp6_file_pos = strXml.indexOf("</cmd>");


String temp_cmd = strXml.substring(

tmp5_file_pos + "<cmd>".length(), tmp6_file_pos);


int tmp_file_pos = strXml.indexOf("<answer>");

int tmp2_file_pos = strXml.indexOf("</answer>");


String temp_ans = strXml.substring(

tmp_file_pos + "<answer>".length(), tmp2_file_pos);


int tmp3_file_pos = strXml.indexOf("<reason>");

int tmp4_file_pos = strXml.indexOf("</reason>");


String temp_str = strXml.substring(

tmp3_file_pos + "<reason>".length(), tmp4_file_pos);


Vector<String> result = new Vector<String>();


result = Utility.fn_Tokenize(temp_str, "|");


if (temp_cmd.equals("getgps")) {

if (temp_ans.equals("1")) {

String temp = result.elementAt(0).toString();


GLV.mParam.strCodeValue = temp;


// 국가번호 82일때 대한민국 빼기

if (GLV.mParam.strPhoneNation.equals("82")) {

temp = GLV.mParam.strCodeValue.substring(

GLV.mParam.strCodeValue.indexOf(' '),

GLV.mParam.strCodeValue.length());

} else {

temp = GLV.mParam.strCodeValue;

}

txt_now_address.setText(temp);

editor = preferences.edit();

editor.putString("Notation", temp);

editor.commit();


}



}

} catch (Exception e) {

e.printStackTrace();

}

}


@Override

protected boolean isRouteDisplayed() {

// TODO Auto-generated method stub

return false;

}


@Override

public void onLocationChanged(Location location) {

// TODO Auto-generated method stub


}


@Override

public void onClick(View v) {

// TODO Auto-generated method stub


}


private class reSEt extends ItemizedOverlay<OverlayItem> {


public reSEt(Drawable defaultMarker) {

super(defaultMarker);

// TODO Auto-generated constructor stub

}


@Override

protected OverlayItem createItem(int i) {


populate();


return null;

}


@Override

public int size() {

// TODO Auto-generated method stub

return 0;

}


}


}





////////////////////////////////////////


이게 B 소스 입니다. Dialog 부분이 되죠 




/////////////////////////////////////


public class Choose_area_dialog extends Activity implements OnClickListener {


public SharedPreferences preferences;

SharedPreferences.Editor editor;


TextView Tv;

Button location_B, however_B;


@Override

protected void onCreate(Bundle savedInstanceState) {

this.requestWindowFeature(Window.FEATURE_NO_TITLE); // 타이틀바 없앰

this.getWindow().setBackgroundDrawable(

new ColorDrawable(Color.TRANSPARENT)); // 백그라운드 투명


super.onCreate(savedInstanceState);

setContentView(R.layout.activity_choose_area_dialog);


// 쿠키에 저장된 값

preferences = getSharedPreferences("saveCookie", Service.MODE_PRIVATE);


editor = preferences.edit();


Tv = (TextView) findViewById(R.id.txt_show_message);


Intent intent = getIntent();

String address = intent.getStringExtra("address");

String pos_x = intent.getStringExtra("pos_x");

String pos_y = intent.getStringExtra("pos_y");

// String addr1 = intent.getStringExtra("addr1");


Tv.setText(address);


location_B = (Button) findViewById(R.id.btn_show_message_show);

findViewById(R.id.btn_show_message_show).setOnClickListener(this);

however_B = (Button) findViewById(R.id.btn_show_message_close);

findViewById(R.id.btn_show_message_close).setOnClickListener(this);


}


public void onClick(View v) {

switch (v.getId()) {

case R.id.btn_show_message_show:


/*

* Toast.makeText(context, "현재 주소로 요청하기",

* Toast.LENGTH_SHORT).show(); Intent call_driver_dialog = new

* Intent(this, ACallSet.class);

* call_driver_dialog.putExtra("address",

* address_tv.getText().toString().trim());

* call_driver_dialog.putExtra("pos_x", GLV.strPos_x);

* call_driver_dialog.putExtra("pos_y", GLV.strPos_y);

* startActivity(call_driver_dialog);

* finish();

*/


// GPS 값을 가져오지 않은 상태에선 이용할수 없습니다.

// if(GLV.strPos_x.toString().equals("") ||

// GLV.strPos_y.toString().equals("")) return;


// 타이머 정지

// _mTimer.cancel();


editor.putString("directArrStart", Tv.getText().toString().trim());

editor.commit();

GLV.RETURN_FIRST = true;

Intent call_driver_dialog = new Intent(this, ACallSet.class);

call_driver_dialog.putExtra("address", Tv.getText().toString()

.trim());

call_driver_dialog.putExtra(CONST.EXTRA_CALL_TYPE,

CONST.CALL_TYPE_RESERVE);

startActivity(call_driver_dialog);


finish();


break;


case R.id.btn_show_message_close:


// GPS 값을 가져오지 않은 상태에선 이용할수 없습니다.

/*

* if(GLV.strPos_x.toString().equals("") ||

* GLV.strPos_y.toString().equals("")) return;

* Intent second_main_map = new Intent(this, Second_main_map.class);

* second_main_map.putExtra("address",

* Tv.getText().toString().trim());

* second_main_map.putExtra("pos_x", GLV.strPos_x);

* second_main_map.putExtra("pos_y", GLV.strPos_y);

* startActivity(second_main_map);

*/

GLV.MARKER_RESET = true;


Choose_area_dialog.this.finish();


break;


}

}


@Override

public boolean onCreateOptionsMenu(Menu menu) {

// Inflate the menu; this adds items to the action bar if it is present.

getMenuInflater().inflate(R.menu.activity_choose_area_dialog, menu);

return true;

}


}