android - close popup window with same button -


I want to close the popup window with the same button, from which it opens, when I re-popup that button Click on the window should be closed. And when I click on the back button I still want to clear the window. Can anyone help me in this issue? Thank you ..

Here is my code,

  ivmainmenu.setOnClickListener (New OnClickListener) {@Override Click Public Zero (see V) {// TODO automatically generated Method Stub Layout Inflight Layout Infographic = (Layout Inflator) getBaseContext () .getSystemService (LAYOUT_INFLATER_SERVICE); See Popupview = LayoutInflator.in flat (R. Layopopwindo, blank); Last popup window popup window = new popup window (popupview, layout parama.philpaint, layout perm. WRAP_CONTENT); Popup window.shoedropropdown (ivmainmenu, 150,14); Popup Window.setOutsideTouchable (true); TextView TVPopupwork = (TextView) popupview (R.id.tvpopupwork); TextView TVPopupBoot = (TextView) popupviewFindvbupupababout (RID. TextView tvpopupservices = (TextView) popupView.findViewById (R.id.tvpopupservices); TextView TVPopup contact = (text view) popupview (R.id.tvpopupcontact); Tvpopupwork.setOnClickListener (New OnClickListener) {@Override Public Zero OnClick (see V) {// TODO auto generated method Stoo B intent = intent (new home), this is our job class); intent.addFlags (Intent. FLAG_ACTIVITY_NO_ANIMATION); startActivity;}}); Tvpopupabout.setOnClickListener (New OnClickListener) Click on {@Override Public Zero (Click V) {// TODO Automatically Intercepted Method To Intent = New Intent (Home This, about.class); intent.addFlags .FLAG_ACTIVITY_NO_ANIMATION); Beginning (intent);}}); Click on Tvpopupservices.setOnClickListener (New OnClickListener) {@Override Public Zero (see V) {// TODO Auto Generate Method Intent = New Intent (Home.this, Services.class); Intent.addFlags (Intent.FLAG_ACTIVITY_NO_ANIMATION); Beginner (intent);}}); Tvpopupcontact.setOnClickListener (New OnClickListener) {@Override public void onClick (see v) {// TODO auto generated method intent = new intent (Home.this, Contact.class); intent.addFlags (Intent.FLAG_ACTIVITY_NO_ANIMATION) ; Early (intent);}}); }});    

You can also create 2 listeners to listen on different programs. Listener 1 - This popup window will be used to work after opening Listener 2 - To close the popup window

You can set the listener to the other listener (switch listener on button click).

  listener2 = New OnClickListener () {@Override Click Public Zero (see V) {tv.setText ("Listener2"); // Assign Button for listener1 button.setOnClickListener (listener1); }}; Listener1 = New OnClickListener () {@Override Click Public Zero (see V) {tv.setText ("Listener1"); Assign Button for // listener2 Button .SetOnClicklist (listener2); }}; // Set this listener as the default (initial) listener button .setOnClickListener (listener1);    

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -