How to call onClick(View v) method explicitly in an Android? Is it possible?

前端 未结 1 1881
醉梦人生
醉梦人生 2020-12-22 09:41

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

相关标签:
1条回答
  • 2020-12-22 10:02

    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.

    0 讨论(0)
提交回复
热议问题