Sie sind auf Seite 1von 3

** 0.149 | 0.6 | Note | ID radioPTTSwitch switch Radio PTT Switch A dditionalSystem Instruments and Controls Display 2 ** 0.149 | 0.

6 | Note | ID escapeKey switch Escape Key CameraDispla y Instruments and Controls Display 2 ** 0.150 | 0.5 | Note | ID leftKey switch Left Key CameraDisplay In struments and Controls Display 2 ** 0.150 | 0.5 | Note | ID upKey switch Up Key CameraDisplay Instru ments and Controls Display 2 ** 0.151 | 0.5 | Note | ID downKey switch Down Key CameraDisplay In struments and Controls Display 2 ** 0.151 | 0.5 | Note | ID rightKey switch Right Key CameraDisplay Instruments and Controls Display 2 ** 0.152 | 0.5 | Note | ID enterKey switch Enter Key CameraDisplay Instruments and Controls Display 2 ** 0.152 | 0.5 | Note | ID manualTransmissionGearShiftLever dualPot Switch Manual Transmission Gear Shift GearLeverAndParkBrake Instruments and Cont rols Display 2 ** 0.153 | 0.8 | Note | ID parkingBrakeLever switch Parking Brake L ever GearLeverAndParkBrake Instruments and Controls Display 2 ** 0.154 | 0.6 | Note | ID batteryMasterIsolatorSwitch switch Batte ry Master Isolator Switch SwitchCluster Instruments and Controls Display 2 ** 0.154 | 0.7 | Note | ID parkingBrakeReleaseButton switch Parking Brake Release Button SwitchCluster Instruments and Controls Display 2 ** 0.155 | 0.7 | Note | ID throttleKnob dial Throttle Knob Ignition AndThrottle Instruments and Controls Display ** 0.156 | 0.6 | Note | ID displayModeEscapeButton switch Display M ode/Escape CCTV Instruments and Controls ** 0.156 | 0.5 | Note | ID displayLeftButton switch Display Left CC TV Instruments and Controls ** 0.157 | 0.5 | Note | ID displayUpButton switch Display Up CCTV I nstruments and Controls ** 0.157 | 0.5 | Note | ID displayDownButton switch Display Down CC TV Instruments and Controls ** 0.158 | 0.5 | Note | ID displayRightButton switch Display Right CCTV Instruments and Controls ** 0.158 | 0.5 | Note | ID displayEnterButton switch Display Enter CCTV Instruments and Controls ------------------------------------------------------------------------------------------------End of log file [2013-07-15 13-50-50] ------------------------------------------------------------------------------------------------package com.example.k53learners; import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; import import import import import import import org.apache.http.HttpEntity; org.apache.http.HttpResponse; org.apache.http.client.HttpClient; org.apache.http.client.methods.HttpPost; org.apache.http.impl.client.DefaultHttpClient; org.json.JSONArray; org.json.JSONObject;

import android.os.Bundle; import android.os.StrictMode; //import android.annotation.SuppressLint;

import android.app.Activity; import android.content.Intent; import android.util.Log; import android.view.View; //import android.view.Menu; //import android.view.View; import android.widget.Button; import android.widget.TextView; public class scores extends Activity { TextView resultView; Button sub; Button home; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.score1); StrictMode.enableDefaults(); resultView= (TextView) findViewById(R.id.viewresults); home = (Button) findViewById(R.id.home); getData(); home.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { // Starts a new class, MainActivity Intent i = new Intent(getApplicationContext(), M ainActivity.class); startActivity(i); } }); } public void getData(){ String result = ""; InputStream isr = null; try{ HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost("http://10.0.2.2/1.php"); / /PHP script stored on the WAMP server HttpResponse response = httpclient.execute(httppost); HttpEntity entity = response.getEntity(); isr = entity.getContent(); } catch(Exception e){ //Gets any error returned by the database conne ction Log.e("log_tag", "Error in http connection "+e.toString()); resultView.setText("COULD NOT CONNECT TO DATABSE !!"); } //convert response to string try{ BufferedReader reader = new BufferedReader(new InputStreamRe

ader(isr,"iso-8859-1"),8); StringBuilder sb = new StringBuilder(); String line = null; while ((line = reader.readLine()) != null) { sb.append(line + "\n"); } isr.close(); result=sb.toString(); } catch(Exception e){ Log.e("log_tag", "Error converting result "+e.toString()); } //parse json data try { String s = ""; JSONArray jArray = new JSONArray(result); for(int i=0; i<jArray.length();i++){ JSONObject json = jArray.getJSONObject(i); s = s + "Name : "+json.getString("Name")+"\n" + "Identity Number : "+json.getString(" StudentNo")+"\n"+ "Score : "+json.getString("Score")+"\ n\n"; } resultView.setText(s); } catch (Exception e) { // TODO: handle exception Log.e("log_tag", "Error Parsing Data "+e.toString()); } }

//@Override //public boolean onCreateOptionsMenu(Menu menu) { //// Inflate the menu; this adds items to the action bar if it i s present. //getMenuInflater().inflate(R.menu.main, menu); //return true; } // public class main activity //}

Das könnte Ihnen auch gefallen