Note that there are some explanatory texts on larger screens.

plurals
  1. POTrouble with OnClick , LayoutInflater, and AlertDialog
    primarykey
    data
    text
    <p>I have a onClick event that opens and AlertDialog which is inflated with a LayoutInflater. I can click a button in the inflated AlertDialog and and an equation is solved. The problem is this OnClick is unresponsive, as in Nothing happens. Does anyone know why? </p> <p>EDIT Now the screen goes dark and I can tell I am no longer on the same activity because the screen is unresponsive but the View is still the original page. Push back button makes the screen bright again and responsive.</p> <pre><code>lay1.setOnLongClickListener(new OnLongClickListener() { public boolean onLongClick(View v) { LayoutInflater myLayout = LayoutInflater.from(context); final View dialogView = myLayout.inflate(R.layout.alerthelp, null); AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder( context); final AlertDialog alertDialog = alertDialogBuilder.create(); alertDialogBuilder.setView(dialogView); Button button1 = (Button) dialogView.findViewById(R.id.button1); button1.setOnClickListener(new OnClickListener(){ public void onClick(View v) { TextView stax1=(TextView)alertDialog.findViewById(R.id.salestax); String sax1 = stax1.getText().toString(); double sx1 = Double.parseDouble(sax1); TextView textviewlay1 =(TextView)alertDialog.findViewById(R.id.m1ab); String stringl1 = textviewlay1.getText().toString(); Double doubl1 = Double.parseDouble(stringl1); TextView textviewp1 = (TextView)alertDialog.findViewById(R.id.inputPrice); String stringp1 = textviewp1.getText().toString(); Double intp1 = Double.parseDouble(stringp1); double resultl1 = intp1 - (doubl1*sx1); int precision21t = 100; //keep 4 digits resultl1= Math.floor(resultl1 * precision21t +.5)/precision21t; textViewtotalproduct.setText(String.valueOf(resultl1)); }); alertDialog.show(); return true; }}); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload