거리를 구하는건 만들었습니다.

여기에 거리를 if문으로 돌려서 얼마 보다 작으면 음악이 나오게 하려 하는데

미디어 플레이어를 썻는데

거리가 작아져서 음악이 실행되야 할상황에 액티비티가 죽습니다 왜그럴까요?

 

    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
 
        // 텍스트뷰를 찾는다
        tvLatitude = (TextView)findViewById(R.id.tvLatitude);
        tvLongitude = (TextView)findViewById(R.id.tvLongitude);
        tvDistance = (TextView)findViewById(R.id.tvDistance);
       
        // LocationListener의 핸들을 얻는다
        lm =(LocationManager)getSystemService(Context.LOCATION_SERVICE);       
       
        //GPS 위치 서비스에 연결한다
        Location loc = lm.getLastKnownLocation("gps");
        MediaPlayer mp;

        mp.create(this, R.raw.test);

       
        if(loc!=null) {
         // TextView를 채운다
         tvLatitude.setText(Double.toString(loc.getLatitude()));
         tvLongitude.setText(Double.toString(loc.getLongitude()));
         tvDistance.setText(Double.toString(distance));
         

            // Location Manager에게 위치정보를 업데이트해달라고 요청한다.
            locListenD = new DispLocListener();
            lm.requestLocationUpdates("gps", 3000L, 10.0f, locListenD);  
           
            la=35.178456;
            lo=126.909299;
           
            Location locationA = new Location("point A");
            locationA.setLatitude(loc.getLatitude());
            locationA.setLongitude(loc.getLongitude());
           
            Location locationB = new Location("point B");
            locationB.setLatitude(la);
            locationB.setLongitude(lo);
           
            distance = locationA.distanceTo(locationB);
        }
        /*else {
         Log.d("location", "location is null");
        }
        */
       
    }

    private class DispLocListener implements LocationListener {
     public void onLocationChanged(Location location) {
      // TextView를 업데이트 한다.
      tvLatitude.setText(Double.toString(location.getLatitude()));
      tvLongitude.setText(Double.toString(location.getLongitude()));
         tvDistance.setText(Double.toString(distance));

        distance = locationA.distanceTo(locationB);
    if(distance<100){

mp.start();

}else mp.reset;

     }
     public void onProviderDisabled(String provider) {
     }
     public void onProviderEnabled(String provider) {
     }
     public void onStatusChanged(String provider, int status, Bundle extras) {
     }
    }
}