Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what's the difference between invoke-virtual and invoke-direct in android

It said that invoke-virtual is invoking the virtual method, while invoke-direct is the direct method.

However I'm not clear what is "virtual method" and what is "direct method"?

In other words, what kind of method invoking will be invoke-virtual and what kind will be invoke-direct?

Can anyone give some concrete example?

like image 888
ytliu Avatar asked Jul 19 '13 06:07

ytliu


1 Answers

From http://source.android.com/devices/tech/dalvik/dex-format.html, a direct method is "any of static, private, or constructor".

However, static methods get their own invoke-static opcode, so invoke-direct is used for constructors and private methods.

like image 86
JesusFreke Avatar answered Oct 21 '22 04:10

JesusFreke