我有个问题 . 我创建了一个新活动,我试图将它与之前的活动联系起来 . 我创建了一个意图,该应用程序不会给我错误,但在手机上我收到了这条消息: Waiting for Debugger: force close 我必须关闭它 .

Any advice?

在意图我也尝试了这个: Intent intent = new Intent(StartScreen.this, MainActivity.class); 然后,我有这个错误:

no suitable constructor found for Intent(<anonymous OnClickListener>,Class<MainActivity>) constructor Intent.Intent(String,Uri) is not applicable (argument mismatch; <anonymous OnClickListener> cannot be converted to String) constructor Intent.Intent(Context,Class<?>) is not applicable (argument mismatch; <anonymous OnClickListener> cannot be converted to Context)

这是代码:

public class StartScreen extends AppCompatActivity {

public static final String TAG = "StartScreen";

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.start);
    Log.d(TAG, "onClick: Starting.");

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

    startBtn.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Log.d(TAG, "onClick: clicked startBtn.");

            Intent intent = new Intent(getApplicationContext(), MainActivity.class);
            startActivity(intent);
        }
    });
}}

Logcat 05-25 21:52:18.345 23261-23261 /? E / Zygote:v2 05-25 21:52:18.345 23261-23261 /? I / libpersona:KNOX_SDCARD检查这个10265 KNOX_SDCARD不是人格05-25 21:52:18.347 23261-23261 /? E / Zygote:accessInfo:0 05-25 21:52:18.347 23261-23261 /? W / SELinux:SELinux selinux_android_compute_policy_index:Policy Index [2],Con:u:r:zygote:s0 RAM:SEPF_SECMOBILE_7.0_0009,[ - -1 -1 -1 0 1] 05-25 21:52:18.350 23261- 23261 /? I / SELinux:SELinux:seapp_context_lookup:seinfo = untrusted,level = s0:c512,c768,pkgname = com.example.mariacristina.quizzz 05-25 21:52:18.356 23261-23261 /?我/艺术:迟到-Xcheck:jni 05-25 21:52:18.399 23261-23261 /? D / TimaKeyStoreProvider:TimaKeyStore未启用:无法添加TimaSignature服务和generateKeyPair服务05-25 21:52:18.659 23261-23261 / com.example.mariacristina.quizzz W / System:ClassLoader引用未知路径:/ data / app / com .example.mariacristina.quizzz-1 / lib / arm 05-25 21:52:18.698 23261-23261 / com.example.mariacristina.quizzz I / InstantRun:启动即时运行服务器:是主进程05-25 21:52: 19.245 23261-23261 / com.example.mariacristina.quizzz W / art:在Android 4.1之前,方法android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter,android.content.res . ColorStateList,android.graphics.PorterDuff $ Mode)会错误地覆盖android.graphics.drawable.Drawable 05-25 21:52:19.820 23261-23261 / com.example.mariacristina.quizzz D / TextView中的package-private方法: setTypeface with style:0 05-25 21:52:19.823 23261-23261 / com.example.mariacristina.quizzz D / TextView:se tTypeface with style:0 05-25 21:52:19.947 23261-23261 / com.example.mariacristina.quizzz D / TextView:setTypeface with style:0 05-25 21:52:19.949 23261-23261 / com.example.mariacristina .quizzz D / TextView:setTypeface with style:0 05-25 21:52:19.980 23261-23261 / com.example.mariacristina.quizzz D / TextView:setTypeface with style:0 05-25 21:52:20.027 23261-23261 /com.example.mariacristina.quizzz D / Choreographer:init sf_choreo_doframe debug_Level:0x4f4cdebug_game_running:false 05-25 21:52:20.157 23261-23261 / com.example.mariacristina.quizzz D / ViewRootImpl @ 577b63b [MainActivity]:ThreadedRenderer.create ()translucent = false 05-25 21:52:20.170 23261-23261 / com.example.mariacristina.quizzz D / InputTransport:输入通道构造:fd = 71 05-25 21:52:20.173 23261-23261 / com.example .mariacristina.quizzz D / ViewRootImpl @ 577b63b [MainActivity]:setView = DecorView @ a20c158 [MainActivity] touchMode = true 05-25 21:52:20.209 23261-23261 / com.example.mariacristina.quizzz D / ViewRootImpl @ 577b63b [MainActi vity]:dispatchAttachedToWindow 05-25 21:52:20.240 23261-23261 / com.example.mariacristina.quizzz D / ViewRootImpl @ 577b63b [MainActivity]:返回重新布局:oldFrame = [0,0] [0,0] newFrame = [ 0,0] [720,1280] result = 0x27 surface = {isValid = true -256112640} surfaceGenerationChanged = true 05-25 21:52:20.241 23261-23261 / com.example.mariacristina.quizzz D / ViewRootImpl @ 577b63b [MainActivity ]:mHardwareRenderer.initialize()mSurface = {isValid = true -256112640} hwInitialized = true 05-25 21:52:20.344 23261-23261 / com.example.mariacristina.quizzz W / art:在Android 4.1之前,方法int android . support.v7.widget.DropDownListView.lookForSelectablePosition(int,boolean)会错误地覆盖android.widget.ListView中的package-private方法05-25 21:52:20.373 23261-23277 / com.example.mariacristina.quizzz D / libEGL:loaded /vendor/lib/egl/libGLES_mali.so 05-25 21:52:20.450 23261-23277 / com.example.mariacristina.quizzz I / OpenGLRenderer:Initialized EGL,version 1.4 05-25 21:52:20.450 23261 -23277 / com . 示例.mariacristina.quizzz D / OpenGLRenderer:交换行为1 05-25 21:52:20.532 23261-23277 / com.example.mariacristina.quizzz D / mali_winsys:EGLint new_window_surface(egl_winsys_display *,void *,EGLSurface,EGLConfig,egl_winsys_surface ** ,egl_color_buffer_format *,EGLBoolean)返回0x3000,[720x1280] -format:1 05-25 21:52:21.320 23261-23261 / com.example.mariacristina.quizzz D / ViewRootImpl @ 577b63b [MainActivity]:MSG_RESIZED_REPORT:frame = Rect( 0,0-720,1280)ci = Rect(0,48-0,0)vi = Rect(0,48-0,0)或= 1 05-25 21:52:21.321 23261-23261 / com.example .mariacristina.quizzz I / Choreographer:跳过56帧!应用程序可能在其主线程上做了太多工作 .