[TUTORIAL]How to add a popup toast message in game startup

H

HannCreator

Thread Author
BEFORE WE START THE TUTORIAL PLEASE READ
DON'T STEAL OTHER MODDER WORK AND REPLACE CREDIT TO YOU
[Requirements]
0. A working brain
1. A Computer
2. The apk file, obviously
3. dex/Apk decompiler with xml decoding support eg.(Apktool)
4. Text editor (Notepad++, Sublime Text, Atom, notepad)

[Info]
What exactly are we trying to do?
toast.png
surelock-toast-messages.png

*see image* Pretty much looks like that, but you may notice some moded games here show up with custom text like "diHacked oleh Aku sayang", "Hacked by Me" etc.

[Body]
1. Decompile apk with tools that mentioned above
2. Open AndroidManifest.xml, look for <action android:name="android.intent.action.MAIN"/>

Code:
<activity android:configChanges="locale|fontScale|keyboard|keyboardHidden|mcc|mnc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|touchscreen|uiMode" android:label="@string/app_name" android:launchMode="singleTop" android:name="net.circleous.domtweaks.StartActivity" android:screenOrientation="landscape">
  <intent-filter>
    <action android:name="android.intent.action.MAIN"/>
    <category android:name="android.intent.category.LAUNCHER"/>
  </intent-filter>
</activity>

if you read that carefully and see on top of it(<action android:name="android.intent.action.MAIN"/>) -> android.name="net.circleous.domtweaks.StartActivity"
You have to find StartActivity.smali file at smali/net/circleous/domtweaks/
3. If you found the StartActivity.smali file, open it.
4. Search the word "onCreate" it'il be look like this.

Code:
.method protected onCreate(Landroid/os/Bundle;)V
.locals

5. Add this under .locals

Code:
const/4 v0, 0x1

const-string v1, "YOUR MESSAGE"

invoke-static {p0, v1, v0}, Landroid/widget/Toast;->makeText(Landroid/content/Context;Ljava/lang/CharSequence;I)Landroid/widget/Toast;

move-result-object v0

invoke-virtual {v0}, Landroid/widget/Toast;->show()V

#OTHER CODE THAT YOU MAY NOT TOUCH IT

6. If you notice in line 2

Code:
const-string v1, "YOUR MESSAGE"

Change "YOUR MESSAGE" to everything what you want.
7. Recompile, sign and install the apk

[Credit]
HannCreator
iAndroHacker
 

Attachments

  • toast.png
    toast.png
    3.5 KB · Views: 686
  • surelock-toast-messages.png
    surelock-toast-messages.png
    12.4 KB · Views: 551

stelauAR

EMT
Exclusive Modding Team
4,617
09/02/15
6,366
Thread Author
best to search for
.method protected onCreate
if you just search onCreate you will get tons of results so with .method protected onCreate it narrows it down

hope this helps just a little bit
 

NEMESIS

Advance Member
364
09/25/15
155
Thread Author
any recommendation tools for decompile-recompile apk? since apktools is not proprly decompile/recompile the apk..

bump
 

Cheene

Member
136
03/11/16
30
Thread Author
best to search for
.method protected onCreate
if you just search onCreate you will get tons of results so with .method protected onCreate it narrows it down

hope this helps just a little bit

stelau4 Your Modded Games Have Picture ? Is Their Any Tut`s For It ?

 

Fallschirmjäger

New User
4
10/19/16
8
Thread Author
I dont really know why you put your name on credit and removed the actual person who made that >> Riu. While the content entirely copy-pasta and deleted some line. Though, all my lousy tutorial was generally licensed under CC 4.0 ¯\_(ツ)_/¯
 

vadeh

New User
16
06/23/16
0
Thread Author
I need the code for my toast:

" visit us mysite"

mysite = red color with hex
 
Last edited:

valdz

New User
4
10/07/17
1
Thread Author
hiiii i follow your tutorial. but when i install it i cant open the app? any idea?
 

Attachments

  • insidexml.png
    insidexml.png
    49.8 KB · Views: 227
  • Screenshot_20171007-100033.jpg
    Screenshot_20171007-100033.jpg
    20.5 KB · Views: 183
  • thepathofunityacivity.png
    thepathofunityacivity.png
    29.3 KB · Views: 205
  • insideunitynativeactivity.png
    insideunitynativeactivity.png
    44.1 KB · Views: 215
  • androidmanifest.png
    androidmanifest.png
    30.7 KB · Views: 226
Top Bottom