Note that there are some explanatory texts on larger screens.

plurals
  1. PONFC tag and php
    primarykey
    data
    text
    <p>I am new to NFC tags and am interested on how it work. I have bought a NFC tag and am able to write studentid to the tag. Now my problem is how to pass the student id to a php web service and check if this student has paid his/her meals before thy can proceed to the cafeteria when thy scan their student cards through my application.</p> <p>Kindly anyone assist me on how i can do this. below is what i have done.</p> <pre><code>//reading the tag private String readText(NdefRecord record) throws UnsupportedEncodingException { byte[] payload = record.getPayload(); // Get the Text Encoding String textEncoding = ((payload[0] &amp; 128) == 0) ? "UTF-8" : "UTF-16"; // Get the Language Code int languageCodeLength = payload[0] &amp; 0063; // Get the Text return new String(payload, languageCodeLength + 1, payload.length - languageCodeLength - 1, textEncoding); } @Override protected void onPostExecute(String result) { if (result != null) { //show the student id in a textedit mTextView.setText(result); //pass variable to the server and get contents. I want to pass the student id to the method getstudentinfo(result); } } void getstudentinfo(String studID) { //get connection to the server using http request httpclient=new DefaultHttpClient(); httppost= new HttpPost("http://myip/getStudentBl.php?studID="+ studID); try{ response = getThreadSafeClient().execute(httppost); ResponseHandler&lt;String&gt; responseHandler = new BasicResponseHandler(); final String response = httpclient.execute(httppost, responseHandler); //checking the response and info the user runOnUiThread(new Runnable() { public void run() { dialog.dismiss(); } }); //if the user is found if(response.equalsIgnoreCase("Student Found")){ runOnUiThread(new Runnable() { public void run() { //Toast.makeText(MainActivity.this,"Saved Successfull", Toast.LENGTH_SHORT).show(); stdBalance.setText("Student Balance " + response); } }); //show the dashboard screen startActivity(new Intent(MainActivity.this, MainActivity.class)); }else if(response.equalsIgnoreCase("No Record")){ //show error results showAlert(); } //end try catch }catch(Exception e){ dialog.dismiss(); System.out.println("Exception : " + e.getMessage()); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload