Merthan Erdem
Merthan Erdem

Reputation: 6068

Android: Changing a Original View class

How can i edit a View class?

I want to change methods used by a GestureOverlayView , i opened the GestureOverlayView.java file (obtained by jumping inside of it from the Debugger) but nothing that i change is actually executed. Is there any way to edit the class, or a better way like Overriding certain methods?

The specific change that i want to implement is no waiting delay after a "Single" gesture has been performed (It normally waits 700ms, so the user can make another stroke (theoretically) even when the mode is set to "Single" instead of "Multiple"). There also isn´t any method inside that helps me change that.

Thanks.

Upvotes: 2

Views: 153

Answers (1)

aneurinc
aneurinc

Reputation: 1238

Yes, you can subclass it like any normal Java class and Override the methods you want to change.

public class MyGestureOverlayView extends GestureOverlayView {
    ...
    @Override 
    public void cancelGesture() {
        // Add your own implementation 
    }
}

Upvotes: 2

Related Questions