![](https://static.wixstatic.com/media/665bba_a1fb8b2aebf44df0b7c1434e4537aadc~mv2.jpg/v1/fill/w_980,h_551,al_c,q_85,usm_0.66_1.00_0.01,enc_auto/665bba_a1fb8b2aebf44df0b7c1434e4537aadc~mv2.jpg)
Let us start actual programming with Android Framework. Before you start writing your first example using Android SDK, you have to make sure that you have set-up your Android development environment properly as explained in Previous tutorial. I also assume that you have a little bit working knowledge with Android studio.
So let us proceed to write a simple Android Application which will create button "Click Me".
Steps For Creating Your first App -
Install Android Studio: Download and install the latest version of Android Studio from the official website (as told earlier)
Create a new project: Launch Android Studio and select "Create New Project" from the main screen.
![](https://static.wixstatic.com/media/665bba_5c9b92d568c54eb4baf46cda357ace8e~mv2.png/v1/fill/w_980,h_377,al_c,q_90,usm_0.66_1.00_0.01,enc_auto/665bba_5c9b92d568c54eb4baf46cda357ace8e~mv2.png)
Choose activity type: Select "Empty Activity" or any other activity type that suits your app.
![](https://static.wixstatic.com/media/665bba_c40ada5de29544e387bb9464ae4d0182~mv2.png/v1/fill/w_980,h_630,al_c,q_90,usm_0.66_1.00_0.01,enc_auto/665bba_c40ada5de29544e387bb9464ae4d0182~mv2.png)
Click on NEXT and Enter your application name, package name, and other details as required.
![](https://static.wixstatic.com/media/665bba_7403b9aab1d2409482b3d76194e36ebb~mv2.png/v1/fill/w_980,h_627,al_c,q_90,usm_0.66_1.00_0.01,enc_auto/665bba_7403b9aab1d2409482b3d76194e36ebb~mv2.png)
Design the user interface: Open the activity_main.xml file from the "res/layout" folder and design the user interface using drag-and-drop or by editing the XML code. And Copy paste the code given below -
<Button
android:id="@+id/myButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Click me!"
tools:ignore="MissingConstraints" />
Your Screen will look as shown below -
![](https://static.wixstatic.com/media/665bba_13e044d172214ad9b469b4ba871d0f1c~mv2.png/v1/fill/w_980,h_573,al_c,q_90,usm_0.66_1.00_0.01,enc_auto/665bba_13e044d172214ad9b469b4ba871d0f1c~mv2.png)
Your Design section will look as shown below -
![](https://static.wixstatic.com/media/665bba_9407a7a634c245edbc2af280ea570fbb~mv2.png/v1/fill/w_980,h_575,al_c,q_90,usm_0.66_1.00_0.01,enc_auto/665bba_9407a7a634c245edbc2af280ea570fbb~mv2.png)
Add functionality to the app: Open the MainActivity.java file and add the required code to implement the app functionality. For example, you can add an onClickListener to a button to perform an action when the button is clicked.
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button myButton = findViewById(R.id.myButton);
myButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
// Perform action when button is clicked
Toast.makeText(MainActivity.this, "Button clicked!", Toast.LENGTH_SHORT).show();
}
});
}
}
Build and run the app: Click on the "Run" button in Android Studio to build and run the app on an emulator or a physical device. Application will look like this -
![](https://static.wixstatic.com/media/665bba_849f8b0380fb4003b0acf3493473c7e3~mv2.png/v1/fill/w_980,h_1854,al_c,q_90,usm_0.66_1.00_0.01,enc_auto/665bba_849f8b0380fb4003b0acf3493473c7e3~mv2.png)
![](https://static.wixstatic.com/media/665bba_3b4acfb98da94a6cb316b9ffbdc68f8b~mv2.png/v1/fill/w_980,h_1854,al_c,q_90,usm_0.66_1.00_0.01,enc_auto/665bba_3b4acfb98da94a6cb316b9ffbdc68f8b~mv2.png)
Congratulations! you created first app in Java ✨
I hope this step-by-step guide has helped you in creating your first Android app in Java. Remember that this is just the beginning, and there is a lot more to learn about Android app development.
As you continue to learn and explore, be sure to reference the official Android documentation and developer guides, as well as online resources and communities, to expand your knowledge and skills.
Thanks for reading, and happy coding!
Master Android Development in Java Series part-5 -> Exploring Android Application Components in detail: Activities, Services and many more..