How to Root Android Wear 5.0.1 Lollipop Devices – XDA TV

The Lollipop update for Android Wear devices has hit the market and people are … more

Android 5.0.2 and New Factory Images For Nexus 7 (Wi-Fi) Available

Android 5.0 is has been publicly available since early November, and the … more

Github Tutorial App Shows You How to Use… Github

Github can get pretty complicated and using it can become quite daunting, especially … more

Google Glass-like Clip-On For Regular Glasses Developed by Sony

For the price of $2,000, a pair of glasses that can run apps, take pictures, … more

Welcome to XDA

Search to go directly to your device's forum

Register an account

Unlock full posting privileges

Ask a question

No registration required
Post Reply

Getting object from field from hook of a static method

OP hamzahrmalik

18th August 2014, 04:14 PM   |  #1  
hamzahrmalik's Avatar
OP Senior Member
Thanks Meter: 1,433
 
1,187 posts
Join Date:Joined: May 2013
Donate to Me
More
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
Last edited by hamzahrmalik; 18th August 2014 at 04:20 PM.
18th August 2014, 06:46 PM   |  #2  
GermainZ's Avatar
Forum Moderator / Recognized Developer / XDA Portal Team
Thanks Meter: 7,333
 
5,910 posts
Join Date:Joined: Aug 2012
More
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: [ View ]
18th August 2014, 08:59 PM   |  #3  
hamzahrmalik's Avatar
OP Senior Member
Thanks Meter: 1,433
 
1,187 posts
Join Date:Joined: May 2013
Donate to Me
More
Quote:
Originally Posted by GermainZ

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
Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes