基本的に、ユーザーが入力した値をURLに渡して、それに基づいて結果を表示しようとしています....エラーが発生しないため、何が問題なのかよくわかりません。どんな助けでも大歓迎です
ボタンをクリックしても何も起こらない...イベントリスナーが追加されているなど
package com.example.jsonrestclient;
import org.json.JSONException;
import org.json.JSONObject;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.View;
import android.widget.TextView;
import android.widget.EditText;
public class MainActivity extends Activity {
protected TextView tv1;
protected TextView tv2;
protected TextView tv3;
protected TextView tv4;
protected EditText ET1;
protected String ET2;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
tv1 = (TextView) findViewById(R.id.textView1);
tv2 = (TextView) findViewById(R.id.textView2);
tv3 = (TextView) findViewById(R.id.textView3);
tv4 = (TextView) findViewById(R.id.textView4);
ET1 = (EditText) findViewById(R.id.editText1);
ET2 = ET1.getText().toString();
}
public void button1OnClick(View v) {
String patientString = HttpHandler.HttpGetExec(HttpHandler.baseURI + ET2);
String patientFName = "NOT FOUND",
patientLName = "NOT FOUND",
DOB = "NOT FOUND",
patientGender = "NOT FOUND",
hospitalNumber = "NOT FOUND";
JSONObject patientObj = null;
try {
patientObj = new JSONObject(patientString);
patientFName = (String) patientObj.get("PatientFName");
patientLName = (String) patientObj.get("PatientLName");
DOB = (String) patientObj.get("DOB");
patientGender = (String) patientObj.get("PatientGender");
hospitalNumber = (String) patientObj.get("HospitalNumber");
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
tv1.setText(patientFName + " " + patientLName);
tv2.setText("DOB" + " " + DOB);
tv3.setText("Gender" + " " + patientGender);
tv4.setText("Hospital" + " " + hospitalNumber);
}
}