Note that there are some explanatory texts on larger screens.

plurals
  1. POTo calculate the multiple operation at a time in android for calculator
    primarykey
    data
    text
    <p>I want to do multiple operation in calculator for example:<code>2+3*3/7</code>. How to do that. can any one help me. The single operation of the calculator work.</p> <p>How to calculate multiple operations in one <code>editText</code>. This code is added on equal button click method.</p> <p>Below is my code:</p> <pre><code> btnEqualto.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { String str2 = edtxt.getText().toString(); if (buttonPressed.equals("+")) { Log.e(TAG,"dot operation="+strDot); if (strDot.equals(".")) { Log.e(TAG, "If Codition :"); String str1[] = str2.split("[+]"); Log.e(TAG,"str1 ="+str1); String strVal11 = str1[0]; String strVal22 = str1[1]; Log.e(TAG, "strValues :" + strVal11 + " &amp; " + strVal22); Double xx = Double.parseDouble(strVal11); Double yy = Double.parseDouble(strVal22); Log.e(TAG, "Value of x :" + xx + " AND y : " + yy); Log.e(TAG, "dot operation"); Double result = xx + yy; Log.e(TAG, "Result :" + result); edtxt.setText(result + ""); Log.e(TAG, "VAlue of Result :" + edtxt); } else { Log.e(TAG, "If Codition :"+strVal2); strDot = ""; String str1[] = str2.split("[+]"); strVal1 = str1[0]; strVal2 = str1[1]; Log.e(TAG, "Esle Condition 4 Pllus strValues :" + strVal1 + " &amp; " + strVal2); x = Integer.parseInt(strVal1); y = Integer.parseInt(strVal2); Log.e(TAG, "Value of x :" + x + " AND y : " + y); int result = x + y; Log.e(TAG, "Result :" + result); edtxt.setText(result + ""); Log.e(TAG, "VAlue of Result :" + edtxt); } } } } ); </code></pre>
    singulars
    1. This table or related slice is empty.
    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.
 

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