Jon
Jon

Reputation: 193

Android: ViewPager and Context Menus

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.

Upvotes: 4

Views: 1923

Answers (1)

adneal
adneal

Reputation: 30804

Register your TextView for a ContextMenu and not ViewPager.

See here.

Upvotes: 1

Related Questions