<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity"
android:gravity="center">
<Button
android:id="@+id/message_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Show Message"/>
</LinearLayout>
setContentView(R.layout.activity_main);
here is the button click code
//Its a code for a button click that we declare in activity_main.xml file
findViewById(R.id.message_btn).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//Its a code to show the message on the screen
Toast.makeText(MainActivity.this, "Hello Hive", Toast.LENGTH_SHORT).show();
}
});
| App on Mobile | Button Clicked |
|---|---|
Hello Friends I am Muhammad Faisal Amin. My country is Pakistan. nI live in a city of Pakistan named Faisalabad. I love my country.
I am 21 years old in 2020.
I study in Software Engineering in University of Agriculture Faisalabad Main Campus it also knows as UAF.
Its a very beautiful University and the biggest University in Asia.
I am also having experiences in MObile App Development using Java Android and Flutter also.
Its my passion to develop quality app for both iPhone and Android Mobiles.