Question

Let's say I have an List<E>, I want to invoke its add(E object) method, and my list is actually a List<String>, how should i represent this invocation in smali?

Should it be

invoke-interface {v1, v2}, Ljava/util/List;->add(Ljava/lang/Object;)Z

or

invoke-interface {v1, v2}, Ljava/util/List;->add(Ljava/lang/String;)Z

or something else?

Was it helpful?

Solution

It should be the first.

invoke-interface {v1, v2}, Ljava/util/List;->add(Ljava/lang/Object;)Z

When in doubt, you can try what you want in java, compile it, dx it, then baksmali it :)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top