Structure of the Problem Requirements
Hi developers, we are going to started working on android application. In this tutorial we will make a simple app which contain some text and app logo. This simple app consist on one main class with the name MainActivity.java and a activitymain.xml file and a string class which contain the text of app.Here is the source code of this app which help you in better understanding.
SOURCE CODE
MainActivity.java
packagewww.ancodingpoint.com;
importandroid.os.Bundle;
importandroid.app.Activity;
importandroid.view.Menu;
public classMainActivity extendsActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
}
<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"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity" >
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="@string/hello_world"
android:textSize="20sp" />
</RelativeLayout>
<?xml version="1.0"encoding="utf-8"?>
<resources>
<string name="app_name">Myfirstandriodapp</string>
<string name="action_settings">Settings</string>
<string name="hello_world">This is my first android post</string>
Asad Niazi is Software Engineer , Programmer, Web Developers and a young mentor of Tech Solutions Desk and Blogging Solutions . Asad Love to writes about Technology, Programming, Blogging and make money online.
Dear you are using old Emulator ..... Now there is some good stuff as like geny motion and other are online and now android lollipop 5.0 come into market and enjoy that version ...
ReplyDelete