0

I am creating an app with a viewpager that allows horizontal paging.On the panes that you swipe though on the app there are buttons play sound and link to other pages etc. The app it working well, however I do not know how to program the buttons within the viewpager. Can anyone provide an example, or help me out?

YES
  • 15
  • 4

1 Answers1

0

Program your buttons to do what? One usually programs a UI widget by getting a handle to it in the code with something like this

Button aButton = (Button) findViewById(R.id.aButton);

and then creating a listener for aButton with

aButton.setOnClickListener(new OnClickListener(View v) {
...
});
HitOdessit
  • 7,198
  • 4
  • 36
  • 59
Joe Malin
  • 8,621
  • 1
  • 23
  • 18
  • question do I put that in my main activity java that my viewpager is in or do I have to set up another activity? – YES Oct 27 '12 at 17:44