Solved it. had to call dialog.cancel(); instead of finish();

Thanks
On Sat, Oct 8, 2011 at 1:14 AM, Appaholics <[email protected]> wrote:

> HI,
>
> I am showing a help dialog in my app. The dialog opens up fine but when I
> clock the cancel button the entire app closes. Line 62 is in red.
>
> Logcat:
>
> 10-08 01:11:19.659: ERROR/WindowManager(28224): Activity
> com.raghavsood.tirerun.Menu has leaked window
> com.android.internal.policy.impl.PhoneWindow$DecorView@4052d5d8 that was
> originally added here
> 10-08 01:11:19.659: ERROR/WindowManager(28224): android.view.WindowLeaked:
> Activity com.raghavsood.tirerun.Menu has leaked window
> com.android.internal.policy.impl.PhoneWindow$DecorView@4052d5d8 that was
> originally added here
> 10-08 01:11:19.659: ERROR/WindowManager(28224):     at
> android.view.ViewRoot.<init>(ViewRoot.java:259)
> 10-08 01:11:19.659: ERROR/WindowManager(28224):     at
> android.view.WindowManagerImpl.addView(WindowManagerImpl.java:148)
> 10-08 01:11:19.659: ERROR/WindowManager(28224):     at
> android.view.WindowManagerImpl.addView(WindowManagerImpl.java:91)
> 10-08 01:11:19.659: ERROR/WindowManager(28224):     at
> android.view.Window$LocalWindowManager.addView(Window.java:424)
> 10-08 01:11:19.659: ERROR/WindowManager(28224):     at
> android.app.Dialog.show(Dialog.java:241)
> 10-08 01:11:19.659: ERROR/WindowManager(28224):     at
> com.raghavsood.tirerun.Menu.helpClicked(Menu.java:62)
> 10-08 01:11:19.659: ERROR/WindowManager(28224):     at
> java.lang.reflect.Method.invokeNative(Native Method)
> 10-08 01:11:19.659: ERROR/WindowManager(28224):     at
> java.lang.reflect.Method.invoke(Method.java:507)
> 10-08 01:11:19.659: ERROR/WindowManager(28224):     at
> android.view.View$1.onClick(View.java:2139)
> 10-08 01:11:19.659: ERROR/WindowManager(28224):     at
> android.view.View.performClick(View.java:2485)
> 10-08 01:11:19.659: ERROR/WindowManager(28224):     at
> android.view.View$PerformClick.run(View.java:9080)
> 10-08 01:11:19.659: ERROR/WindowManager(28224):     at
> android.os.Handler.handleCallback(Handler.java:587)
> 10-08 01:11:19.659: ERROR/WindowManager(28224):     at
> android.os.Handler.dispatchMessage(Handler.java:92)
> 10-08 01:11:19.659: ERROR/WindowManager(28224):     at
> android.os.Looper.loop(Looper.java:123)
> 10-08 01:11:19.659: ERROR/WindowManager(28224):     at
> android.app.ActivityThread.main(ActivityThread.java:3729)
> 10-08 01:11:19.659: ERROR/WindowManager(28224):     at
> java.lang.reflect.Method.invokeNative(Native Method)
> 10-08 01:11:19.659: ERROR/WindowManager(28224):     at
> java.lang.reflect.Method.invoke(Method.java:507)
> 10-08 01:11:19.659: ERROR/WindowManager(28224):     at
> com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:874)
> 10-08 01:11:19.659: ERROR/WindowManager(28224):     at
> com.android.internal.os.ZygoteInit.main(ZygoteInit.java:632)
> 10-08 01:11:19.659: ERROR/WindowManager(28224):     at
> dalvik.system.NativeStart.main(Native Method)
>
>
> Dialog Code:
>
> public void helpClicked(View v) {
>
> //Intent help = new Intent(this, Help.class);
>
> //startActivity(help);
>
> //set up dialog
>
>         Dialog dialog = new Dialog(this);
>
>         dialog.setContentView(R.layout.help);
>
>         dialog.setTitle("This is my custom dialog box");
>
>         dialog.setCancelable(true);
>
>         //there are a lot of settings, for dialog, check them all out!
>
>
>         //set up text
>
>         TextView text = (TextView) dialog.findViewById(R.id.TextView01);
>
>         text.setText(R.string.help);
>
>
>
>         //set up button
>
>         Button button = (Button) dialog.findViewById(R.id.Button01);
>
>         button.setOnClickListener(new OnClickListener() {
>
>         public void onClick(View v) {
>
>                 finish();
>
>             }
>
>         });
>
>         //now that the dialog is set up, it's time to show it
>
>         dialog.show();
>
>     }
>
> Dialog XML:
>
> <?xml version="1.0" encoding="utf-8"?>
>
> <RelativeLayout
>
>  xmlns:android="http://schemas.android.com/apk/res/android";
>
>  android:layout_width="wrap_content"
>
>  android:layout_height="wrap_content">
>
>
>
>  <ScrollView android:id="@+id/ScrollView01"
>
>  android:layout_width="wrap_content"
>
>  android:layout_height="200px">
>
>
>
>  <TextView android:text="@+id/TextView01" android:id="@+id/TextView01"
>
>  android:layout_width="wrap_content" android:layout_height="wrap_content"
> />
>
>
>
>  </ScrollView>
>
>
>
>  <Button android:id="@+id/Button01" android:layout_below="@id/ScrollView01"
>
>  android:layout_width="wrap_content" android:layout_height="wrap_content"
>
>  android:layout_centerHorizontal="true" android:text="Cancel" />
>
>
>
> </RelativeLayout>
>
>
> How do I solve this?
>
> Thanks
> --
> ------------------
> Raghav Sood
> CEO/Founder/Owner/Dictator/Tyrant at Appaholics (Basically all titles
> required to have complete control)
> http://www.raghavsood.com/
> https://market.android.com/developer?pub=Appaholics
> http://www.appaholics.in/
>
>


-- 
------------------
Raghav Sood
CEO/Founder/Owner/Dictator/Tyrant at Appaholics (Basically all titles
required to have complete control)
http://www.raghavsood.com/
https://market.android.com/developer?pub=Appaholics
http://www.appaholics.in/

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to