0

I want to call an onClick(View v) of other class from my activity's method onCreate(). Is it possible?

Because I have a Popupwindow in an onClick method of other class, so when an orientation changes, I want my landscape mode's popupwindow to be intact and appear at runtime. How can it be done?

Thanks in advance!

noobnicks
  • 159
  • 5
  • 16

1 Answers1

5

Assuming that the onClick() you want to call is for a View x, use either x.performClick() or x.callOnClick(). Check their javadoc in the Developers Guide for more details.

Notice that you have to have a handle to x. If your orientation changes, you should destroy the PopupWindow and re-display it, which should work.

Joe Malin
  • 8,621
  • 1
  • 23
  • 18