Develop you first Android App using Android Studio



In this lecture we are going to develop our first android app i-e "Hello world".First Open you android studio by clicking on the home button that appears on the left bottom of your computer screen.



After that go to your menu tab of android studio and click on the file,then click on new and select new project.Then follow the steps and select empty activity,android version and give name to your activity and click finish.After that wait for some time until your project build successfully.There will be two tabs on the screen one is "XML" and the other will be "Java" activity.In "XML" you design your layout and in "Java" activity you write your code.In XML activity take a text-view,give an id to it.
Code to Develop your first app using Android Studio

<TextView    android:id="@+id/textView"    android:layout_width="wrap_content"    android:layout_height="wrap_content"    android:text="Hello World!"    android:textSize="30dp"    app:layout_constraintBottom_toBottomOf="parent"    app:layout_constraintLeft_toLeftOf="parent"    app:layout_constraintRight_toRightOf="parent"    app:layout_constraintTop_toTopOf="parent" />

That's all done for XML activity.Now it's time to write some java code.

package com.example.sohailmustafa.helloworld;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.TextView;

public class MainActivity extends AppCompatActivity {
    TextView textView;
    @Override    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        textView=(TextView) findViewById(R.id.textView);
    }
}

This is all done,Now run your app by following the procedure




Click on the run button select your device, you have developed your first app using android studio.In our next lecture we will learn how 
to change the text on button click.If you have any difficulty in this lecture don't hesitate
to ask.God bless you all,have a good day.






HAPPY CODING

Develop your first app using Android Studio

Comments

  1. Awesone tutorial.You are a life saver.waiting for next lecture impatiently

    ReplyDelete

Post a Comment