1. You want that $100.00 in your pocket or an Amazon Fire TV don't you? Well here's the deal. With our new updated look we are in desperate need of an updated logo. The 'old' one has certainly served us well, but it's time. Find all the details here: bit.ly/1q0k6Wa
  2. DroidForums.net is currently undergoing a major software upgrade. If you are experiencing any problems logging in please: Contact Us

Can a Java guru solve this Droid top-of-page problem?

Discussion in 'Android Hacks and Help' started by artsnob, Jan 3, 2011.

  1. artsnob
    Offline

    artsnob New Member

    Joined:
    Sep 3, 2010
    Messages:
    17
    Likes Received:
    0
    Trophy Points:
    0
    Code:
     
    First some background. It is an established fact that the Droid browser has idiosyncrasies that can interfere with programmatic control. I first noticed this with the behavior of the back button. After much testing and help-seeking, I concluded that there was a hardware glitch in the Droid and started a forum thread about my findings titled, “[COLOR=#323232][FONT=Verdana]Droid backbutton vs. Iphone backbutton.[/FONT][/COLOR]” There was skepticism about my claims in the thread at first, but a month after it started, someone confirmed my findings and provided a technical explanation for the undesired behavior I’d been observing. (pseudomammal on 10/14, if you’re interested).
     
    Well now I’ve come up with a second Droid-browser-only glitch where it seems to defy Java control. I have a running example where the problem can be reproduced: just go to [URL="http://www.tofilmfest.ca/tiffwidget"]www.tofilmfest.ca/tiffwidget[/URL], choose “schedule and lists,” then choose “next,” and you’ll be at a multi-paged gridview with page command buttons at the top and bottom. If you go to the bottom and press the next page button, it will turn the page and then go to the top of the form – IF you’re using a desktop browser or an iPhone browser. With a Droid, it turns the page and goes to the top momentarily … after which, it goes right back down to the bottom. 
     
    Here is the Java code that makes it go to the top:
     
    [CODE]Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded(PageLoadedHandler);
     
    [COLOR=blue]function[/COLOR] PageLoadedHandler(sender, args) {
        [COLOR=blue]var[/COLOR] dataItems = args.get_dataItems();
        [COLOR=blue]if[/COLOR] (dataItems[[COLOR=maroon]'GridViewCommand'[/COLOR]] == [COLOR=maroon]'Page'[/COLOR]) {
            window.scrollTo(0, 0);
            pageTracker._trackPageview([COLOR=maroon]'Pageturn'[/COLOR]);
        }
    }

    Can someone suggest a Droid workaround for this problem? A way Java can make a Droid browswer go to the top from a button control and stay there? Say a simulated ctrl-home? Or an enforced pause after the scroll command?
  2. jeffv2
    Offline

    jeffv2 Developer Developer

    Joined:
    Dec 23, 2010
    Messages:
    1,240
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    south jersey
    ask over at xda or pm a dev