Sam-pointer - Tin tổng hợp hay nhất trong ngày 24h qua
  • Home
  • Công Nghệ
  • Ẩm Thực
  • Du Lịch
  • Làm Đẹp
Friday, November 19, 2021
  • Home
  • Công Nghệ
  • Ẩm Thực
  • Du Lịch
  • Làm Đẹp
No Result
View All Result
Sam-pointer - Tin tổng hợp hay nhất trong ngày 24h qua
No Result
View All Result

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

July 14, 2020



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://sam-pointer.com/

Xem thêm bài viết khác: https://sam-pointer.com/cong-nghe/

Xem thêm Bài Viết:

  • Chipset B550 – Kẻ thay thế X570 với mức giá MỀM hơn rất nhiều
  • Which SSD Is Better – Samsung 860 PRO vs 850 PRO SSD
  • Installing Samsung Evo 860 250Gb SSD in G41 Board | Unbox, Review & how to install OS in ssd + HDD
  • Samsung 860 EVO Review and Installation
  • Lounch Startup Repair Windows 7 #Start Windows Normally #Blue Screen Starting Windows
admin

admin

Related Posts

Chipset B550 được đánh giá rất cao 
Công Nghệ

Chipset B550 – Kẻ thay thế X570 với mức giá MỀM hơn rất nhiều

July 26, 2021

Con Chipset B550 AMD do chính Asmedia thiết kế là các bo mạch chủ để thiết kế con chip này được phát hành vào năm 2020. Gần một năm sau khi AMD X570 ra mắt thì B550 mới xuất...

Which SSD Is Better – Samsung 860 PRO vs 850 PRO SSD
Công Nghệ

Which SSD Is Better – Samsung 860 PRO vs 850 PRO SSD

July 11, 2021

Samsung 860 PRO SSD US: UK: CA: DISPLATE METAL POSTERS Awesome graphic prints made out of metal: 10% Off Discount Code: HAURJIE10 FOLLOW ME Twitter | Facebook | Instagram - @haurjie MY WORKSTATION (US Links) CPU: GPU: PSU: RAM:...

Installing Samsung Evo 860 250Gb SSD in G41 Board | Unbox, Review & how to install OS in ssd + HDD
Công Nghệ

Installing Samsung Evo 860 250Gb SSD in G41 Board | Unbox, Review & how to install OS in ssd + HDD

July 11, 2021

Installing Samsung Evo 860 250Gb SSD in G41 Board | Unbox, Review & how to install OS in ssd + HDD] Buy on amazon india - // amazon USA - flipkart - ebay india ...

Samsung 860 EVO Review and Installation
Công Nghệ

Samsung 860 EVO Review and Installation

July 11, 2021

The newest edition to the world’s best-selling SATA SSD series, the Samsung 860 EVO. Specially designed for mainstream PCs and laptops, with the latest V-NAND and a robust algorithm-based controller, this fast and reliable SSD comes in a wide...

