-1
 Thread [<1> main] (Suspended (exception RuntimeException)) 
<VM does not provide monitor information>   
ActivityThread.performLaunchActivity(ActivityThread$ActivityClientRecord, Intent) line: 2180    
ActivityThread.handleLaunchActivity(ActivityThread$ActivityClientRecord, Intent) line: 2230 
ActivityThread.access$600(ActivityThread, ActivityThread$ActivityClientRecord, Intent) line: 141    
ActivityThread$H.handleMessage(Message) line: 1234  
ActivityThread$H(Handler).dispatchMessage(Message) line: 99 
Looper.loop() line: 137 
ActivityThread.main(String[]) line: 5041    
Method.invokeNative(Object, Object[], Class, Class[], Class, int, boolean) line: not available [native method]  
Method.invoke(Object, Object...) line: 511  
ZygoteInit$MethodAndArgsCaller.run() line: 793  
ZygoteInit.main(String[]) line: 560 
NativeStart.main(String[]) line: not available [native method]  

我不知道为什么它甚至无法启动该活动。

这是正在启动的活动

import android.app.Activity;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.view.Menu;
import android.view.View;
import android.widget.Toast;

import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GooglePlayServicesUtil;
import com.google.android.gms.maps.CameraUpdate;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.MapFragment;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MarkerOptions;

 public class GymFind extends FragmentActivity {

private final LatLng LOCATION_BURNABY = new LatLng(49.27645, -122.917587);
private final LatLng LOCATION_SURRREY = new LatLng(49.187500, -122.849000);
private GoogleMap map;

@Override
protected void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    setContentView(R.layout.gmaps);


      map  = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();

      map.addMarker(new MarkerOptions().position(LOCATION_BURNABY).title("Find us here!"));
      map.addMarker(new MarkerOptions().position(LOCATION_SURREY).title("Find us here!"));
      map.addMarker(new 

final int RQS_GooglePlayServices = 1;
@Override
 protected void onResume() {
  // TODO Auto-generated method stub
  super.onResume();

  int resultCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(getApplicationContext());

  if (resultCode == ConnectionResult.SUCCESS){
   Toast.makeText(getApplicationContext(), 
     "isGooglePlayServicesAvailable SUCCESS", 
     Toast.LENGTH_LONG).show();
  }else{
   GooglePlayServicesUtil.getErrorDialog(resultCode, this, RQS_GooglePlayServices);
  }

 }


@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.main, menu);
    return true;
}

 }

这是启动活动的地方

  import android.app.Activity;
  import android.os.Bundle;
  import android.widget.Button;
  import android.view.View;
  import android.view.View.OnClickListener;
  import android.content.Intent;


   public class Home extends Activity {

@Override
public void onCreate(Bundle savedInstanceState) {
     super.onCreate(savedInstanceState);

     setContentView(R.layout.homie);

     Button button1 = (Button) findViewById(R.id.button1);

     Button button2 = (Button) findViewById(R.id.button2);

     button1.setOnClickListener(new OnClickListener() {
         public void onClick(View v) {

             Intent i = new Intent(Home.this,GymFind.class);
             Home.this.startActivity(i);

         }
     });
     button2.setOnClickListener(new OnClickListener() {
         public void onClick(View v) {

             Intent i = new Intent(Home.this,EmailUs.class);
             Home.this.startActivity(i);


         }
     });
 }
   }

我非常怀疑我是否能完成这项工作,但如果你们愿意帮助我,我会非常高兴。

4

1 回答 1

0

堆栈跟踪应该在底部包含一个“Caused by”......或者如果您在调试器中查看它,应该有一个“cause”变量或类似的东西。我建议让它崩溃,然后检查 android 日志 - 它肯定会在日志的堆栈跟踪下打印“Caused by”。

问题是 Android 无法启动您的活动。最常见的原因是: 1. 您没有在 AndroidManifest.xml 中声明活动 2. 您在 onCreate 中的代码(或其他被覆盖的方法)抛出异常 检查您的“Caused by”,您会找到确切的原因.

于 2013-07-22T22:20:28.863 回答