public abstract class

XC_MethodReplacement

extends XC_MethodHook
java.lang.Object
   ↳ de.robv.android.xposed.callbacks.XCallback
     ↳ de.robv.android.xposed.XC_MethodHook
       ↳ de.robv.android.xposed.XC_MethodReplacement

Class Overview

A special case of XC_MethodHook which completely replaces the original method.

Summary

[Expand]
Inherited Constants
From class de.robv.android.xposed.callbacks.XCallback
Fields
public static final XC_MethodReplacement DO_NOTHING Predefined callback that skips the method without replacements.
[Expand]
Inherited Fields
From class de.robv.android.xposed.callbacks.XCallback
Public Constructors
XC_MethodReplacement()
Creates a new callback with default priority.
XC_MethodReplacement(int priority)
Creates a new callback with a specific priority.
Public Methods
static XC_MethodReplacement returnConstant(Object result)
Creates a callback which always returns a specific value.
static XC_MethodReplacement returnConstant(int priority, Object result)
Like returnConstant(Object), but allows to specify a priority for the callback.
Protected Methods
abstract Object replaceHookedMethod(XC_MethodHook.MethodHookParam param)
Shortcut for replacing a method completely.
[Expand]
Inherited Methods
From class de.robv.android.xposed.XC_MethodHook
From class java.lang.Object
From interface java.lang.Comparable

Fields

public static final XC_MethodReplacement DO_NOTHING

Predefined callback that skips the method without replacements.

Public Constructors

public XC_MethodReplacement ()

Creates a new callback with default priority.

public XC_MethodReplacement (int priority)

Creates a new callback with a specific priority.

Parameters
priority See XCallback.priority.

Public Methods

public static XC_MethodReplacement returnConstant (Object result)

Creates a callback which always returns a specific value.

Parameters
result The value that should be returned to callers of the hooked method.

public static XC_MethodReplacement returnConstant (int priority, Object result)

Like returnConstant(Object), but allows to specify a priority for the callback.

Parameters
priority See XCallback.priority.
result The value that should be returned to callers of the hooked method.

Protected Methods

protected abstract Object replaceHookedMethod (XC_MethodHook.MethodHookParam param)

Shortcut for replacing a method completely. Whatever is returned/thrown here is taken instead of the result of the original method (which will not be called).

Note that implementations shouldn't call super(param), it's not necessary.

Parameters
param Information about the method call.
Throws
Throwable Anything that is thrown by the callback will be passed on to the original caller.