3
I’m making an android app that needs to show a message when starting for the first time. For example: the user installs my app and runs it. In this run, the app shows a message for the app to get a license and the user clicks "ok" to accept the terms and release the use of the app.
From there, the next time he runs the application, that message should not be displayed again.
I tried to do an accountant on OnCreate
but it didn’t. There’s something I can do?
Man logcat
after entering user code @array
:
02-26 16:42:40.895: D/AndroidRuntime(818): Shutting down VM
02-26 16:42:40.895: W/dalvikvm(818): threadid=1: thread exiting with uncaught exception (group=0x40a71930)
02-26 16:42:40.935: E/AndroidRuntime(818): FATAL EXCEPTION: main
02-26 16:42:40.935: E/AndroidRuntime(818): java.lang.RuntimeException: Unable to resume activity {com.example.testegerador/com.example.testegerador.MainActivity}: android.app.SuperNotCalledException: Activity {com.example.testegerador/com.example.testegerador.MainActivity} did not call through to super.onResume()
02-26 16:42:40.935: E/AndroidRuntime(818): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2742)
02-26 16:42:40.935: E/AndroidRuntime(818): at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2771)
02-26 16:42:40.935: E/AndroidRuntime(818): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2235)
02-26 16:42:40.935: E/AndroidRuntime(818): at android.app.ActivityThread.access$600(ActivityThread.java:141)
02-26 16:42:40.935: E/AndroidRuntime(818): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
02-26 16:42:40.935: E/AndroidRuntime(818): at android.os.Handler.dispatchMessage(Handler.java:99)
02-26 16:42:40.935: E/AndroidRuntime(818): at android.os.Looper.loop(Looper.java:137)
02-26 16:42:40.935: E/AndroidRuntime(818): at android.app.ActivityThread.main(ActivityThread.java:5041)
02-26 16:42:40.935: E/AndroidRuntime(818): at java.lang.reflect.Method.invokeNative(Native Method)
02-26 16:42:40.935: E/AndroidRuntime(818): at java.lang.reflect.Method.invoke(Method.java:511)
02-26 16:42:40.935: E/AndroidRuntime(818): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
02-26 16:42:40.935: E/AndroidRuntime(818): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
02-26 16:42:40.935: E/AndroidRuntime(818): at dalvik.system.NativeStart.main(Native Method)
02-26 16:42:40.935: E/AndroidRuntime(818): Caused by: android.app.SuperNotCalledException: Activity {com.example.testegerador/com.example.testegerador.MainActivity} did not call through to super.onResume()
02-26 16:42:40.935: E/AndroidRuntime(818): at android.app.Activity.performResume(Activity.java:5184)
02-26 16:42:40.935: E/AndroidRuntime(818): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2732)
02-26 16:42:40.935: E/AndroidRuntime(818): ... 12 more
02-26 16:44:05.165: I/Process(818): Sending signal. PID: 818 SIG: 9
Wouldn’t it be better to paste the code? Read: http://answall.com/help/mcve
– Guilherme Nascimento
@Guilherme, the user inserted the image pointing out the errors that he had found in my code, but that has already been corrected. See that I had declared Sharedpreferences private for
onCreate
.– itscorey
@Guest the point is not this but rather make something readable and easy "test". :)
– Guilherme Nascimento
@William, ah, yes. I’m sorry. I believe the correct one was: either he just edit with the code (as you said), or even send the image in the comments of the reply below (he already commented that there was an error.).
– itscorey
@Guest I didn’t really read the comments, but it’s not quite you that would have to edit something and rather it form a question using the link I indicated, your answer looks good, I haven’t paid attention to the details so I’m a little out of it. Just to emphasize, we are a community of q&a, comments are usually for quick discussions, codes and errors relevant to questions should not be posted in the comments, but rather in the scope of the question :) I believe you already know. Good night Guest
– Guilherme Nascimento