+ Reply to Thread
Results 1 to 3 of 3

Thread: help needed to show popup window...

  1. #1
    Join Date
    Aug 2009
    Location
    India
    Posts
    2

    Smile help needed to show popup window...


    hello,

    I want to show a LinearLayout (with other controls in it) as popup window on a button-click, could some one pls HELP me to solve it.....I googled but no luck.

    many thanks in advance
    Nitin
    Last edited by nitin2304; 08-06-2009 at 03:07 AM. Reason: spell correct

  2. #2
    Join Date
    Jun 2009
    Posts
    3

    Default Re: help needed to show popup window...

    Best Place to look for solution is android source code i recently wanted to implement popup window and after long search on web i found solution in android calendar module source code in "calendarview" class in "updateeventdetails" method her is my experience http://www.ceveni.com/2009/09/popup-...e-program.html

  3. #3
    Join Date
    Apr 2009
    Location
    Netherlands
    Posts
    16

    Default Re: help needed to show popup window...


    First inflate your layout.xml and assign it to a ViewGroup.
    Prepare the controls in the viewgroup. (fe. assign OnClickListeners)

    Personally I like to use AlertDialog.Builder to build a new alert dialog.
    Use the setView method to assign your layout/viewgroup to the dialog.
    Don't forget to call the create method.

    Best to do all of this in the Activity's onCreateDialog method
    Code:
        @Override
        protected Dialog onCreateDialog(int id) {
    //inflate layout
                LayoutInflater inflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);
                ViewGroup aboutview = (ViewGroup) inflater.inflate(R.layout.about, null);
    //prepare controls
                Button button = (Button) aboutview.findViewById(R.id.button);
                siteButton.setOnClickListener(new OnClickListener() {
                    @Override
                    public void onClick(View arg0) {
    //add code here..
                    }
                });
    //create alert dialog with layout assigned as view
                return new AlertDialog.Builder(this).setView(aboutview).create();
        }
    If you want to use a normal Dialog, use the setContentView method.

    To open the dialog just call the Activity's showDialog method from your button click handling code.

    To view links or images in signatures your post count must be 5 or greater. You currently have 0 posts.

+ Reply to Thread

Similar Threads

  1. SMS Popup feedback
    By adamk in forum Reviews
    Replies: 105
    Last Post: 03-17-2010, 12:01 AM
  2. SMS Popup Reply?
    By Azralag in forum New Application Ideas
    Replies: 13
    Last Post: 06-19-2009, 09:12 AM
  3. DGALERT vs SMS POPUP
    By ZEDEK in forum Reviews
    Replies: 20
    Last Post: 03-30-2009, 09:03 AM
  4. Browser Opens New Window Every Time!!
    By thegaterecords in forum General Android Chat
    Replies: 3
    Last Post: 02-19-2009, 08:40 AM
  5. SMS Popup/Chomp
    By jaynoonan in forum Applications
    Replies: 6
    Last Post: 12-22-2008, 01:11 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts