AXISHK
asked on
Android XML file
1. What does it mean for "tools:context="com.abc.pa ssingdata. MainActivi ty" ? (sample 1)
2. What does it mean for the following XML statement ? For "action", does it refer to the corresponding java class. How does "category" defined in sample 2 ? Any special meaning ? Thx
<action android:name="android.inte nt.action. MAIN" />
<category android:name="android.inte nt.categor y.LAUNCHER " />
<action android:name="com.abc.usin gintent.Se condActivi ty" />
<category android:name="android.inte nt.categor y.DEFAULT" />
SAMPLE 1
-------------
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:orientation="verti cal"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="matc h_parent"
android:layout_height="mat ch_parent"
tools:context="com.abc.pas singdata.M ainActivit y">
<TextView
android:layout_width="wrap _content"
android:layout_height="wra p_content"
android:text="Welcome to the Second Activity"
android:id="@+id/textView" />
<Button
android:layout_width="wrap _content"
android:layout_height="wra p_content"
android:text="Click to go to Main Activity"
android:id="@+id/button"
android:onClick="onClick"/ >
</LinearLayout>
SAMPLE 2
--------------
<activity android:name=".MainActivit y">
<intent-filter>
<action android:name="android.inte nt.action. MAIN" />
<category android:name="android.inte nt.categor y.LAUNCHER " />
</intent-filter>
</activity>
<activity android:name=".SecondActiv ity" >
<intent-filter >
<action android:name="com.abc.usin gintent.Se condActivi ty" />
<category android:name="android.inte nt.categor y.DEFAULT" />
</intent-filter>
</activity>
2. What does it mean for the following XML statement ? For "action", does it refer to the corresponding java class. How does "category" defined in sample 2 ? Any special meaning ? Thx
<action android:name="android.inte
<category android:name="android.inte
<action android:name="com.abc.usin
<category android:name="android.inte
SAMPLE 1
-------------
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:orientation="verti
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="matc
android:layout_height="mat
tools:context="com.abc.pas
<TextView
android:layout_width="wrap
android:layout_height="wra
android:text="Welcome to the Second Activity"
android:id="@+id/textView"
<Button
android:layout_width="wrap
android:layout_height="wra
android:text="Click to go to Main Activity"
android:id="@+id/button"
android:onClick="onClick"/
</LinearLayout>
SAMPLE 2
--------------
<activity android:name=".MainActivit
<intent-filter>
<action android:name="android.inte
<category android:name="android.inte
</intent-filter>
</activity>
<activity android:name=".SecondActiv
<intent-filter >
<action android:name="com.abc.usin
<category android:name="android.inte
</intent-filter>
</activity>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.