0

我在 logcat 窗口中收到此错误。我已在构建路径中添加了所有外部 .jar 文件。但我不确定为什么在运行 android 项目时会抛出这个问题。请让我知道如何解决这个问题。

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    text1 = (EditText) findViewById(R.id.editText1);
    text2 = (EditText) findViewById(R.id.editText2);

}
public void onClick(View view) throws Exception {
double lat;
    double lon;
    String url = BASE_URL + "sites/" + SITE_ID + "/stations/" + STATION_MAC + "/";
    ClientResource itsClient = new ClientResource(url);
    itsClient.setChallengeResponse(ChallengeScheme.HTTP_BASIC, USERNAME, PASSWORD);
    // Retrieve and parse the JSON representation
    JsonRepresentation jsonRep = new JsonRepresentation(itsClient.get());
    JSONObject jsonObj = jsonRep.getJsonObject();
    // Output results
    lat=jsonObj.getJSONObject("loc").getDouble("lat");
    lon=jsonObj.getJSONObject("loc").getDouble("lng");
    switch (view.getId()) {
    case R.id.button1:

        String lats = Double.toString(lat);
        text1.setText(lats);
        String lons = Double.toString(lon);
        text2.setText(lons);
        break;
    }
}

谢谢!

4

0 回答 0