I am getting NullPointer exception for my app when switching from potrait mode to landscape mode and vice versa

by manoj » Wed, 11 Feb 2009 13:02:22 GMT


Sponsored Links
 Hi friends,

I have written a small example which displays the photos from the
server.

Its working fine when the device is in one of the mode (landscape of
potrait ).

But if I switch to landscape to potrait or potrait  to landscape while
downloading the photos from the server,

I am getting NullPointerException, showing with
androidRunTimeException.

Can any one please help to solve this problem?

I am using LinearLayout -> ImageView

I am using threads to download the images.

Thanks,
Manoj.
--~--~---------~--~----~------------~-------~--~----~



I am getting NullPointer exception for my app when switching from potrait mode to landscape mode and vice versa

by clark » Wed, 11 Feb 2009 13:15:16 GMT


 You may want to try adding android:configChanges="orientation" to
AndroidManifest.xml and overriding onConfigurationChanged().  If a
configuration change is not specified in android:configChanges then
Android will take care of it for you, which means restarting your
app.  Without seeing code it is hard to say exactly what you should do
to handle this, but the information I listed should get you started.
I'd do a search regarding onConfigurationChanged() in the SDK
documentation.

I hope that gets you going in the right direction.


~clark



--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


I am getting NullPointer exception for my app when switching from potrait mode to landscape mode and vice versa

by Mark Murphy » Wed, 11 Feb 2009 21:59:38 GMT


 


Without the source code for the area where the exception is occurring,
and knowing which line is the one raising the exception, it is rather
difficult to give you a precise solution.

Bear in mind that, on a rotation like this, by default your existing
activity is destroyed and a new one created.

Here is a series of blog posts on handling rotation events that may help
you understand what is going on:

 http://androidguys.com/?s=rotational +forces

-- 
Mark Murphy (a Commons Guy)
 http://commonsware.com 
_The Busy Coder's Guide to Android Development_ Version 2.0 Published!

--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. isUserAMonkey throws exception

// Short Msg: java.lang.RuntimeException
// Long Msg: java.lang.RuntimeException: Unknown exception code: 1 msg
null
...
// Build Changelist: 1681
// Build Time: 1286811002000
// java.lang.RuntimeException: Unknown exception code: 1 msg null
//      at android.os.Parcel.readException(Parcel.java:1257)
//      at android.os.Parcel.readException(Parcel.java:1235)
//      at
android.app.ActivityManagerProxy.isUserAMonkey(ActivityManagerNative.java:
2754)
//      at
android.app.ActivityManager.isUserAMonkey(ActivityManager.java:990)

I get the following exception when trying to use the isUserAMonkey API
on a keydown.
            mAM =
(android.app.ActivityManager)getSystemService(Context.ACTIVITY_SERVICE);
            if (mAM.isUserAMonkey()) {
                return true;
            }
Any reason why this may be happening?

-- 

2. Delivery report implementation

Hi All,
i am trying to implement Delivery Report for android.
I am forming the proper PDU with Reply option sub-param in RIL layer
and send the same.

But when i check OTA LOG, reply option is missing in OTA LOG in data
burst message. Only 2 subparam [Message identifiera nd User data seen
in log ]. It seems LIBRIL/Modem does not support the additional
subparam of the SMS.

Can anybody help/suggest if have missed anything or how to implement
the same ?


Thanks in advance..............

-- 

3. How to change of color of list

4. From the emulator to the real device

5. using instrumentation testing framework if there is more than one activity

6. Notification Sound getting distorted in Speaker

7. Segmentation fault while testing Opencore Unit Test Apps