Overscroll Documentation?

by Daniel Lew » Tue, 07 Dec 2010 03:35:53 GMT

Sponsored Links
 In the release notes for 2.3, they say that there's a new feature,
overscroll:  http://developer.android.com/sdk/android-2.3.html 

However, I can find no references of it in the documentation;
autocomplete won't give me any hints about it in ADT; and the source
for 2.3 hasn't been pushed to git yet so I can't look for myself how
to use it.  Is there somewhere I can get valid values for how to use
overscroll?  (In particular, overScrollMode).



Other Threads

1. On-screen keyboard bug ?

We have in our app, a non-editable field described in the layout thus

<EditText android:id="@+id/txtText"
android:hint="A Hint here"

and in code, this is disabled using setEnabled(false).

All was well before Cupcake, but when the on-screen keyboard came
along, now you are able to tap on the field (or navigate focus to the
field using the ball)  and then using the on-screen keyboard, start
typing into the field, replacing the text with anything you type.

I think this is an unexpected behavior.. Anyone else ?

2. ItemizedOverlay & ArrayIndexOutOfBoundsException > explanation AND solution !!

Hi all !

I want to share with you the solution to a weird problem I was having.
I think it was mostly due to my misunderstanding of the way
ItemizedOverlay works. I couldn't find the sources, and the usage is
not much documented. Hopefully I could connect the de{*filter*} and dig...

I have a dynamic ItemizedOverlay, which means that from time to time I
update the list of items inside it, removing some and adding others.

When I would sometimes click on an item, than update the items, than
click again on another item, an ArrayIndexOutOfBoundsException was

I thought that calling the "populate()" method was enought to get the
Overlay updated, and that I only needed to override the createItem(int
i) and size() methods.

However, one should also call this :


The ItemizedOverlay remembers the index of the last focused item, and
does some stuff with it when you focus on a new item (by clicking on
it for instance). If you change the list of items, then the
"lastFocusedIndex" has no more meaning.

I think that this should be written in the documentation, or that
setLastFocusedIndex(-1); should be called from the populate() method.

One more thing : I think that the minimal touchable bounds of a
drawable should be customizable. I was playing with the map on the
emulator, and I was surprised that click quite far away from a pin
would still get it "tapped". I realized that the minimal box for an
item is 100*100 pixels, which is quite large...

Here is a sample code to show how to use a dynamic ItemizedOverlay,
and to customize the minimal size of a box (I have simplified it from
my real class, to show only the interesting stuff).

public class FaultStationOverlay extends
ItemizedOverlay<FaultStationItem> {

        private ArrayList<FaultStationItem>     faultStations                   
= new

        private Drawable                                        normalMarker;
        private Drawable                                        fewFaultsMarker;
        private Drawable                                        

        private Rect                                            touchableBounds 
                = new Rect();

        private static final int                        MIN_TOUCHABLE_WIDTH     
        = 10;
        private static final int                        MIN_TOUCHABLE_HEIGHT    
= 10;

        public FaultStationOverlay(Drawable normalMarker, Drawable
                        Drawable muchFaultsMarker) {
                this.normalMarker = boundCenterBottom(normalMarker);
                this.fewFaultsMarker = boundCenterBottom(fewFaultsMarker);
                this.muchFaultsMarker = boundCenterBottom(muchFaultsMarker);


        public void updateStations(List<Station> stations) {
                for (Station station : stations) {
                        FaultStationItem stationItem = new 

                        switch (stationItem.getState()) {
                        case FaultStationItem.STATE_NORMAL:
                        case FaultStationItem.STATE_FEW_FAULTS:
                        case FaultStationItem.STATE_MUCH_FAULTS:
                                throw new IllegalStateException("stationItem 
should have one of
the three available states");






        protected boolean hitTest(FaultStationItem item, Drawable marker, int
hitX, int hitY) {

               //The code written here was deduced from what happens
in the de{*filter*} ;-) .

                Rect bounds = marker.getBounds();

                int width = bounds.width();
                int height = bounds.height();
                int centerX = bounds.centerX();
                int centerY = bounds.centerY();

                int touchWidth = Math.max(MIN_TOUCHABLE_WIDTH, width);
                int touchLeft = centerX - touchWidth / 2;
                int touchHeight = Math.max(MIN_TOUCHABLE_HEIGHT, height);
                int touchTop = centerY - touchHeight / 2;

                touchableBounds.set(touchLeft, touchTop, touchLeft + touchWidth,
touchTop + touchHeight);

                return touchableBounds.contains(hitX, hitY);

        protected FaultStationItem createItem(int i) {
                return faultStations.get(i);

        public int size() {
                        return faultStations.size();



3. Camera application 1.5 on emulator does nothing

4. Official Google Android Developer Phone G1 (running in Canada) needs Cupcake!

5. How to play back a selected ringtone or alarm sound ??

6. SEO for android forums

7. keeping screen on while activity active