This Android project demonstrates a simple launcher app with two activities. The main activity (MainActivity.java) allows you to launch a second activity (SecondActivity.java) within the app and also open a web page outside the app.
packagecom.example.quicklauncherapp; importandroidx.appcompat.app.AppCompatActivity; importandroid.content.Intent; importandroid.net.Uri; importandroid.os.Bundle; importandroid.view.View; importandroid.widget.Button; publicclassMainActivityextendsAppCompatActivity{@OverrideprotectedvoidonCreate(BundlesavedInstanceState){super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // Button to launch the SecondActivity within the appButtonb_secondActivity = findViewById(R.id.b_secondActivity); b_secondActivity.setOnClickListener(newView.OnClickListener(){@OverridepublicvoidonClick(Viewview){// Creating an Intent to start the SecondActivityIntentstartIntent = newIntent(getApplicationContext(), SecondActivity.class); startIntent.putExtra("Something Bro!", "Hello World! You are in the Second Activity."); startActivity(startIntent)} }); // Button to open Google in a web browserButtonb_google = findViewById(R.id.b_google); b_google.setOnClickListener(newView.OnClickListener(){@OverridepublicvoidonClick(Viewview){// Creating an Intent to open a web pageStringgoogle = "https://www.google.com"; Uriweb_address = Uri.parse(google); Intentbrowser_Intent = newIntent(Intent.ACTION_VIEW, web_address); startActivity(browser_Intent)} })} }packagecom.example.quicklauncherapp; importandroidx.appcompat.app.AppCompatActivity; importandroid.os.Bundle; importandroid.widget.TextView; publicclassSecondActivityextendsAppCompatActivity{@OverrideprotectedvoidonCreate(BundlesavedInstanceState){super.onCreate(savedInstanceState); setContentView(R.layout.activity_second); // Checking if the Intent has extra dataif (getIntent().hasExtra("Something Bro!")){// Displaying the passed data in the SecondActivityTextViewtv_secondActivity = findViewById(R.id.tv_secondActivity); Stringtext = getIntent().getExtras().getString("Something Bro!"); tv_secondActivity.setText(text)} } }This simple Android app showcases the basic usage of Intents to launch activities within the app and open external web pages. The communication between activities is demonstrated through passing data using putExtra and retrieving it using getExtras().getString().


