Java 打开新活动会使我的应用程序崩溃

Java 打开新活动会使我的应用程序崩溃,java,android,android-activity,android-fragmentactivity,Java,Android,Android Activity,Android Fragmentactivity,我不知道这个错误是在我用来打开活动的代码中,还是在活动本身中。这是打开活动的代码,请告诉我是否有错误,或者是其他错误 public void openGallery(View view){ Intent intent = new Intent(this, PhotoGallery.class); startActivity(intent); } 你必须为任何人发布崩溃日志,以便在这方面为你提供任何有意义的帮助。另外,发布PhotoGallery活动的onCreate()中的代码

我不知道这个错误是在我用来打开活动的代码中,还是在活动本身中。这是打开活动的代码,请告诉我是否有错误,或者是其他错误

public void openGallery(View view){
    Intent intent = new Intent(this, PhotoGallery.class);
    startActivity(intent);
}

你必须为任何人发布崩溃日志,以便在这方面为你提供任何有意义的帮助。另外,发布
PhotoGallery
活动的
onCreate()
中的代码也会很有帮助,因为问题可能是从该代码中产生的。代码看起来不错。展示你的撞车记录。可能:Intent Intent=新Intent(CurrentActivity.this,PhotoGallery.class);我会成功的。为什么要将视图作为参数传递而不使用它?请发布崩溃日志和“PhotoGallery”代码。特别是该活动,或者是任何活动导致了它?多任务退出应用程序并再次返回是否会导致崩溃?LogCat在打开活动时会说什么?