skip to Main Content

IS there any wrong in my code? I tried many times but i couldn’t solve the issue please help me?
when i click on Text_view it’s just blink but didn’t move the next activity..

[[[[enter image description here](https://phpout.com/wp-content/uploads/2023/08/gN3du.png)](https://phpout.com/wp-content/uploads/2023/08/hFomx.png)](https://phpout.com/wp-content/uploads/2023/08/qgPvT.png)](https://phpout.com/wp-content/uploads/2023/08/yAD7b.png)

I tired that when i click on text then open a new page in my app..but it’s just blink but not opening any page.

2

Answers


  1. Please name your activities differently. Not MainActivity2, but SomethingElseActivity. I am having a hard time to understand what’s going on and I’m not a beginner.

    Login or Signup to reply.
  2. A few things:

    1)Don’t post links to images of code. Post the actual code in your question.

    2)Intent isn’t a keyword. It’s a class. You’re creating a new instance of it. If you don’t understand that, you really need to be studying the basics and probably working on something a lot simpler than an Android app right now.

    3)Your parameters to your intent are wrong. You’re passing it MainActivity as the Activity class to launch. That means it will just launch the same activity again (hence the blinking). You want the second parameter to be MainActivity2.class. And like the other guy said- rename both of those classes to be specific to what the class actually does. One MainActivity class is a bit of a smell, but acceptable. Two is not.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search