Hi,
     I am trying to display a dialog box in a simple Java class that is
called from my main Activity but not successful.
Please help me to figure it out.

I am passing the required values as parametrs.


I have two class:

class MainActivity extends Activity  ::  Main *starting point *of
Application

class ShowMyDialog   ::      a simple java program In which I *generate an
URl* and *display a dialog with WebView*.
                                          I am passing the Acitivity from my
MainActivity to this class as a parameter in function.

But I am *unable to call* the onCreateDialog method that I have *defined in
the simple java class*.

However , If I define the *onCreateDialog method in MainActivity*, I am able
to display it* successfully.
*

*What Should I pass as Parameter to the non Activity class from MainActivity
class so that I am able to display the dialog as defined by showdialog
method in JAVA class ???*

My steps of source code is as follow:


class MainActivity extends Activity{

  onCreate{

            Activity passingActivity =  this;        //  THIS PASSING
PARAMETERS NEED TO BE CHANGED , getApplicationContext doesnot works for me
           ShowMyDialog showMyDialog = new ShowMyDialog(passingActivity);
           showMyDailog.displayMyDialog();

   }
}


class ShowMyDialog{

       public ShowMyDialog(Activity passingActivity){
            this.passingActivity = passingActivity;
       }


        public displayMyDialog (){
             int ID = 1;

            passingActivity.showdialog(ID);
        }

    protected Dialog onCreateDialog(int position){

             Dialog dialog = new Dialog(callingActivity);
             dialog.setContentView(R.layout.dialogbrowser);
             WebView mWebView = (WebView) dialog.findViewById(R.id.webview);
             mWebView.loadUrl("http://www.google.com";);
             return dialog
   }

}

Thanks,
NIshant

-- 
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