Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6900455
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T07:32:54+00:00 2026-05-27T07:32:54+00:00

Is it possible to do method swizzling in android using java? i would like

  • 0

Is it possible to do method swizzling in android using java? i would like to intercept a system method and log its parameters then process it normally

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T07:32:54+00:00Added an answer on May 27, 2026 at 7:32 am

    I think that technique could not be used using Java in any environment.

    Maybe you could achieve a similar result using AOP.

    But what you can do with that looks limited on Android. See Aspect-oriented programming in android. In fact, since you won’t be compiling the target code (system method), compile-time weaving (which appears to be all you could use on Android) will be useless for this case. As is this answer I suppose.

    One other thought… I guess you want to do this logging consistently. But if you needed this to debug a problem, you could do it using a conditional breakpoint in Eclipse.

    A conditional expression can contain arbitrary Java code and may
    contain more than one statement, allowing breakpoint conditions to
    implement features like tracing. For example, a condition can execute
    a print statement and then return a hard coded value to never suspend
    (“System.out.println(…); return false;”).

    I don’t know specifically whether this works with methods in the Android SDK. But it does work with methods in the Java SDK. For example, here is simple code:

        System.err.println("foo");
    

    I made a conditional breakpoint in PrintStream.print, like this:

    System.err.println("hello: " + arg0);
    return false;
    

    And the console output when debugging in the program is this:

    hello: foo
    foo
    

    Note that since the JDK is not compiled with debug symbols, I can’t refer to method parameters by name, but using the arg0..argn.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wonder why it is not possible a method parameter as var type like
Possible Duplicate: Casting vs using the ‘as’ keyword in the CLR Which method is
Possible Duplicate: Extension Method Performance Will I face performance issues when I´m using extension
Possible Duplicate: PHP method chaining? I occasionally see some php applications use classes like
Possible Duplicate: PHP method chaining? I had a function for create user, like cruser
I would like to be able, at compile time, to ask any given method
I'm using ExtJS v2.0 . I would like to grab the gridfilter values and
Possible Duplicate: Extension method for Enumerable.Intersperse? I have a List<string> like this: foo, bar,
Possible Duplicate: Android (method for checking an arrays for repeated numbers?) I've just asked
In C++ it is possible to skip method parameter identifier if it's unused: void

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.