How to Make a Button Open a New Activity – Android Studio Tutorial

26
3



In this video we will learn, how to open a new Activity from a Button click. For this we will create a new Intent and pass it to the startActivity method.

Example code for this video:

____________________
❗ Subscribe to the channel:

⏯ Watch more tutorials:

⭐ Become a channel member for exclusive tutorials and other perks:

㊙ Help translating the videos:

💚 Support the content:

💬 Join the Discord chat:

🎧 Audiobooks and podcasts for programmers:

👶 How to get started with Android development:

📣 Follow Coding in Flow on social media:

Facebook:

Instagram:

Twitter:

Blog:

Nguồn:https://wijstaanvooronzegrondrechten.org/

Xem Thêm Bài Viết Khác:https://wijstaanvooronzegrondrechten.org/cong-nghe

26 COMMENTS

  1. In my app, if I do this, by pressing back button the app simply closes and doesn't go back to the main activity. How to solve this issue?

  2. I read about 10 hours in a book for beginners, learned a lot about Android concepts and the first complex programs, but not such a simple thing which I learned here in under 3 minutes. THAT'S efficient! Thanks!

  3. Pro, I have a problem with button when I click on it without enter anything in the Edittext , app stops. why and how can I solve it.

  4. Thanks a lot for this to the point tutorial but do we need to change the Constraint layout to a Relative ?
    It works absolutely fine with the Constraint one also.

  5. Hi

    I wanted to ask if you can help me, I have a problem

    Add: View Pager Dots Indicator

    To the next Post:

    https://www.youtube.com/watch?v=BFpru2l2jjs

    In the activity of size of the Normal photos (4 photos) the Dot is perfect, it is related to the number of the photo. For example Photo 3, Dot 3.

    But when I click on any of them to use PhotoView (pass the data to another activity)

    The Dot always starts in position 1. For example I enlarge photo 3 but the Dot is in position 1.

    Can you help me how to fix it?

    Many thanks

  6. I got a problem but not with your tutorial but i need your help , i have a list view and i performed a click listener with position as an intent but the problem is i get error message says condition position 1 always false and the only item on my list that responds correctly to clicks is the first one ?? Would you please help me?

  7. This code works, but in new versions of Android Studio some modification are needed, I will post the working code for recent version that works for me https://github.com/ambiorixg12/android

  8. I noticed that when you dragged the text at 0:57 the code to center the text was automatically added. That doesn't seem to happen for me. The text is automatically moved back to where it was after I release the left mouse button. What am I doing wrong?

LEAVE A REPLY

Please enter your comment!
Please enter your name here