Programatically change orientation?

91 views
Skip to first unread message

matthias

unread,
Jul 5, 2010, 3:11:40 AM7/5/10
to Robotium Developers
Hi,

I have been developing a similar library (Calculon, it's on github)
over the last couple months (I started before I knew about Robotium,
would probably have made sense to join efforts, but what gives), and I
struggle to find a way to flip the screen in-code. This would be
tremendously useful for writing acceptance tests related to the
correct recovering from interruptions like phone calls, an issue that
plagues many Android apps.

Did you find out how?

Thanks,
Matthias

Renas Reda

unread,
Jul 5, 2010, 3:36:12 AM7/5/10
to Robotium Developers
Hi Matthias,

When you have the activity you can use:
activity.setRequestedOrientation(orientation); That will set the
orientation for that activitiy.

/Renas

matthias

unread,
Jul 6, 2010, 3:47:06 AM7/6/10
to Robotium Developers
Hi,

On Jul 5, 9:36 am, Renas Reda <renasr...@gmail.com> wrote:
> Hi Matthias,
>
> When you have the activity you can use:
> activity.setRequestedOrientation(orientation); That will set the
> orientation for that activitiy.
>
> /Renas

I'm fairly sure I tried that before and it didn't work (i.e.
onSaveInstanceState() and onRestoreInstanceState() were not called),
but I'll give it another shot. Do you have a working example maybe?

Renas Reda

unread,
Jul 6, 2010, 8:12:30 AM7/6/10
to Robotium Developers
No not at the moment. I will have to take a look at it when I get some
time over.

/Renas
Reply all
Reply to author
Forward
0 new messages