switch (this.getResources().getConfiguration().orientation)
{
case Configuration.ORIENTATION_PORTRAIT:
// Do something here
break;
case Configuration.ORIENTATION_LANDSCAPE:
// Do something here
break;
case Configuration.ORIENTATION_SQUARE:
// Do something here
break;
default:
throw new Exception("Unexpected orientation enumeration returned");
break;
}
See here for more info:
http://eigo.co.uk/News-Article.aspx?NewsArticleID=103
On Oct 7, 2:50 pm, Simon <simon.wilkin...@gmail.com> wrote:
> Hi,
>
> I have an activity that I have two layouts defined for: one for
> landscape and one for portrait. So in my layout folder I have
> activity.xml and activity_landscape.xml. When I am switching around
> orientation on my device the proper layout is loading on orientation
> change. However, if I am in landscape mode, and then launch this
> activity from another activity, the portrait layout is rendered, even
> though the device is in landscape mode. I am launching the activity
> using the following:
>
> Intent i = new Intent(OtherActivity.this, Activity.class);
> startActivityForResult(i, ACTIVITY_X);
>
> Does anybody have any ideas for why this could be happening? Seems
> strange that it would work except for on initial load of the activity.
>
> Thanks,
>
> Simon
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
No comments:
Post a Comment