Launch new Activity(Intent)

XML file:

<Button
android:id=”@+id/btn”
android:onClick=”launchSettings”
android:text=”button”
android:layout_width=”wrap_content”
android:layout_height=”wrap_content”/>

java file:


This content originally appeared on DEV Community and was authored by Anoop Patel

XML file:

 <Button
           android:id="@+id/btn"
           android:onClick="launchSettings"
           android:text="button"
           android:layout_width="wrap_content"
           android:layout_height="wrap_content"/>

java file:

 public void launchSettings(View v){

        //Launch a new activity

        Intent i = new Intent(this,SettingActivity.class);
        startActivity(i);
    }

After adding these functionality you will be able to launch new Activity.


This content originally appeared on DEV Community and was authored by Anoop Patel


Print Share Comment Cite Upload Translate Updates
APA

Anoop Patel | Sciencx (2024-09-22T05:19:57+00:00) Launch new Activity(Intent). Retrieved from https://www.scien.cx/2024/09/22/launch-new-activityintent/

MLA
" » Launch new Activity(Intent)." Anoop Patel | Sciencx - Sunday September 22, 2024, https://www.scien.cx/2024/09/22/launch-new-activityintent/
HARVARD
Anoop Patel | Sciencx Sunday September 22, 2024 » Launch new Activity(Intent)., viewed ,<https://www.scien.cx/2024/09/22/launch-new-activityintent/>
VANCOUVER
Anoop Patel | Sciencx - » Launch new Activity(Intent). [Internet]. [Accessed ]. Available from: https://www.scien.cx/2024/09/22/launch-new-activityintent/
CHICAGO
" » Launch new Activity(Intent)." Anoop Patel | Sciencx - Accessed . https://www.scien.cx/2024/09/22/launch-new-activityintent/
IEEE
" » Launch new Activity(Intent)." Anoop Patel | Sciencx [Online]. Available: https://www.scien.cx/2024/09/22/launch-new-activityintent/. [Accessed: ]
rf:citation
» Launch new Activity(Intent) | Anoop Patel | Sciencx | https://www.scien.cx/2024/09/22/launch-new-activityintent/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.