Structure of an Android Project




After you have introduced all the modules vital for the advancement of an Android record, you can now start to build up an Android application. From the top menu, pick File – > Project, and from the “New Project window”, pick “Android Project”. Take after the task setup wizard and in the wake of completing the wizard, you will have an essential Android application. Each Android venture contains a few organizers:

  • src: This envelope contains the Java source documents.
  • gen: Generated Java library, this library is for Android inside use as it were.
  • Res: Here we can store asset documents, for example, pictures, XML records for characterizing designs, et cetera. Inside this organizer there are extra envelopes, for example, Drawable, Layout, and Values.
  • Drawable: Here we store the different realistic records. We can see three sorts of drawable organizers. This is on the grounds that there are numerous Android gadgets with various screen resolutions. As a matter of course, there are a few adaptations of this envelope, for example, Drawable-mdpi, drawable-hdpi, et cetera. This is required with a specific end goal to adjust to various screen resolutions.
  • Layout: This is the spot for XML format documents. Format documents are XML records which characterize how different Android articles, (for example, textboxes, catches, and so on.) are sorted out on the screen.
  • Values: XML records which store different string values (titles, marks, and so forth.).

Real records in the Android venture:

AndroidManifest.xml: This is the Android definition record. It contains data about the Android application, for example, least Android form, authorization to get to Android gadget capacities, for example, web access consent, capacity to utilize telephone authorization, and so on.

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.firstproject"
    android:versionCode="1"
    android:versionName="1.0" >
		
    <uses-sdk android:minSdkVersion="7" />
	
    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name" >
        <activity
            android:name=".MynewprojectActivity"
            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>
</manifest>

MainLayout.xml: This document portrays the format of the page. This implies the situation of each segment, (for example, textboxes, marks, radio catches, client characterized segments, and so on.) on the application screen.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="@string/hello" />

</LinearLayout>

Action class: Every application that involves the whole gadget screen needs no less than one class which acquires from the Activity class. One noteworthy strategy is called OnCreate. This strategy starts the application and burdens the design page.

package com.codebind;

import android.app.Activity;
import android.os.Bundle;

public class MynewprojectActivity extends Activity {
     
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
    }
}

 


Partner Sites

VideoToGifs.com

EasyOnlineConverter.com

SqliteTutorials.com





Be the first to comment

Leave a Reply

Your email address will not be published.


*