Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,804,884 Members 52,848 Now Online
XDA Developers Android and Mobile Development Forum

Getting object from field from hook of a static method

Tip us?
 
hamzahrmalik
Old
(Last edited by hamzahrmalik; 18th August 2014 at 03:20 PM.)
#1  
hamzahrmalik's Avatar
Senior Member - OP
Thanks Meter 1,248
Posts: 1,058
Join Date: May 2013
Default Getting object from field from hook of a static method

I'm hooking a static method within class A
Class A contains a Context, mContext

i need to get the mContext
cannot use Xposedhelpers.getObjectField because i can't get param.thisObject so have nothing to pass to it
And i cant use

Class<?> clazz = XposedHelpers.findClass(LockPatternUtils, lpparam.classLoader);
Field f = clazz.getDeclaredField("mContext");
f.setAccessible(true);
c = (Context) f.get(what to pass here);

because i cant use the
field.get()
method, because i dont know what to pass
help is appreciated, thanks
 
GermainZ
Old
#2  
GermainZ's Avatar
Forum Moderator / Recognized Developer
Thanks Meter 6,355
Posts: 5,450
Join Date: Aug 2012
You can't access non static fields from a static method. You'll have to find an alternative way.
The Following User Says Thank You to GermainZ For This Useful Post: [ Click to Expand ]
 
hamzahrmalik
Old
#3  
hamzahrmalik's Avatar
Senior Member - OP
Thanks Meter 1,248
Posts: 1,058
Join Date: May 2013
Quote:
Originally Posted by GermainZ View Post
You can't access non static fields from a static method. You'll have to find an alternative way.
OK, thanks

Sent from my amazingly awesome OnePlus One using Tapatalk
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes