I am trying to understand the anatomy of a MINIMAL Android application, using Eclipse + ADT (Android Development Toolkit).
Please can you advise what is the MINIMAL set of source files I need, for example :-
src / package / MainActivity.java
res / layout / activity_main.xml
res / menu / activity_main.xml (??)
AndroidManifest.xml
(any other source files needed?)
Please can you advise what is the MINIMAL that I need to put into each file in order for it to run on the AVD (Android Virtual Device) ?
For example, which of these files needs to contain reference(s) to which other files, etc?
Strictly speaking the minimal project that displays Hello World is
.
├── AndroidManifest.xml
├── res
└── src
└── com
└── example
└── minimal
└── Minimal.java
package com.example.minimal;
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
public class Minimal extends Activity {
/* (non-Javadoc)
* @see android.app.Activity#onCreate(android.os.Bundle)
*/
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
final TextView tv = new TextView(this);
tv.setText("Hello World!");
setContentView(tv);
}
}
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.minimal"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="15" android:targetSdkVersion="15" />
<application android:label="Minimal">
<activity android:name="Minimal">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
</intent-filter>
</activity>
</application>
</manifest>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With