Android: ViewPager and Context Menus?

Register your TextView for a ContextMenu and not ViewPager.

Up vote 2 down vote favorite share g+ share fb share tw.

I am using the ViewPager from the Android Support package (android.support. V4.view. ViewPager).

My ViewPager layout contents contains TextViews in a LinearLayout on each page. I would like to be able to use a ContextMenu for each TextView. I have tried the code below where I registerForContextMenu with the ViewPager view, but the onCreateContextMenu method is never called.

ViewPager viewPager = (ViewPager) findViewById(R.id. Mypager); viewPager. SetAdapter(viewPagerAdapter); registerForContextMenu(viewPager); Is it possible to use registerForContextMenu in conjunction with the ViewPager type?

Many thanks for your help. Android android-viewpager link|improve this question asked Feb 5 at 22:48Jon132.

Register your TextView for a ContextMenu and not ViewPager. See here.

Thanks for the response aneal. That works as expected. I hoped there might be a more generic way of doing it, similar to ListView, such that the ContextMenuInfo object would be populated for any item that was selected, so it's easier to track which item was selected, but I guess those components aren't really comparable (I'm not sure exactly the best way of tracking which item was selected though if the ContextMenuInfo isn't populated, think I have more reading to do!

) – Jon Feb 6 at 21:27.

Register your TextView for a ContextMenu and not ViewPager .

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions