Hello!
Ive got a game that I force in landscape using this bit of code:

 public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        this.requestWindowFeature(Window.FEATURE_NO_TITLE);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, 
WindowManager.LayoutParams.FLAG_FULLSCREEN);
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
        setContentView(new MainGamePanel(this));
        Log.d(TAG, "View added");
           }

If I start the app while holding phone in landscape, everything works fine, 
but if I hold the phone in portrait and start, it crashes. also if the 
phone is locked when I start my app trough eclipse it dosnt matter which 
way I hold it, it still chrashes, so to sum it up: Only work if phone is 
unlocked and held in landscape.
Here is the error:
09-05 21:40:36.031: E/AndroidRuntime(30347): java.lang.RuntimeException: 
Unable to start activity 
ComponentInfo{nielsen.happy.shooter/nielsen.happy.activities.Menu}: 
android.content.res.Resources$NotFoundException: Resource ID #0x7f030002
09-05 21:40:36.031: E/AndroidRuntime(30347):     at 
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1956)
09-05 21:40:36.031: E/AndroidRuntime(30347):     at 
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
09-05 21:40:36.031: E/AndroidRuntime(30347):     at 
android.app.ActivityThread.access$600(ActivityThread.java:123)
09-05 21:40:36.031: E/AndroidRuntime(30347):     at 
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
09-05 21:40:36.031: E/AndroidRuntime(30347):     at 
android.os.Handler.dispatchMessage(Handler.java:99)
09-05 21:40:36.031: E/AndroidRuntime(30347):     at 
android.os.Looper.loop(Looper.java:137)
09-05 21:40:36.031: E/AndroidRuntime(30347):     at 
android.app.ActivityThread.main(ActivityThread.java:4424)
09-05 21:40:36.031: E/AndroidRuntime(30347):     at 
java.lang.reflect.Method.invokeNative(Native Method)
09-05 21:40:36.031: E/AndroidRuntime(30347):     at 
java.lang.reflect.Method.invoke(Method.java:511)
09-05 21:40:36.031: E/AndroidRuntime(30347):     at 
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
09-05 21:40:36.031: E/AndroidRuntime(30347):     at 
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
09-05 21:40:36.031: E/AndroidRuntime(30347):     at 
dalvik.system.NativeStart.main(Native Method)
09-05 21:40:36.031: E/AndroidRuntime(30347): Caused by: 
android.content.res.Resources$NotFoundException: Resource ID #0x7f030002
09-05 21:40:36.031: E/AndroidRuntime(30347):     at 
android.content.res.Resources.getValue(Resources.java:1018)
09-05 21:40:36.031: E/AndroidRuntime(30347):     at 
android.content.res.Resources.loadXmlResourceParser(Resources.java:2105)
09-05 21:40:36.031: E/AndroidRuntime(30347):     at 
android.content.res.Resources.getLayout(Resources.java:857)
09-05 21:40:36.031: E/AndroidRuntime(30347):     at 
android.view.LayoutInflater.inflate(LayoutInflater.java:394)
09-05 21:40:36.031: E/AndroidRuntime(30347):     at 
android.view.LayoutInflater.inflate(LayoutInflater.java:352)
09-05 21:40:36.031: E/AndroidRuntime(30347):     at 
com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:251)
09-05 21:40:36.031: E/AndroidRuntime(30347):     at 
android.app.Activity.setContentView(Activity.java:1835)
09-05 21:40:36.031: E/AndroidRuntime(30347):     at 
nielsen.happy.activities.Menu.onCreate(Menu.java:29)
09-05 21:40:36.031: E/AndroidRuntime(30347):     at 
android.app.Activity.performCreate(Activity.java:4465)
09-05 21:40:36.031: E/AndroidRuntime(30347):     at 
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
09-05 21:40:36.031: E/AndroidRuntime(30347):     at 
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
09-05 21:40:36.031: E/AndroidRuntime(30347):     ... 11 more
09-05 21:40:47.922: D/dalvikvm(30401): GC_FOR_ALLOC freed 33K, 3% free 
12649K/12931K, paused 14ms

also it crashed when I shut it down by pressing "home-screen" on my phone, 
giving this error:

09-05 21:40:58.320: E/AndroidRuntime(30401): FATAL EXCEPTION: Thread-4898
09-05 21:40:58.320: E/AndroidRuntime(30401): java.lang.NullPointerException
09-05 21:40:58.320: E/AndroidRuntime(30401):     at 
nielsen.happy.shooter.MainGamePanel.render(MainGamePanel.java:94)
09-05 21:40:58.320: E/AndroidRuntime(30401):     at 
nielsen.happy.shooter.MainThread.run(MainThread.java:101)

This rly sucks cus Ive been working on this for 4-5 months now and its my 
first real game, really want things like this to work.
If u need any more information let me know

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to