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)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Explore a sea of insights with this enlightening post, highly esteemed within the nurturing DEV Community. Coders of all stripes are invited to participate and contribute to our shared knowledge.

Expressing gratitude with a simple "thank you" can make a big impact. Leave your thanks in the comments!

On DEV, exchanging ideas smooths our way and strengthens our community bonds. Found this useful? A quick note of thanks to the author can mean a lot.

Okay