How to start Android app development for beginners

How to start Android app development for beginners with easy steps

How to start Android app development for beginners

Creating an Android app requires the SDK (Software Development Kit), an IDE (Integrated Development Environment) Android Studio , the JDK (Java Software Development Kit)and a virtual device or any mobile phone to test on application. So all this takes work to set up now.

Getting Started :

Creating an Android app requires the SDK (Software Development Kit), an IDE (Integrated Development Environment) Android Studio , the JDK (Java Software Development Kit)and a virtual device or any mobile phone to test on application. So all this takes work to set up now.

Androidmanifest.xml:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.legendblogs.demo">

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name="com.legendblogs.demo.MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

 

R.layout.activity_main refers to the activity_main.xml file located in the res/layout folder.

activity_main.xml:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.legendblogs.demo.MainActivity">


    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textAppearance="?android:attr/textAppearanceLarge"
        android:text="Hello World!"
        android:id="@+id/textView"
        android:layout_marginTop="91dp"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true" />

    <Button
        style="?android:attr/buttonStyleSmall"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Click me"
        android:id="@+id/button"
        android:layout_marginTop="48dp"
        android:layout_below="@+id/textView"
        android:layout_centerHorizontal="true" />

</RelativeLayout>

 

strings.xml:

<resources>
    <string name="app_name">Legend Blogs Hello world</string>
</resources>

 

The main activity code is a Java file MainActivity.java.

MainActivity.java:

package com.legendblogs.demo;

import android.content.Context;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

public class MainActivity extends AppCompatActivity {

    private Context context;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        this.context = this;

        Button button_toast = (Button) findViewById(R.id.button);

        button_toast.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Toast.makeText(context,"Welcome to Android Programming",Toast.LENGTH_SHORT).show();
            }
        });

    }
}

 

Hamish Lawson made a post.
435 day ago

Hey, great share... I really liked this post as it is quite informative and useful for people who are interested in Android app development. Thanks for sharing this post. Keep sharing more. Cheers!!

Top