android - Getting Fatal Exception after showing "Custom Toast Message" -


I am trying to learn Android by following some online video tutorials.

I've seen a video to create custom toast messages.

I followed the same thing. But after seeing the toast message I'm getting fatal exception (when stopped).

The exception is as follows:

  04-28 21: 36: 03.726: E / Android time (2417): fatal exception: main 04- 28 21: 36: 03.726: E / Android Rendime (2417): java.lang.IllegalArgumentException: Do not Attach Window Manager 04-28 21: 36: 03.726: E / Android Time (2417): Android. On. Windows Manager. Iplend View Window (WindowManagerImpl.java355) 04-28 21: 36: 03.726: E / Android Randomime (2417): Android. On. Windows Manager Impl. Review (Window Manager Impl. Java Version) 04-28 21: 36: 03.726: E / Android Random (2417): For Android. Whit Toast $ TN Holland Show (Toast.Java: 370) 04-28 21: 36: 03.726: E / Androindertime (2417): On Android. Toast $ TN $ 1.Run (toast.java 302) 04-28 21: 36: 03.726: E / Android Time (2417): Android.OS Handler Handyley Callback (Handler.Java TTO 87) 04-28 21:36: 03.726: E / AndroidRuntime (2417): android.os.Handler.dispatchMessage (Handler.java:92) on 04-28 21: 36: 03.726: E / AndroidRuntime (2417): android.os.Looper. On Loop (Looper.java:130) 04-28 21: 36: 03.726: E / AndroidRuntime (2417): android.app.ActivityThread.main (ActivityThread.java:3687) on 04-28 21:36: 03 .726: E / AndroidRuntime (2417): 36 :: 03.726: E / AndroidRuntime (2417): at java.lang.reflect.Method.invoke (Method.java:507 java.lang.reflect.Method.invokeNative ( Native Method) 04-28 on 21) 04-28 21: 36: 03.726: E / Android Rent Im (2417): com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run (ZygoteInit.java:867) 04-28 21: 36: 03.726: E / Android Time (2417): at com.android.internal.os. ZygoteInit.main (ZygoteInit.java:625) 04-28 21: 36: 03.726: E / AndroidRuntime (2417): at dalvik.system.NativeStart.main (Native resident method)  
< P> MainActivity.Java

  PublicAction Extends MainActivity ActionBarActivity {@Override Protected Zero OnCreate (bundled savedInstanceState) {super.onCreate (savedInstanceState); SetContentView (R.layout.activity_main); } Public Zero Shockstatstost (see V) (Toast Toast = New Toast); toast.setDuration (Toast.LENGTH_LONG); Toast. Setgravity (Gravity Botom, 0, 0); LayoutInflator Lin = Match-Layout Inflator (); See = lin.inflate (R.layout.custom, (ViewGroup) findViewById (R.id.LinearLayout1)); toast.setView (appear); toast.show ();}  

}

custom.xml

  & lt; xml version = "1.0" encoding = "utf-8" & gt; ; & Lt; LinearLayout xmlns: Android = "http://schemas.android.com/apk/res/android" Android: ID = "@ + id / LinearLayout1" Android: layout_width = "match Android: layout_height = "match_parent" Android: Orientation = "horizontal"> ImageView Android: id = "@ + id / imageView1" Android: layout_width = "wrap_content" Android: layout_height = "wrap_content" Android: Src = "@drawable / Ganesh" /> gt; TextView Android: Android: Android: layout_width = "wrap_content" Android: layout_height = "wrap_content" Android: text = "Ganesha" Android: text apparatus = "? Android: ATR / Text Appointment Large "/>  

< P> Set up your toast with context App:

Toast Toast = New Toast (Main Activity) This;

Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -