DISPLAY HELLO WORLD CODES
CREATE LINEAR LAYOUT
Create or Update the template layout, Relative Layout to the following Code.
===>>src/main/res/layout/activity_home.xml
<LinearLayout
android:orientation="vertical"
android:layout_height="match_parent"
android:layout_width="match_parent" >
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:textColor="@android:color/black"
android:textSize="50sp"
android:text="@string/hello_world"/>
</LinearLayout>
CREATE ACTIVITY
Create or Update the template java Class. ==>> src/main/java/package-name/HomeActivity.java
Change ActionBarActivity to Activity for extended class for java class HomeActivity
public class HomeActivity extends ActionBarActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
REGISTER ACTIVITY
Register your activity in manifest file. ===>>src/main/AndroidManifest.xml
In it we define which activity is launcher activity means execute first.
<manifest package="net.uni_world.android_1110.foodscourt">
<application android:theme="@style/AppTheme" android:label="@string/app_name" android:icon="@drawable/ic_launcher"android:allowBackup="true">
<activity android:label="@string/app_name" android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
</manifest>
NOTE:
REMIND THESE 3 MAIN POINT FOR CREATE APP.LIKE:
- FIRST IS CREATE LAYOUT ACTIVITY (XML)
- SECOND ONE IS CREATE JAVA ACTIVITY CLASS (.JAVA)
- THIRD ONE IS REGISTER UR ACTIVITY IN MENIFEST.XML ACTIVITY.
No comments:
Post a Comment