I am creating an application targeting the tablet users that only in landscape mode. So I created a folder in res named as layout-xlarge-land and put all my layout xml files inside it and kept the layout folder empty. I also set the support screen attributes in manifest file
<supports-screens
android:anyDensity="true"
android:largeScreens="true"
android:xlargeScreens="true"
android:normalScreens="false"
android:smallScreens="false" />
I also set all the activity’s orientation to landscape
activity
android:name=".HomeActivity"
android:label="@string/title_activity_main"
android:screenOrientation="landscape">
</activity>
when I start my application it doesn’t starts displaying a stopped unexpectedly message.
But when I put all the layout xml files in layout folder my application runs fine.
why this type of behavior? In my view Android system should first look into the layout-xlarge-landfolder to get the UI. If not found then look into ‘layout folder’.
Can someone explain me whether I am right or wrong ?
Logcat:
08-29 12:06:15.040: E/AndroidRuntime(3468): java.lang.RuntimeException: Unable to
start activity ComponentInfo{com.abs.qpr/com.abs.qpr.LauncherActivity}:
android.content.res.Resources$NotFoundException: Resource ID #0x7f030001
08-29 12:06:15.040: E/AndroidRuntime(3468): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1751)
08-29 12:06:15.040: E/AndroidRuntime(3468): at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1767)
08-29 12:06:15.040: E/AndroidRuntime(3468): at
android.app.ActivityThread.access$1500(ActivityThread.java:122)
08-29 12:06:15.040: E/AndroidRuntime(3468): at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1005)
08-29 12:06:15.040: E/AndroidRuntime(3468): at
android.os.Handler.dispatchMessage(Handler.java:99)
08-29 12:06:15.040: E/AndroidRuntime(3468): at
android.os.Looper.loop(Looper.java:132)
08-29 12:06:15.040: E/AndroidRuntime(3468): at
android.app.ActivityThread.main(ActivityThread.java:4028)
08-29 12:06:15.040: E/AndroidRuntime(3468): at
java.lang.reflect.Method.invokeNative(Native Method)
08-29 12:06:15.040: E/AndroidRuntime(3468): at
java.lang.reflect.Method.invoke(Method.java:491)
08-29 12:06:15.040: E/AndroidRuntime(3468): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:844)
08-29 12:06:15.040: E/AndroidRuntime(3468): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:602)
08-29 12:06:15.040: E/AndroidRuntime(3468): at
dalvik.system.NativeStart.main(Native Method)
08-29 12:06:15.040: E/AndroidRuntime(3468): Caused by:
android.content.res.Resources$NotFoundException: Resource ID #0x7f030001
08-29 12:06:15.040: E/AndroidRuntime(3468): at
android.content.res.Resources.getValue(Resources.java:1014)
08-29 12:06:15.040: E/AndroidRuntime(3468): at
android.content.res.Resources.loadXmlResourceParser(Resources.java:2039)
08-29 12:06:15.040: E/AndroidRuntime(3468): at
android.content.res.Resources.getLayout(Resources.java:853)
08-29 12:06:15.040: E/AndroidRuntime(3468): at
android.view.LayoutInflater.inflate(LayoutInflater.java:389)
08-29 12:06:15.040: E/AndroidRuntime(3468): at
android.view.LayoutInflater.inflate(LayoutInflater.java:347)
08-29 12:06:15.040: E/AndroidRuntime(3468): at
com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:245)
08-29 12:06:15.040: E/AndroidRuntime(3468): at
android.app.Activity.setContentView(Activity.java:1780)
08-29 12:06:15.040: E/AndroidRuntime(3468): at
com.abs.qpr.LauncherActivity.onCreate(LauncherActivity.java:17)
08-29 12:06:15.040: E/AndroidRuntime(3468): at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1048)
08-29 12:06:15.040: E/AndroidRuntime(3468): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1715)
08-29 12:06:15.040: E/AndroidRuntime(3468): ... 11 more`
I got the solution. You have to keep at least one i.e,
layout xmlfile attached to yourLauncher Activityinside thelayoutfolder rest of thelayout xmlfiles can be kept inside thelayout-xlarge-landfolder.