Page 182 - 완) I MDP 프로젝트 작품 보고서(전체과 1학년)1.6
P. 182
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); //액티비티
명.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 (MalformedMimeTypeException e) {
throw new RuntimeException("fail", e);
}
mFilters = new IntentFilter[] { ndef, };
mTechLists = new String[][] { new String[] { NfcF.class.getName() } };
- 175 -