Android jump from Popupwindow to activity page

Source: Internet
Author: User

In a poupwindow that appears, click on a button on the page and the page will jump to another activity. The Popupwindow code is as follows:

1  PackageCom.cn.gordon.exhibition.walk.popup;2 3 Importcom.cn.gordon.exhibition.walk.activity.ForumArrangementActivity;4 ImportCOM.CN.GORDON.EXHIBITION.WALK.ACTIVITY.R;5 Importcom.cn.gordon.exhibition.walk.activity.VisitPlanActivity;6 7 Importandroid.app.Activity;8 ImportAndroid.content.Context;9 Importandroid.content.Intent;Ten Importandroid.graphics.drawable.ColorDrawable; One ImportAndroid.view.LayoutInflater; A ImportAndroid.view.View; - ImportAndroid.view.View.OnClickListener; - Importandroid.widget.LinearLayout; the ImportAndroid.widget.PopupWindow; - ImportAndroid.widget.RelativeLayout.LayoutParams; -  -  Public classArrangementpopupwindowextendsPopupwindow { +     PrivateView Contentview; -      PublicArrangementpopupwindow (FinalActivity context) { +Layoutinflater Inflater =(Layoutinflater) Context.getsystemservice (context.layout_inflater_service); AContentview = Inflater.inflate (R.layout.popupwindow_arrangement,NULL); at         //int h = Context.getwindowmanager (). Getdefaultdisplay (). GetHeight (); -         intW =Context.getwindowmanager (). Getdefaultdisplay (). getwidth (); -         //set the view of Selectpicpopupwindow -          This. Setcontentview (Contentview); -         //sets the width of the Selectpicpopupwindow pop-up form -          This. setwidth (W/2 + 50); in         //sets the height of the Selectpicpopupwindow pop-up form -          This. SetHeight (layoutparams.wrap_content); to         //set the Selectpicpopupwindow pop-up form to click +          This. setfocusable (true); -          This. setoutsidetouchable (true); the         //Refresh Status *          This. Update (); $         //instantiate a colordrawable color as translucentPanax NotoginsengColordrawable DW =NewColordrawable (0000000000); -         //point back and other places to make it disappear, set this to trigger Ondismisslistener, set other control changes and other actions the          This. setbackgrounddrawable (DW); +         //Mpopupwindow.setanimationstyle (Android. R.style.animation_dialog); A         //set Selectpicpopupwindow pop-up form animation effect the         //This.setanimationstyle (r.style.animationpreview); +LinearLayout Layout_forum =(linearlayout) Contentview - . Findviewbyid (r.id.layout_forum); $LinearLayout Layout_visitplan =(linearlayout) Contentview $ . Findviewbyid (r.id.layout_visitplanarrangement); -          -Layout_forum.setonclicklistener (NewOnclicklistener () { the              - @OverrideWuyi              Public voidOnClick (View v) { the                 if(Context.getclass (). Equals (visitplanactivity.class)) { -Intent in =NewIntent (context,forumarrangementactivity.class); Wu context.startactivity (in); -                      About                 } $Arrangementpopupwindow. This. Dismiss (); -             } -         }); -          A  +Layout_visitplan.setonclicklistener (NewOnclicklistener () { the      - @Override $              Public voidOnClick (View v) { the                 if(Context.getclass (). Equals (forumarrangementactivity.class)) { theIntent in =NewIntent (context,visitplanactivity.class); the context.startactivity (in); the                 } -                  inArrangementpopupwindow. This. Dismiss (); the             } the         }); About                  the     } the      the      Public voidShowpopupwindow (View parent) { +         if(! This. isshowing ()) {   -             //The following pull mode shows Popupwindow the              This. Showasdropdown (parent, Parent.getlayoutparams (). WIDTH/2, 18); Bayi}Else {   the              This. Dismiss ();  the         }   -     }   -}

In the Popupwindow need to use the previous page passed over the context, through the context to invoke startactivity implementation of the page jump.

Android jump from Popupwindow to activity page

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.