Comments 40

  1. Coding in Flow says:
    1 year ago

    * * *
    I added a link to the code for this video into the description box!
    * * *

    Reply
  2. Issa Joke says:
    1 year ago

    Thank you so much, this is really simple.

    Reply
  3. laggerbraggerYT says:
    1 year ago

    it works on me but somehow it cant stop making click noises.

    Reply
  4. Flávio Martins says:
    1 year ago

    are you a german speaker?

    Reply
  5. Tom G says:
    1 year ago

    Very Nice and concise video. Well Done!
    I was wondering what code changes would be needed if you had two or buttons on the same page or in a list.
    Thanks for taking the time to develop this.

    Reply
  6. Amirhosein Az says:
    1 year ago

    intent intent new intent intent activity intent intent
    bro just use some different words someone like me who is new to java wont get it

    Reply
  7. 17ITR033 INDUMATHI PRIYA. S says:
    1 year ago

    Sir how to create label and textbox in android studio

    Reply
  8. Jonasz Przybycień says:
    1 year ago

    Upon clicking I get the generic "Unfortunatley, the app has stoped working" error. My repo is different than yours but I've copied your steps:
    https://github.com/Zemogiter/AmaWeatherApp
    Any help?

    Reply
  9. ZepicTube says:
    1 year ago

    is this java

    Reply
  10. Rafael Pérez Rodríguez says:
    1 year ago

    Thnks so much

    Reply
  11. Ehsan Akhondzada says:
    1 year ago

    Are you German?

    Reply
  12. Karthik Krishna says:
    1 year ago

    For the button.OnClickListener(), the button shows as expected class or package, how do I resolve it?

    Reply
  13. Franz DE says:
    1 year ago

    it crashes

    Reply
  14. Sara Briccoli says:
    1 year ago

    I had a problem, it says "AAPT: error: resource string/action_settings (aka com.example.myapp:string/action_settings) not found."
    In particulary it's missing the main.xml:4…. I only had content_main and actvity_main… I didn't have main
    what should I do? I didn't use your code, but I needed to make the button open another activity
    Please, help me

    Reply
  15. Moura Amirah says:
    1 year ago

    hii your video is very useful and easy to understand!!

    can i ask a question, so im making expert system on android studio, how can i make the button open another activity? so i can open multiple activitu with just one button

    Reply
  16. Linuxgamer says:
    1 year ago

    are you a german guy ?

    Reply
  17. Ice Breaker says:
    1 year ago

    Sir your tutorials are the best! Please keep it up you are such a big help!

    Reply
  18. Sohaib Shahbaz says:
    1 year ago

    package com.example.application.myapplication;

    import android.content.Intent;

    import android.support.v7.app.AppCompatActivity;

    import android.os.Bundle;

    import android.view.View;

    import android.widget.Button;

    public class MainActivity extends AppCompatActivity {

    private Button button;

    @Override

    protected void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_main);

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

    button.setOnClickListener(new View.OnClickListener() {

    @Override

    public void onClick(View v) {

    openActivity2();

    }

    });

    }

    public void openActivity2() {

    Intent intent = new Intent(this, Activity2.class);

    startActivity(intent);

    }

    }

    Reply
  19. Bearded coder says:
    1 year ago

    For more info on intents and how to pass data from one activity to another watch this:-
    https://youtu.be/BY5MtRrAMP8

    Reply
  20. Sonic the Hedgehog says:
    1 year ago

    Thx Bro the German accent is nice.

    Reply
  21. Atharva Dixit says:
    1 year ago

    Hi, thanks for the video first up! I'm having a slight problem though. I try to open another activity having google map in it, and it briefly opens for a second, after which it closes and says "App keeps stopping". What should I do? Please help!

    Reply
  22. Daaboo says:
    1 year ago

    how do you make a second button open a second Activity?

    Reply
  23. Sajjad Ahmad says:
    1 year ago

    In Designe View then button and Textview is not moving in LinearLayout Plz help

    Reply
  24. Sourav Lakshan says:
    1 year ago

    I can't edit the activity_main_XML file…even copy & paste also not working inside the file..can u help me pls

    Reply
  25. Amulya Ponnuru says:
    1 year ago

    are you android god? thank you soo much for the video

    Reply
  26. Akshat Sharma says:
    1 year ago

    Uncaught TypeError: Cannot read property 'update' of undefined

    this is the error im facing . the app keeps on crashing as soon as i press the button

    Reply
  27. patrickFREE says:
    1 year ago

    Sehr gutes Video danke wieder dafür, doch wieso änderst du in der xml Datei das Layout immer in Relative ?

    Reply
  28. bob joe says:
    1 year ago

    Ah yes, knowledge, give me some of that.

    Reply
  29. Lis Amari says:
    1 year ago

    this guy is just awesome. thank you for your all effort.

    Reply
  30. Zhenya Tevo says:
    1 year ago

    Thank you for the video! It helped me a lot👍

    Reply
  31. Nirmal Bista says:
    1 year ago

    how to make online and offline both on android studio project please tell me

    Reply
  32. Nirmal Bista says:
    1 year ago

    how to connect navigation drawer to main activity

    Reply
  33. Hichem Amri says:
    1 year ago

    the BG called ic_poule1 is an SVG file introduced in Drawable file as XML file

    Reply
  34. Hichem Amri says:
    1 year ago

    This is my xml_main

    <ImageButton
    android:id="@+id/btn2"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginBottom="344dp"
    android:background="@drawable/ic_poule1"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintHorizontal_bias="0.498"
    app:layout_constraintStart_toStartOf="parent" />

    Reply
  35. Hichem Amri says:
    1 year ago

    I have used but the button desapears when i click on.
    public class MainActivity extends AppCompatActivity {
    ImageSwitcher btn2;
    int mDefaultColor;
    @SuppressLint("WrongViewCast")
    @Override
    protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    mDefaultColor = ContextCompat.getColor(MainActivity.this,R.color.colorAccent);
    btn2 = findViewById(R.id.btn2);
    btn2.setOnClickListener(new View.OnClickListener() {
    @RequiresApi(api = Build.VERSION_CODES.M)
    @SuppressLint("ResourceType")
    @Override
    public void onClick(View v) {
    openColorPicker();

    }
    });
    }
    public void openColorPicker(){
    AmbilWarnaDialog colorPicker = new AmbilWarnaDialog(this, mDefaultColor, new AmbilWarnaDialog.OnAmbilWarnaListener() {
    @Override
    public void onCancel(AmbilWarnaDialog dialog) {

    }

    @Override
    public void onOk(AmbilWarnaDialog dialog, int color) {
    mDefaultColor = color;
    btn2.setBackgroundResource(R.drawable.ic_poule1);
    btn2.setBackgroundColor(color);
    //btn2.R.drawable.ic_poule1.setColor(color);

    }
    });
    colorPicker.show();
    }
    }

    Reply
  36. Hichem Amri says:
    1 year ago

    can you please help me color the backGround of button witch is an animal by clicking on the button.

    Reply
  37. Sharon Goh says:
    1 year ago

    Hi, I wonder the changing of background tint, size, margins of the buttons will affect the function of the button? Cuz I followed what you showed it works at first, but after I changed the background tint and margin all that minor changes it turns out buttons did not show in the emulator…i need help…

    Reply
  38. Bruin_ YT says:
    1 year ago

    I cant put the text in the middle

    Reply
  39. Name Last Name says:
    1 year ago

    I can't center the buttons. I am thinking it is because Android is an inferior technology from hell

    Reply
  40. gunaputra wardhana says:
    1 year ago

    mine says the app keeps stopping. how to solve it?

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Xem Thêm

