DEV Community

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

Posted on

1

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)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more