XDA Picks: Best Apps of the Week (Apr 17 – 24)

Apps are at the front and center of any smartphone experience, and with over a … more

Glimpse Notifications: Easier Lockscreen Notifications

Lollipop brought a revamp to the lockscreen, taking away custom widgets but … more

What Are the Best Looking Apps on Android?

As more developers are updating their apps with Material Design elements, we’re … more

Cyngn Explained: Who’s Cyanogen, What’s Cyanogen OS?

While Cyanogen, Inc has been the source of many headlines lately, there … more
Post Reply Subscribe to Thread Email Thread

Getting object from field from hook of a static method

18th August 2014, 03:14 PM |#1  
hamzahrmalik's Avatar
OP Senior Member
Thanks Meter: 1,663
 
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 03:20 PM.
 
 
18th August 2014, 05:46 PM |#2  
GermainZ's Avatar
Forum Moderator / Recognized Developer / XDA Portal Team
Thanks Meter: 8,165
 
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, 07:59 PM |#3  
hamzahrmalik's Avatar
OP Senior Member
Thanks Meter: 1,663
 
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