###前提・実現したいこと
NFC機能を用いてカード情報と他のクラスから入力したデータをPHPに送りたいのですが
入力したデータをPHPで出力するとnullが返ってきてしまいます。
etMessageの中にtagIdの値とdataの値を格納したいです。
宜しくお願いします。
###発生している問題・エラーメッセージ
if文内のdataの値がnullになってしまう。
###該当のソースコード
package com.ts_example.crest.myapplication; import android.app.Activity; import android.content.Intent; import android.icu.text.IDNA; import android.nfc.NfcAdapter; import android.os.Build; import android.os.Bundle; import android.util.Log; import android.widget.TextView; public class NextActivity extends Activity { String etAddress; int etPort; String etMessage; String data; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.next); TextView text = (TextView) findViewById(R.id.tag_id); // インテントの取得 Intent intent = getIntent(); //intentに保存されたデータを取り出す data = intent.getStringExtra("type"); // ICカードの検出かチェック String action = intent.getAction(); if (NfcAdapter.ACTION_TECH_DISCOVERED.equals(action)) { // NFCからID情報取得 byte[] ids = intent.getByteArrayExtra(NfcAdapter.EXTRA_ID); StringBuilder tagId = new StringBuilder("ID(" + ids.length + "bytes) : "); for (int i = 0; i < ids.length; i++) { tagId.append(String.format("%02x", ids[i] & 0xff)); } //String type = ",syukkin"; etMessage = (tagId.toString() + data); etAddress = "192.168.0.72"; etPort = 3333; ClientAsyncTask sc = new ClientAsyncTask(etAddress, etPort, etMessage); sc.execute(); } } }
###試したこと
if文の外で出力するとdataの中身は取得できるがtagIdがnullになってしまいます。
現在のソースではtagIdの値は受け取れているがdataの値がnullになってしまう。