.
101-Learn Android On Programmr
www.programmr.com provides a learning platform for beginners to learn Android Apps Development without having to install anything on their computer.
You need to register an account with www.programmr.com before start using the platform.
After registration is done, go to the URL http://www.programmr.com/myproject to create an Android Project.
|
1) Create a new Android Project
A new Android Project has been created.
You get a simple code editor, compiler and emulator to test your Android Project now.
|
2) Check the important files
There are three important files that will be further edited as we develop our Android Apps namely AndroidManifest.xml, MyAndroid.java and main.xml. The name AndroidManifest.xml is fixed ie cannot be changed into other names. However, the name MyAndroid.java and main.xml can be changed into other names provided that you know how to perform the changes correctly.
|
AndroidManifest.xml contains the important configuration for the Android Apps.
MyAndroid.java contains the codes to control the Android program flow.
main.xml contains the codes for Android screen layout.
|
3) Observe the file content
How are these three files related?
AndroidManifest.xml tells the Android OS to find the controller file ie MyAndroid
MyAndroid.java tells the Android OS to load the layout from R.layout.main.xml
|
File Name: AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.MyAndroid"
android:versionCode="1"
android:versionName="1.0">
<application android:label="@string/app_name" android:icon="@drawable/ic_launcher">
<activity android:name="MyAndroid"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-sdk android:minSdkVersion="8" />
</manifest>
|
File Name: MyAndroid.java
package com.example.MyAndroid;
import android.app.Activity;
import android.os.Bundle;
public class MyAndroid extends Activity
{
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
}
|
FIle Name: res/layout/main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Hello MyAndroid"
/>
</LinearLayout>
|
4) Run Android Apps on Emulator
Programmr provides an online Emulator to run and test the functionality of an Android apps.
First, click the Compile button to compile and see if there is any syntax error.
Then, click the Run button to run the apps.
|
Compile.
Run.
5) What are the languages that we need to learn in order to develop Android Apps?
Developing Android Apps through this way requires a person to know Java and XML. Both languages have their own complexity and learning curve.
A simple approach to learn Android Apps development easily is to start with XML first.
Learn to create some layouts using XML.
As you see your Apps running, you may gain more interests and motivation to learn Java as well.
|
No comments:
Post a Comment