Android Remove arguments to match “intent()”

后端 未结 2 2019
一整个雨季
一整个雨季 2021-01-20 20:42

I am trying to start a second activity but I am getting an error on the code.

import android.os.Bundle;
import android.content.Intent;
import android.app.Act         


        
2条回答
  •  暖寄归人
    2021-01-20 21:28

    What your trying to pass in as a context is actually onActionItemClickListener() which will not work.

    Should use getBaseContext().

    Intent intent = new Intent(getBaseContext(), SplashActivity.class);

    Edit: Or you could do

    Intent intent = new Intent(MainActivity.this, SplashActivity.class);

提交回复
热议问题