android - Java Nullpointer exception on Activity start -


I'm ready to create an alert dialog to display an activity. Here is the complete code, manifest and error trace. Anyone can tell me the error told me.

  // A service intended intent = new intent (this, Myclass.class); Intent.addFlags (Intent.FLAG_ACTIVITY_NEW_TASK); Intent.putExtra ("TYPE", "ASToContainer"); Beginner (intent); // activity increases activation activity of the public class {@ Override Creature on Public Zero (Bundle Saved Instantstate) {Super.New (Saved Instantstate); String Type = Saved StainTest .getString ("TYPE"); If (type.equalsIgnoreCase ("ASToContainer")) {AlertDialog.Builder Builder = new AlertDialog.Builder (Myactivity.this); Builder .Setmessage (R. String SWEITHHEctivyYCOHOIPOACHOCO) Builder .set icon (R.drawable.icon); Builder.Seten Eligible (wrong); Builder.setTitle (R.string.SWITCH_AS_CONFIRMATION); builder.setPositiveButton (R.string.DIALOG_YES, New DialogInterface.OnClickListener () {public void onClick (DialogInterface dialog, int which) {AnotherService serviceInstance = AnotherService.getInstance () ;! if (serviceInstance = NULL) {serviceinstance._SwitchASToContainerRejected = 1 ; ServiceInstance.requestClearActiveSyncRegistration ();}}} .setNegativeButton (R.string.DIALOG_NO, new DialogInterface.OnClickListener () {public on zero (DialogInterface dialog, int which) {AnotherService.getInstance () ._ SwitchASToContainerRejected = 0; }}); Alrtdaylog warning = Bilderkkret (); alert.show ();}}} // manifest & lt; android: name = "mypackagename.activity.Myactivity" android: theme = "@ android: style / Theme. Dialog "& gt; & lt; / activity & gt; // Trace 07-24 16: 30: 04,877 C / Mayp (619): java.lang.RuntimeException: Activity ComponentInfo {inability} NullPointerException 07-24 16 : 30: 04.877: C / MyApp (619): android.app.ActivityThread.performLaunchActivity (ActivityThread.java:26663) 07-24 16: 30: 04.877: C / MyApp (619): On Android. app.ActivityThread.handleLaunchActivity (ActivityThread.java:2679) 07-24 16: 30: 04.877: C / MyApp (619): android.app.ActivityThread.access $ 2300 (ActivityThread.java:125) 07-24 16 On: 30: 04.877: C / MIP (619): Android. App ActiveTrade $ H. Holland Message (ActivityTrad.Java 2033) 07-24 16: 30: 04.877: C / Mayap (619): On Android.OS.Handler Disappoint Message (Handler. 99) 07-24 16: 30: 04.877: C / Mayap (619): Android.OS. Looper Oops (Looper.java:123) 07-24 16: 30: 04.877: C / MyApp (619): android.app.ActivityThread.main (ActivityThread.java:4627) 07-24 16: 30: 04.877: C / MyApp (619): java.lang.reflect.Method.invokeNative at (Native Method) 07-24 16: 30: 04.877: C / MIP (619): at java.lang.reflect.Method.invoke (Method .java: 521) 07-24 16: 30: 04.877: C / MyApp (619): com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run (ZygoteInit.java: 868) 07-24 16:30 : 04,877: C / Mayp (619): 07-24 on com.android.internal.os.ZygoteInit.main (ZygoteInit.java:626) 16: 30: 04.877: C / Mayp (619): DalvikksystemkNativeStart (Original method) 07-24 16: 30: 04.877: C / Mayap (619): Reason by: java.lang.NullPointerException 07-24 16: 30: 04.877: C / MyApp (619): 30 :: Com.example.myapp.IMC.onCreate (IMC.java:57) at 07-24 16 0.877: C / MyApp (619): android.app.Instrumentation.callActivityOnCreate (on instrumentation.   

I am doing wrong? Is this the right way to make prompt dialog? Please help me

The problem is "name of action".

Intent = Intentional Intent (this, Myclass.class); // You are using

But you are using "microbi"

From the service, you are calling the name of the activity "MyClus" but your activity is called "Mactivity" is. Thatswhy is throwing this Nullpointerexception because it is unable to find the class / activity name "MyClus".

So make changes that McClass's name is from Myactivity will solve this problem.

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -