I just want to make my own HOME-SCREEN in android. I also want to call that HOME-SCREEN f开发者_开发知识库rom my Activity
. How to achieve it?
I just want to put one button on that HOME-SCREEN.
So, please tell me the exact solution. I have read this content from
this dev site.
but I am getting actual process to make our Home-Screen in dev site. Home code doesn't have Activity
class and all so I am not understanding.
Can any one please help me to understand this concept?
Thanks in advance.
The key is in the AndroidManifest.xml
file. In there is where you tell android that this application is meant to be a home app:
<activity android:name="Home"
android:theme="@style/Theme"
android:launchMode="singleInstance"
android:stateNotNeeded="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.HOME"/>
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
The class extending Activity
is Home
itself:
http://developer.android.com/resources/samples/Home/src/com/example/android/home/Home.html
public class Home extends Activity {
// many lines chopped
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
// many lines chopped
}
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
// Close the menu
if (Intent.ACTION_MAIN.equals(intent.getAction())) {
getWindow().closeAllPanels();
}
}
@Override
public void onDestroy() {
super.onDestroy();
// many lines chopped
}
// many lines chopped etc
}
精彩评论