On Mar 9, 10:31 pm, Jake Wharton <
jakewhar...@gmail.com> wrote:
> There is no easy way to get at the actual View for an action item. The only
> way would be to set a custom view, use the regular action item styling, and
> then getActionView.
>
> ---
>
>
>
> On Fri, Mar 9, 2012 at 4:26 AM, Saurabh Gupta <
saurabh3...@gmail.com> wrote:
> > Hi
>
> > I am using setHasOptionsMenu(true) and onCreateOptionsMenu() to have a
> > Menu on the Action Bar.
>
> > Later, I need to have a Popover Dialog on the Click of this Menu item.
> > For this I need to have the View of the Menu on the Action Bar (View
> > coordinates so that I can place my Popover Dialog properly).
>
> > My problem is that I am not able to get this View. I have used below
> > code for this, but in vain:
>
> > 1) public boolean onOptionsItemSelected(MenuItem item) {
> > getView().refreshDrawableState();
> > View view = getView().findViewById(R.id.abs__actions);
> > return super.onOptionsItemSelected(item);
> > }
>
> > 2) public boolean onOptionsItemSelected(MenuItem item) {
> > View view = item.getActionView().findViewById(R.id.abs__actions));
> > return super.onOptionsItemSelected(item);
> > }
>
> > Please suggest the way of getting the View for the Menu. Also, if
> > there are two Menus then what will be the case.
> > Any help will be much appreciated!
>