Note that there are some explanatory texts on larger screens.

plurals
  1. POSeterror signal is not disappearing and Search is working
    primarykey
    data
    text
    <p>I have implemented the code of set error on two edit text.</p> <ul> <li>First to get any string without null or empty value.</li> <li>Second to get any string without null or empty value and must have some Double value.</li> </ul> <p>Code is as follows</p> <pre><code>import java.util.HashMap; import java.util.Map; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; public class SearchPlaces extends Activity { EditText place; EditText distance; Button search; static String _place; static String _distance; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); place = (EditText) findViewById(R.id.place); distance = (EditText) findViewById(R.id.distance); search = (Button) findViewById(R.id.search); search.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub Map&lt;String, String&gt; validate = new HashMap&lt;String, String&gt;(); _place = place.getText().toString(); _distance = distance.getText().toString(); validate.put("placename", _place); validate.put("distancenumeric", _distance); if (!validateInputInformation(validate)) { return; } if ((_place == "" &amp;&amp; _distance == "")) { Toast.makeText(getApplicationContext(), "Please fill all the information", Toast.LENGTH_SHORT).show(); } else { _place = place.getText().toString(); _distance = distance.getText().toString(); Intent placedist = new Intent(getApplicationContext(), MainActivity.class); Bundle bundle = new Bundle(); bundle.putString("place", _place); bundle.putString("distance", _distance); placedist.putExtras(bundle); startActivity(placedist); } } private boolean validateInputInformation( Map&lt;String, String&gt; validate) { String l_place = validate.get("placename"); if (l_place == null || l_place.equals("")) { place.setError("Please enter the Place First"); return false; } String l_distance = validate.get("distancenumeric"); if (l_distance == null || l_distance.equals("")) { distance.setError("Please enter the Distance First"); return false; } if (!isDoubleNumber(l_distance)) { distance.setError("Please enter Numeric Value"); return false; } return true; } private boolean isDoubleNumber (String num) { try { Double.parseDouble(num); } catch (NumberFormatException nfe) { return false; } return true; } }); } } </code></pre> <p>after implementing that all working are going good but <em>when I doesn't enter and click search button the error pops up in first edit-box after that when I reenter the correct values as input needed then the error notification doesn't disappear but search button works good.</em></p> <p>Please help me so that the set-error notification can be removed from the first editbox.</p>
    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