DEV Community

Cover image for Launch new Activity(Intent)
Anoop Patel
Anoop Patel

Posted on

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"/>
Enter fullscreen mode Exit fullscreen mode

java file:

 public void launchSettings(View v){

        //Launch a new activity

        Intent i = new Intent(this,SettingActivity.class);
        startActivity(i);
    }
Enter fullscreen mode Exit fullscreen mode

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

Top comments (0)