Skip to content

Instantly share code, notes, and snippets.

Created May 21, 2013 22:45
Show Gist options
  • Save anonymous/5623878 to your computer and use it in GitHub Desktop.
Save anonymous/5623878 to your computer and use it in GitHub Desktop.
package com.SmartPosterTagWriter;
import java.io.IOException;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.PendingIntent;
import android.content.DialogInterface;
import android.content.Intent;
import android.nfc.NdefMessage;
import android.nfc.NdefRecord;
import android.nfc.NfcAdapter;
import android.nfc.Tag;
import android.nfc.TagLostException;
import android.nfc.tech.MifareClassic;
import android.nfc.tech.Ndef;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.View;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
public class WriteToPoster extends Activity implements Runnable {
Tag mTagFromIntent = null;
MifareClassic mClassic = null;
private NfcAdapter mAdapter;
private PendingIntent mPendingIntent;
...
/**
* This method is called when the activity is first created.
**/
@Override
public void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.writer);
View view = this.getWindow().getDecorView();
view.setBackgroundColor(100);
setPoster();
mAdapter = NfcAdapter.getDefaultAdapter(this);
mPendingIntent = PendingIntent.getActivity(this, 0,
new Intent(this, getClass()).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP), 0);
createTag(getIntent());
}
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment