作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有这段代码用 json 查询填充 ListView ,并且工作正常,但我想用 edittext 中编写的 where 查询填充该 View ,例如: Select * from tabla where name=(edittext).
class AsyncExecute extends AsyncTask<Void, Void, Void>{
@Override
protected Void doInBackground(Void... params) {
try {
// Llamamos al servicio web para recuperar los datos
HttpGet httpGet = new HttpGet("http://comupunt.esy.es/nombreb.php");
HttpClient httpClient = new DefaultHttpClient();
HttpResponse response = (HttpResponse)httpClient.execute(httpGet);
HttpEntity entity = response.getEntity();
BufferedHttpEntity buffer = new BufferedHttpEntity(entity);
InputStream iStream = buffer.getContent();
String aux = "";
BufferedReader r = new BufferedReader(new InputStreamReader(iStream));
StringBuilder total = new StringBuilder();
String line;
while ((line = r.readLine()) != null) {
aux += line;
}
// Parseamos la respuesta obtenida del servidor a un objeto JSON
JSONObject jsonObject = new JSONObject(aux);
JSONArray cities = jsonObject.getJSONArray("cities");
// Recorremos el array con los elementos cities
for(int i = 0; i < cities.length(); i++) {
JSONObject city = cities.getJSONObject(i);
// Creamos el objeto City
City c = new City(city.getString("name"),
city.getInt("nametwo"),city.getString("posicion") );
c.setData(city.getString("photo"));
listaPersonas.add(c.photo);
// Almacenamos el objeto en el array que hemos creado anteriormente
citiesAvaiable.add(c);
}
}
catch(Exception e) {
e.printStackTrace();
}
return null;
}
最佳答案
尝试这样的事情
String mEditText = (EditText)findViewById(R.id.edittext);
String EditTextValue = mEditText.getText.toString();
然后在where条件中传递这个EditTextValue
关于android - Mysql 查询(Where)与 edittext android,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27304095/
我是一名优秀的程序员,十分优秀!