Creating an intent in a new method

后端 未结 5 1262
失恋的感觉
失恋的感觉 2021-01-06 05:43

So I want an intent to start an Activity that simply brings up a dialog popup box telling the user how to use the app.

I have the code:

private final         


        
5条回答
  •  感动是毒
    2021-01-06 06:19

    The intent needs a context. However, using the this shortcut in the onClick function is not properly resolved. Different ways to provide current context in an anonymous inner class are - Use Context.this instead of this. - Use getApplicationContext() instead of this. - Explicitly use the class name MenuScreen.this. Call a function that is declared at the right context level.

提交回复
热议问题