0

So there are basically two Activties. The first one has a TextView which I want to update, while the second activity is running. (therefore the first activity is onPause()) . You are able to see from the second activity the first activities TextView, because the second one isFloating, and the layout size is just about the half of the first activity (first activity takes out the whole screen). So whenever I press a button on the second activity which should update the TextView on the first Activity, the app crashes. Does anyone have an idea how to fix this. :)? ty for helping me.

logcat:

08-07 22:03:03.454 6132-6132/at.lorenzdirry.pokmonclick D/AndroidRuntime: Shutting down VM
08-07 22:03:03.455 6132-6132/at.lorenzdirry.pokmonclick E/AndroidRuntime: FATAL EXCEPTION: main
  Process: at.lorenzdirry.pokmonclick, PID: 6132
  Theme: themes:{default=overlay:com.cyngn.themes.yu, iconPack:com.cyngn.themes.yu, fontPkg:com.cyngn.hexo, com.android.systemui=overlay:com.cyngn.themes.yu, com.android.systemui.navbar=overlay:com.cyngn.themes.yu}
                                                                      java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.TextView.setText(java.lang.CharSequence)' on a null object reference
                                                                          at at.lorenzdirry.pokmonclick.StoreActivity$2.onClick(StoreActivity.java:72)
                                                                          at android.view.View.performClick(View.java:5204)
                                                                          at android.view.View$PerformClick.run(View.java:21158)
                                                                          at android.os.Handler.handleCallback(Handler.java:739)
                                                                          at android.os.Handler.dispatchMessage(Handler.java:95)
                                                                          at android.os.Looper.loop(Looper.java:148)
                                                                          at android.app.ActivityThread.main(ActivityThread.java:5461)
                                                                          at java.lang.reflect.Method.invoke(Native Method)
                                                                          at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
                                                                          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
  • usually, floating/transparent activities don't really show changes in activities behind them, android takes a "screnshot" of the screen, and displays the new activity above it. try displaying a progress-bar or some other animation in the paused activity, and check if it continues to animate behind the floating activity – marmor Aug 07 '16 at 19:57
  • animation is running ^^ –  Aug 07 '16 at 20:01
  • ok, that's good, please post the stack-trace for the crash you're getting – marmor Aug 07 '16 at 20:02
  • I am still kinda new to android/programming ^^, do you mean the logcat ouput :s? –  Aug 07 '16 at 20:06
  • yes, the logcat error lines that show which method had crashed, see here: http://stackoverflow.com/questions/3988788/what-is-a-stack-trace-and-how-can-i-use-it-to-debug-my-application-errors – marmor Aug 07 '16 at 20:08
  • k done :) I hope thats the right one ^^ –  Aug 07 '16 at 20:12
  • your error says `null object reference`, probably means you are incorrectly referencing the `TextView`, please post code that shows how you are trying to do it. You tell it to Do-**this**-to-**that**, but it says Do-**this**-to-**what?** – TWL Aug 07 '16 at 21:13

0 Answers0