0

I am making an app that has a scrolling screen like the homescreen style. I have implemented this solution:

Android Homescreen

It works great but I also want there to be buttons on each page that you can click to go to the next page but I just can't figure out how to do it! can someone help? I've been staring at this code for days now!

Thanks

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

UPDATE - HELP

I really don't understand how to get around the problem of calling the SetToScreen from the other activity, Can anyone help as if I try I do keep getting Static call errors.

Community
  • 1
  • 1
MrCloister
  • 452
  • 2
  • 7
  • 19
  • Been staring at what code? ;) Provide the code you have already. We need to know how far you are - can you make the buttons? Do you know how to add listeners? Are you using Views or Activities? – Codemonkey Mar 03 '11 at 12:28
  • If you click on the words Android Homescreen you will go to a page where I have already posted my code. – MrCloister Mar 03 '11 at 13:17

1 Answers1

0

Look at

public void setToScreen(int whichScreen) {}

Use this function to set to a screen on a click.

you should extend Draggablespace by adding a function to get the current space like:

public int getCurrentScreen() {
    return this.mCurrentScreen;
}

then you can write your own functions in your activity like

public void nextScreen() {
    draggableSpace.setToScreen(draggableSpace.getCurrentScreen() + 1));
}

The same for previous screen.

Now you only need to check if there is an additional screen waiting if you are going forward or backward.

(Of course draggableSpace is your object of the class draggablespace...not a static call!)

Johnnycube
  • 1,060
  • 1
  • 10
  • 25
  • Thanks for answering my question! I was looking at setToScreen, but I was having trouble getting it working.. My buttons are handled in the main.java file (have updated the code on the previous thread) is that the right way to handle those buttons (the ones listed call another activity which opens a different page) – MrCloister Mar 03 '11 at 13:20
  • Sorry I'm trying to get this to work but how would I work around DragableSpace erroring me on the static call? (not even sure what that means) – MrCloister Mar 03 '11 at 13:43
  • I really don't understand how to get around the problem of calling the SetToScreen from the other activity, Can anyone help as if I try I do keep getting Static call errors. – MrCloister Mar 14 '11 at 09:44
  • Johnny, Thanks again for replying this time I'll include a link to a zip file which contains my project. http://www.hct.ac.uk/downloads/Launcherd.zip Thanks – MrCloister Mar 17 '11 at 10:09