Thanks for your info.
The implementation of my input box class is
public class InputDialog extends Dialog {
public InputDialog(Context context) {
super(context);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.mydialog);
}
}
On Feb 10, 2:32 pm, venkat ranjit <[email protected]> wrote:
> Hi friend ,
>
> i am sending code that displays alertDialog using AlertDialog class ok
>
> package no.freedommedia.featurebooster.cmd;
>
> import java.util.ArrayList;
> import java.util.concurrent.Semaphore;
>
> import android.app.Activity;
> import android.app.AlertDialog.Builder;
> import android.content.Context;
> import android.content.DialogInterface;
>
> import android.util.Log;
>
> //public class MyAlertBox extends AlertDialog implements Runnable
> public class MyAlertBox extends Activity
> {
>
> public int m_query = -1;
> String m_title;
> String m_mymessage;
> ArrayList<String> m_buttonNames;
>
> Context m_context;
> Semaphore m_smp;
> MyAlertBox(){
>
> }
>
> public MyAlertBox(String title,String mymessage,ArrayList<String>
> softkeyvalue, Context context)
> {
>
> m_title = title;
> m_mymessage = mymessage;
> m_buttonNames = softkeyvalue;
>
> m_context = context;
> newThr nt = new newThr(m_title,m_mymessage,m_buttonNames);
> Thread t= new Thread(nt);
>
> t.start();
>
> try
> {
> synchronized (this)
> {
> Log.i("hello", "Constructor");
> this.wait();
>
> }
>
> }
> catch (InterruptedException e)
> {
>
> e.printStackTrace();
> }
>
> if(getDialogResult() != -1)
> {
> this.notify();
> }
>
> }
>
> public void settingAlertBox(String title,String
> mymessage,ArrayList<String> softkeyvalue)
> {
> Log.i("hello", "this is settingAlertBox " + softkeyvalue.size());
> Builder ab= new Builder(m_context);
> if(softkeyvalue.size() > 1)
> {
>
> ab.setTitle(title);
> ab.setMessage(mymessage);
>
> Log.i("hello", "this is first button before calling set+ve
> button");
>
> ab.setPositiveButton((String)softkeyvalue.get(0),new
> DialogInterface.OnClickListener()
> {
> public void onClick(DialogInterface dialog, int
> whichButton)
> {
> Log.i("hello", "this is first button, first button");
>
> m_query = 0;
>
> }
> }
>
> );
>
> Log.i("this is first button","after calling set+ve button");
>
> ab.setNegativeButton((String)softkeyvalue.get(1),new
> DialogInterface.OnClickListener()
> {
> public void onClick(DialogInterface dialog, int
> whichButton)
> {
>
> Log.i("hello", "this is 2nd button, second button");
>
> m_query = 1;
>
> }
> }
> );
>
> ab.show();
>
> Log.i("hello", "this is first button,after calling setnegative
> button");
>
> Log.i("tag", "m_query"+getDialogResult());
>
> }//if
> else
> {
> ab.setTitle(title);
> ab.setMessage(mymessage);
> ab.setPositiveButton((String)softkeyvalue.get(0),new
> DialogInterface.OnClickListener()
> {
> public void onClick(DialogInterface dialog, int
> whichButton)
> {
> Log.i("this is single button","Single button");
>
> m_query = 0;
>
> }
> }
> );
>
> ab.show();
> }
>
> }//else
>
> public int getDialogResult()
> {
>
> return m_query;
>
> }
>
> }
> On Sun, Feb 7, 2010 at 3:56 PM, YCH <[email protected]> wrote:
> > Hi,
>
> > I encountered a message like below when opening a custom dialog
> > through menu option.
>
> > 02-07 16:37:45.478: ERROR/BACKGROUND_PROC(1007):
> > android.view.WindowManager$BadTokenException: Unable to add window --
> > token null is not for an application
>
> > Using the latest sdk with 1.5 emulator.
>
> > Any ideas?
>
> > Thanks!
>
> > --
> > 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]<android-developers%[email protected]>
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en
--
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