//	http://www.tuling123.com/openapi/api?key=23d4c8cecf65a0c7258078a88743b374&info=嗨&userid=132632
  // 开始处理输入
  public void test00TuringAndTrans() throws JSONException {
    String key = input.getText().toString();
    if (key == null || key.equalsIgnoreCase("") || key.length() <= 0 || key == "\n") {
      return;
    }
    System.out.println("yzj key = " + input.getText().toString() + " key.length = " + key.length());
    // 测试专用语句
    if (key.equals("test")) {

      return;
    }
    if (key.startsWith(" ")) {
      // myWebView.setVisibility(View.INVISIBLE);
      input.setText("");
      textView.setText(key);
      new YourRequestAsyncTask().execute("baiduWebView", TuringUtils.toUtf8String(key));
      new YourRequestAsyncTask().execute("fanyi", TuringUtils.toUtf8String(key));
    } else if (key.startsWith(".")) {
      // myWebView.setVisibility(View.VISIBLE);
      input.setText("");
      new YourRequestAsyncTask().execute("word", TuringUtils.toUtf8String(key.replace(".", "")));
    } else {
      // myWebView.setVisibility(View.INVISIBLE);
      input.setText("");
      textView.setText(key);
      new YourRequestAsyncTask().execute("turing", TuringUtils.toUtf8String(key));
    }
  }
 public String wordApi(String query) throws JSONException {
   String httpUrl = "http://opendata.baidu.com/api.php";
   String httpArg = "resource_id=4043&query=" + query + "开头的成语";
   httpArg = TuringUtils.toUtf8String(httpArg);
   String jsonResult = TuringUtils.requestApi(httpUrl, httpArg);
   // 网络不好的情况下 todo 处理一下
   if (jsonResult == null) {
     return getResources().getString(R.string.bad_network);
   }
   //		JSONObject obj = new JSONObject(jsonResult.toString());
   //		JSONObject obj2 = (JSONObject) obj.getJSONObject("retData")
   //				.getJSONArray("trans_result").get(0);
   System.out.println("yzj " + jsonResult);
   return jsonResult;
 }
 public String turingApi(String key) throws JSONException {
   String httpUrl = "http://apis.baidu.com/turing/turing/turing";
   //		String httpArg = "key=879a6cb3afb84dbf4fc84a1df2ab7319&info=" + key
   String httpArg = "key=23d4c8cecf65a0c7258078a88743b374&info=" + key + "&userid=132632";
   String jsonResult = TuringUtils.requestApi(httpUrl, httpArg);
   System.out.println("yzj " + jsonResult);
   if (jsonResult == null) {
     return getResources().getString(R.string.bad_network);
   }
   System.out.println("yzj jsonResult = " + jsonResult);
   JSONObject obj = new JSONObject(jsonResult.toString());
   System.out.println("yzj text = " + obj.getString("text"));
   return obj.getString("text");
 }
 public String fanyiApi(String query) throws JSONException {
   String httpUrl = "http://apis.baidu.com/apistore/tranlateservice/translate";
   String httpArg = "query=" + query + "&from=auto&to=auto";
   System.out.println("yzj httpArg = " + httpArg);
   String jsonResult = TuringUtils.requestApi(httpUrl, httpArg);
   System.out.println("yzj " + jsonResult);
   // 网络不好的情况下 todo 处理一下
   if (jsonResult == null) {
     return getResources().getString(R.string.bad_network);
   }
   JSONObject obj = new JSONObject(jsonResult.toString());
   JSONObject obj2 = (JSONObject) obj.getJSONObject("retData").getJSONArray("trans_result").get(0);
   return obj2.getString("dst");
 }