Simple Hello World Program
Let's start programming with Android Framework. Before you start writing your first programme using Android SDK, you have to make sure that you have set-up your Android development environment properly as explained in Android tutorial. I also assume that you have a little bit working knowledge with Android studio.
So let's start writing a simple Android Application which will print "Hello World!".
The first step is to create a simple Android Application using Android studio. When you start Android studio , it will show screen as shown below:
select start a new android studio project option. In a new installation frame should ask Application name, package information and location of the project as shown below:
After select API, click on next button it ask which Activity you want, I have choose a Empty Activity as shown below:
the design view code that is MainActivity.xml is as shown below
<android .support.constraint.constraintlayout="" android:layout_height="match_parent" android:layout_width="match_parent" tools:context="hp.hello.MainActivity" 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"> <textview android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="Hello World!" app:layout_constraintbottom_tobottomof="parent" app:layout_constraintleft_toleftof="parent" app:layout_constraintright_torightof="parent" app:layout_constrainttop_totopof="parent"/> </constraintlayout">
your pakage name; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } }
You can see the launch Button( ) below the MenuBar it is used to run the app There is a two way to run your project
In Emulator
In Your device
Before Run your project Make sure that your Emulator is created And its SDK Platform is which you select at the time of project creation.
Comments
Post a Comment