Hi, you can add these lines in AndroidManifest.xml,

<activity android:name=".YourActivityName"
             android:configChanges="orientation">

and then in your activity, override this method:-

@Override
public void onConfigurationChanged(Configuration newConfig)
{
                if (getResources().getConfiguration().orientation ==
Configuration.ORIENTATION_LANDSCAPE)
        {
                                       //do your task
        }
        else if (getResources().getConfiguration().orientation ==
Configuration.ORIENTATION_PORTRAIT)
        {
                                      //do your task
        }
        super.onConfigurationChanged(newConfig);
}

This worked perfectly for me, hope it does for u too...

On Mar 7, 8:32 am, Dilip Dilip <[email protected]> wrote:
> Dear All,
>   I am a new bee to android. I wanted to know how to recieve a rotation
> event ( change in orientation, vertical to horizontal ) in my Activity or my
> service.
> Please anyone answer me.
>
> Thanks and Regards,
>   Dileep

-- 
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