This is a basic android application folder, the main  files are :

src : Your java code

res: Your resource which include icon, layout, value

Android Manifest.xml.

 

 

1. Src

No more thing need to spend here, I will introduce the basic android component in the following blogs.

2. Res

For now, the drawable is used for icon, string is for different title or button name. The main element is layout.

Eg:

<?xml version=”1.0″ encoding=”utf-8″?>
<RelativeLayout xmlns:android=”http://schemas.android.com/apk/res/android&#8221;
android:layout_width=”fill_parent”
android:layout_height=”fill_parent”>
<TextView
android:id=”@+id/label”
android:layout_width=”fill_parent”
android:layout_height=”wrap_content”
android:text=”Hello:”/>

<EditText
android:id=”@+id/inputValue”
android:layout_width=”fill_parent”
android:layout_height=”wrap_content”
android:background=”@android:drawable/editbox_background”
android:layout_below=”@id/label”/>

<Button
android:id=”@+id/change”
android:layout_width=”wrap_content”
android:layout_height=”wrap_content”
android:layout_below=”@id/inputValue”
android:layout_marginLeft=”10dip”
android:text=”Change words” />

</RelativeLayout>

So when we in our code, we can use findViewById(R.id.label) to get corresponding element. when we use Button, we need set listener, such as :

del = new OnClickListener(){

@Override
public void onClick(View v) {
// TODO Auto-generated method stub
if(deleteFile(fileName)){
Toast.makeText(FileIOActivity.this,”Success delete file!”, Toast.LENGTH_LONG).show();
}
else
{
Toast.makeText(FileIOActivity.this,”Fail to delete file!”, Toast.LENGTH_LONG).show();
} }
};

delete.setOnClickListener(del);

For textView and EditText, we have setText & getText.

We have layout: listView, TabView, relativeView,  And TimePicker, GoogleMap http://developer.android.com/resources/tutorials/views/index.html

3. Manifest.xml http://developer.android.com/guide/topics/manifest/manifest-intro.html

Every application must have an AndroidManifest.xml file (with precisely that name) in its root directory. The manifest presents essential information about the application to the Android system, information the system must have before it can run any of the application’s code.

  • It names the Java package for the application. The package name serves as a unique identifier for the application.
  • It describes the components of the application — the activities, services, broadcast receivers, and content providers that the application is composed of. It names the classes that implement each of the components and publishes their capabilities (for example, which Intent messages they can handle). These declarations let the Android system know what the components are and under what conditions they can be launched.
  • It determines which processes will host application components.
  • It declares which permissions the application must have in order to access protected parts of the API and interact with other applications.
  • It also declares the permissions that others are required to have in order to interact with the application’s components.
  • It lists the Instrumentation classes that provide profiling and other information as the application is running. These declarations are present in the manifest only while the application is being developed and tested; they’re removed before the application is published.
  • It declares the minimum level of the Android API that the application requires.
  • It lists the libraries that the application must be linked against.
Advertisements
This entry was posted in Android. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s