Page 369 - 완) I MDP 프로젝트 작품 보고서(전체과 1학년)1.6
P. 369
private PendingIntent mPendingIntent;
private IntentFilter[] mFilters;
private String[][] mTechLists;
public static final int TYPE_TEXT = 1;
public static final int TYPE_URI = 2;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_read);
if (savedInstanceState == null) {
getSupportFragmentManager().beginTransaction()
.add(R.id.container, new PlaceholderFragment()).commit();
}
readResult = (TextView) findViewById(R.id.readResult);
// NFC 관련객체생성
mAdapter = NfcAdapter.getDefaultAdapter(this);
Intent targetIntent = new Intent(this, ReadActivity.class);
targetIntent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
mPendingIntent = PendingIntent.getActivity(this, 0, targetIntent, 0);
IntentFilter ndef = new IntentFilter(NfcAdapter.ACTION_NDEF_DISCOVERED);
try {
ndef.addDataType("*/*");
} catch (IntentFilter.MalformedMimeTypeException e) {
throw new RuntimeException("fail", e);
}
mFilters = new IntentFilter[] { ndef, };
mTechLists = new String[][] { new String[] { NfcF.class.getName() } };
Intent passedIntent = getIntent();
if (passedIntent != null) {
String action = passedIntent.getAction();
if (NfcAdapter.ACTION_TAG_DISCOVERED.equals(action)) {
- 362 -