List of usage examples for android.widget PopupWindow PopupWindow
public PopupWindow(View contentView, int width, int height, boolean focusable)
Create a new popup window which can display the contentView.
From source file:com.cybrosys.scientific.EventListener.java
@SuppressWarnings("deprecation") public void mode(String strDisplay, int inMode) { LayoutInflater inflater = (LayoutInflater) ctx.getSystemService(Context.LAYOUT_INFLATER_SERVICE); vwLayout = inflater.inflate(R.layout.fse, (ViewGroup) ((Activity) ctx).findViewById(R.id.popup_element)); popmW1 = new PopupWindow(vwLayout, PalmCalcActivity.inDispwidth, PalmCalcActivity.inDispheight, true); popmW1.setBackgroundDrawable(new BitmapDrawable()); popmW1.setOutsideTouchable(true);// w w w . j ava 2s .c o m TextView txtvHeaderPop = (TextView) vwLayout.findViewById(R.id.txtvHeaderFse); popmW1.showAtLocation(vwLayout, Gravity.CENTER, 0, 30); ImageButton btnCancel = (ImageButton) vwLayout.findViewById(R.id.butcancelmain); btnCancel.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { popmW1.dismiss(); } }); btnsM[0] = (Button) vwLayout.findViewById(R.id.btn1); btnsM[1] = (Button) vwLayout.findViewById(R.id.btn2); btnsM[2] = (Button) vwLayout.findViewById(R.id.btn3); btnsM[3] = (Button) vwLayout.findViewById(R.id.btn4); btnsM[4] = (Button) vwLayout.findViewById(R.id.btn5); btnsM[5] = (Button) vwLayout.findViewById(R.id.btn6); btnsM[6] = (Button) vwLayout.findViewById(R.id.btn7); btnsM[7] = (Button) vwLayout.findViewById(R.id.btn8); btnsM[8] = (Button) vwLayout.findViewById(R.id.btn9); btnsM[9] = (Button) vwLayout.findViewById(R.id.btn10); switch (inMode) { case 1: for (int inI = 1; inI <= 10; inI++) { btnsM[inI - 1].setText(fixDisp(Double.parseDouble(strDisplay), inI)); final int inK = inI; btnsM[inI - 1].setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { PreferenceClass.setMyIntPref(ctx, inK); ScientificActivity.txtvFSE.setText("FIX:" + (inK - 1)); popmW1.dismiss(); } }); } break; case 2: txtvHeaderPop.setText("Significant Digits"); for (int inI = 1; inI <= 10; inI++) { btnsM[inI - 1].setText(sciDisp(Double.parseDouble(strDisplay), inI)); final int inK = inI; btnsM[inI - 1].setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { inP = inK; ScientificActivity.txtvFSE.setText("SCI:" + inK); PreferenceClass.setMyIntPref(ctx, inP); popmW1.dismiss(); } }); } break; case 3: break; } }
From source file:brighton.uni.usmappedapp.Map.java
private void AboutPopupWindow() { try {//from w w w. j a va2 s.c o m // We need to get the instance of the LayoutInflater LayoutInflater inflater = (LayoutInflater) Map.this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); // View layout = inflater.inflate(R.layout.popup_layout, (ViewGroup) findViewById(R.id.popup_element)); // String pp = GooglePlayServicesUtil.getOpenSourceSoftwareLicenseInfo(this); //Retrieves a information set from google pwindo = new PopupWindow(layout, 400, 700, true); // creates and sets the valuse of the popup window pwindo.showAtLocation(layout, Gravity.CENTER, 0, 0); // sets the location pwindo.setOutsideTouchable(true); pwindo.setTouchable(true); // create button to be able to close the popup btnClosePopup = (Button) layout.findViewById(R.id.btn_close_popup); btnClosePopup.setOnClickListener(close_bnt_CL); } catch (Exception e) { e.printStackTrace(); } }
From source file:brighton.uni.usmappedapp.Map.java
private void HowToPopupWindow() { try {// w w w. j a va 2s . c o m // We need to get the instance of the LayoutInflater LayoutInflater inflater = (LayoutInflater) Map.this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View layout = inflater.inflate(R.layout.popup_layout2, (ViewGroup) findViewById(R.id.popup_element)); pwindo2 = new PopupWindow(layout, 500, 870, true); pwindo2.showAtLocation(layout, Gravity.CENTER, 0, 0); pwindo2.setOutsideTouchable(true); pwindo2.setTouchable(true); // btnClosePopup = (Button) layout.findViewById(R.id.btn_close_popup); btnClosePopup.setOnClickListener(close_bnt_CL_2); } catch (Exception e) { e.printStackTrace(); } }