Skip to content Skip to sidebar Skip to footer

How To Return A Static Result In This Smali Code

.method private a()Landroid/content/Intent; .locals 5 .prologue .line 297 :try_start_0 iget-object v0, p0, Lcom/myapp/c/f;->b:Lcom/myapp/context/ApplicationContext; iget-objec

Solution 1:

Simply override the content of the string object before it's appended to the StringBuilder.

.line 304
invoke-virtual {v0}, Lcom/myapp/data/weblink;->getTitle()Ljava/lang/String;

move-result-object v4

# Add following line to override v4 before it's appended to the StringBuilderconst-string v4, "This is the link"

invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

Similarly, you can do the same for the link

invoke-virtual {v0}, Lcom/myapp/data/weblink;->getLink()Ljava/lang/String;

move-result-object v0

invoke-virtual {v0}, Ljava/lang/String;->toString()Ljava/lang/String;

move-result-object v0

# Add following line to override v0 before it's appended to the StringBuilder
const-string v0, "www.google.com"

invoke-virtual {v3, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

Actually, you can override the whole string at once before it's put to the intent.

invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

move-result-object v0

# Add this lineconst-string v0, "The whole text you want, including the title and link"

.line 303
invoke-virtual {v1, v2, v0}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;
:try_end_0
.catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

I hope you are not doing something bad.

Post a Comment for "How To Return A Static Result In This Smali Code"