[ADR! Review] Trải nghiệm phòng Tổng Thống tại Vinpearl HaLong resort

[ADR! Review] Trải nghiệm phòng Tổng Thống tại Vinpearl HaLong resort

July 13, 2020
[Bí kíp du lịch] Cách săn vé máy bay giá rẻ chặng nội địa: Đà Nẵng, Hà Nội, Phú Quốc…

[Bí kíp du lịch] Cách săn vé máy bay giá rẻ chặng nội địa: Đà Nẵng, Hà Nội, Phú Quốc…

July 8, 2020
[Hướng dẫn] Cách sử dụng Voucher Vinpearl khi đặt phòng khách sạn

[Hướng dẫn] Cách sử dụng Voucher Vinpearl khi đặt phòng khách sạn

July 7, 2020
#3tr988 Tour du lịch Hà Giang – Lũng Cú – Đồng Văn – Mã Pì Lèng – Sông Nho Quế 4N3Đ Gồm vé máy bay

#3tr988 Tour du lịch Hà Giang – Lũng Cú – Đồng Văn – Mã Pì Lèng – Sông Nho Quế 4N3Đ Gồm vé máy bay

July 15, 2020
#QVĐVN – Tập 3 – Xuyên Rừng Đước Đất Mũi Cà Mau (với diễn viên Duy Luân)

#QVĐVN – Tập 3 – Xuyên Rừng Đước Đất Mũi Cà Mau (với diễn viên Duy Luân)

July 16, 2020
10 Điều Thú Vị Về Campuchia

10 Điều Thú Vị Về Campuchia

July 17, 2020
  • Chính Sách Bảo Mật
  • Liên Hệ

Copyright © 2020 By sam-pointer

No Result
View All Result
  • Chính Sách Bảo Mật
  • Liên Hệ
  • Sam-pointer – Tin tổng hợp hay nhất trong ngày 24h qua