Index: trunk/TagTracker/AndroidManifest.xml
===================================================================
--- trunk/TagTracker/AndroidManifest.xml	(revision 5)
+++ trunk/TagTracker/AndroidManifest.xml	(revision 6)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
-    package="nl.deadpixel.tagtracker.beta"
+    package="nl.powercraft.tagtracker"
     android:versionCode="1"
     android:versionName="1.0" >
Index: trunk/TagTracker/gen/nl/powercraft/tagtracker/BuildConfig.java
===================================================================
--- trunk/TagTracker/gen/nl/powercraft/tagtracker/BuildConfig.java	(revision 6)
+++ trunk/TagTracker/gen/nl/powercraft/tagtracker/BuildConfig.java	(revision 6)
@@ -0,0 +1,6 @@
+/** Automatically generated file. DO NOT MODIFY */
+package nl.powercraft.tagtracker;
+
+public final class BuildConfig {
+    public final static boolean DEBUG = true;
+}
Index: trunk/TagTracker/gen/nl/powercraft/tagtracker/R.java
===================================================================
--- trunk/TagTracker/gen/nl/powercraft/tagtracker/R.java	(revision 6)
+++ trunk/TagTracker/gen/nl/powercraft/tagtracker/R.java	(revision 6)
@@ -0,0 +1,53 @@
+/* AUTO-GENERATED FILE.  DO NOT MODIFY.
+ *
+ * This class was automatically generated by the
+ * aapt tool from the resource data it found.  It
+ * should not be modified by hand.
+ */
+
+package nl.powercraft.tagtracker;
+
+public final class R {
+    public static final class attr {
+    }
+    public static final class drawable {
+        public static final int ic_launcher=0x7f020000;
+        public static final int tag_accept=0x7f020001;
+        public static final int tb_offstate=0x7f020002;
+        public static final int tb_onstate=0x7f020003;
+        public static final int toggle_button=0x7f020004;
+    }
+    public static final class id {
+        public static final int Screen=0x7f080002;
+        public static final int add_note=0x7f080007;
+        public static final int add_uid=0x7f080006;
+        public static final int emailTo=0x7f080001;
+        public static final int layout_root=0x7f080000;
+        public static final int status=0x7f080004;
+        public static final int stopsend=0x7f080008;
+        public static final int text=0x7f080003;
+        public static final int zend=0x7f080005;
+    }
+    public static final class layout {
+        public static final int mail_popup=0x7f030000;
+        public static final int main=0x7f030001;
+    }
+    public static final class menu {
+        public static final int lo_menu=0x7f070000;
+    }
+    public static final class string {
+        public static final int app_name=0x7f050001;
+        public static final int hello=0x7f050000;
+    }
+    public static final class style {
+        public static final int ActionBar=0x7f060001;
+        public static final int ActionBar_Light=0x7f060003;
+        /**  Any customizations for your app running on pre-3.0 devices here 
+         */
+        public static final int MyTheme=0x7f060000;
+        public static final int ToggleButton=0x7f060002;
+    }
+    public static final class xml {
+        public static final int techlist=0x7f040000;
+    }
+}
Index: trunk/TagTracker/res/layout/main.xml
===================================================================
--- trunk/TagTracker/res/layout/main.xml	(revision 5)
+++ trunk/TagTracker/res/layout/main.xml	(revision 6)
@@ -16,5 +16,4 @@
     <ToggleButton
         android:id="@+id/status"
-        style="@style/ToggleButton"
         android:layout_width="match_parent"
         android:layout_height="200dp"
Index: trunk/TagTracker/src/nl/powercraft/tagtracker/FileHandler.java
===================================================================
--- trunk/TagTracker/src/nl/powercraft/tagtracker/FileHandler.java	(revision 6)
+++ trunk/TagTracker/src/nl/powercraft/tagtracker/FileHandler.java	(revision 6)
@@ -0,0 +1,125 @@
+package nl.powercraft.tagtracker;
+
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+
+import android.os.Environment;
+import android.util.Log;
+
+public class FileHandler {
+        
+	public boolean init()
+	{
+		boolean mExternalStorageAvailable = false;
+		boolean mExternalStorageWriteable = false;
+		String state = Environment.getExternalStorageState();
+
+		if (Environment.MEDIA_MOUNTED.equals(state)) {
+		    // We can read and write the media
+		    mExternalStorageAvailable = mExternalStorageWriteable = true;
+		} else if (Environment.MEDIA_MOUNTED_READ_ONLY.equals(state)) {
+		    // We can only read the media
+		    mExternalStorageAvailable = true;
+		    mExternalStorageWriteable = false;
+		} else {
+		    // Something else is wrong. It may be one of many other states, but all we need
+		    //  to know is we can neither read nor write
+		    mExternalStorageAvailable = mExternalStorageWriteable = false;
+		}		
+		
+		if(mExternalStorageAvailable && mExternalStorageWriteable)
+		{
+			File root = new File(Environment.getExternalStorageDirectory(), "TagTracker");
+			if (!root.exists()) {
+	            root.mkdirs();
+	        }
+			return true;
+		}
+		else
+		{
+			return false;
+		}
+	}
+	public void writeUID(String uid, String time)
+	{
+		try {
+			File root = new File(Environment.getExternalStorageDirectory(), "TagTracker");
+		    File xmlfile = new File(root, "tags.xml");
+		    FileWriter writer = new FileWriter(xmlfile,true);
+			String tag = 
+	        		"	<tag uid=\"" + uid + "\">\r\n" +
+	        		"		<time>" + time + "</time>\r\n" +
+	        		"	</tag>\r\n";
+	        writer.append(tag);
+	        writer.flush();
+	        writer.close();	
+		} catch (IOException e) {
+			Log.e("TagTracker", "" + e.getMessage());
+		}
+        	
+	}
+	
+	public void writeNote(String note)
+	{
+		try {
+			File root = new File(Environment.getExternalStorageDirectory(), "TagTracker");
+		    File xmlfile = new File(root, "tags.xml");
+		    FileWriter writer = new FileWriter(xmlfile,true);
+			String tag = 
+	        		"	<note>\r\n" +
+	        		"	" + note +
+	        		"	<note>\r\n";
+	        writer.append(tag);
+	        writer.flush();
+	        writer.close();	
+		} catch (IOException e) {
+			Log.e("TagTracker", "" + e.getMessage());
+		}
+        	
+	}
+	public void writeStart(String starttime)
+	{
+		try
+	    {
+			File root = new File(Environment.getExternalStorageDirectory(), "TagTracker");
+		    File xmlfile = new File(root, "tags.xml");
+		    FileWriter writer = new FileWriter(xmlfile,false);
+	        String start = 
+	        		"<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n" +
+	        		"<tags>\r\n" +
+	        		"	<start time=\""+starttime+"\" />\r\n";
+	        //Log.i("TagTracker", "Writing start...");
+	        writer.write(start);
+	        //Log.i("TagTracker", "Wrote start...");
+	        writer.flush();
+	        writer.close();
+	    }
+	    catch(IOException e)
+	    {
+	         Log.e("TagTracker", ""+ e.getMessage());
+	    }		
+	}
+	public void writeEnd(String endtime)
+	{
+		try
+	    {
+			File root = new File(Environment.getExternalStorageDirectory(), "TagTracker");
+		    File xmlfile = new File(root, "tags.xml");
+		    FileWriter writer = new FileWriter(xmlfile,true);
+	        String end =
+	        		"	<end time=\""+endtime+"\" />\r\n" +
+	        		"</tags>";
+	        //Log.i("TagTracker", "Writing end...");
+	        writer.append(end);
+	        //Log.i("TagTracker", "Wrote end...");
+	        writer.flush();
+	        writer.close();
+	    }
+	    catch(IOException e)
+	    {
+	         Log.e("TagTracker", ""+ e.getMessage());
+	    }		
+	}
+}
Index: trunk/TagTracker/src/nl/powercraft/tagtracker/ObjectSerializer.java
===================================================================
--- trunk/TagTracker/src/nl/powercraft/tagtracker/ObjectSerializer.java	(revision 6)
+++ trunk/TagTracker/src/nl/powercraft/tagtracker/ObjectSerializer.java	(revision 6)
@@ -0,0 +1,62 @@
+package nl.powercraft.tagtracker;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+
+import android.util.Log;
+
+public class ObjectSerializer {
+
+    
+    public static String serialize(Serializable obj) {
+        if (obj == null) return "";
+        try {
+            ByteArrayOutputStream serialObj = new ByteArrayOutputStream();
+            ObjectOutputStream objStream = new ObjectOutputStream(serialObj);
+            objStream.writeObject(obj);
+            objStream.close();
+            return encodeBytes(serialObj.toByteArray());
+        } catch (Exception e) {
+            Log.e("TagTracker","Serialization error: " + e.getMessage(), e);
+        }
+		return "";
+    }
+    
+    public static Object deserialize(String str) {
+        if (str == null || str.length() == 0) return null;
+        try {
+            ByteArrayInputStream serialObj = new ByteArrayInputStream(decodeBytes(str));
+            ObjectInputStream objStream = new ObjectInputStream(serialObj);
+            return objStream.readObject();
+        } catch (Exception e) {
+            Log.e("TagTracker","Deserialization error: " + e.getMessage(), e);
+        }
+		return null;
+    }
+    
+    public static String encodeBytes(byte[] bytes) {
+        StringBuffer strBuf = new StringBuffer();
+    
+        for (int i = 0; i < bytes.length; i++) {
+            strBuf.append((char) (((bytes[i] >> 4) & 0xF) + ((int) 'a')));
+            strBuf.append((char) (((bytes[i]) & 0xF) + ((int) 'a')));
+        }
+        
+        return strBuf.toString();
+    }
+    
+    public static byte[] decodeBytes(String str) {
+        byte[] bytes = new byte[str.length() / 2];
+        for (int i = 0; i < str.length(); i+=2) {
+            char c = str.charAt(i);
+            bytes[i/2] = (byte) ((c - 'a') << 4);
+            c = str.charAt(i+1);
+            bytes[i/2] += (c - 'a');
+        }
+        return bytes;
+    }
+
+}
Index: trunk/TagTracker/src/nl/powercraft/tagtracker/TagTrackerActivity.java
===================================================================
--- trunk/TagTracker/src/nl/powercraft/tagtracker/TagTrackerActivity.java	(revision 6)
+++ trunk/TagTracker/src/nl/powercraft/tagtracker/TagTrackerActivity.java	(revision 6)
@@ -0,0 +1,394 @@
+package nl.powercraft.tagtracker;
+
+
+import java.io.File;
+import java.io.IOException;
+import java.text.DateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+
+import android.app.Activity;
+import android.app.AlertDialog;
+import android.app.PendingIntent;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.content.IntentFilter.MalformedMimeTypeException;
+import android.content.SharedPreferences;
+import android.media.AudioManager;
+import android.media.MediaPlayer;
+import android.media.RingtoneManager;
+import android.media.ToneGenerator;
+import android.net.Uri;
+import android.nfc.NfcAdapter;
+import android.nfc.tech.NfcA;
+import android.os.Bundle;
+import android.os.Environment;
+import android.os.Handler;
+import android.os.PowerManager;
+import android.os.PowerManager.WakeLock;
+import android.util.Log;
+import android.view.Menu;
+import android.view.MenuInflater;
+import android.view.MenuItem;
+import android.view.View;
+import android.widget.Button;
+import android.widget.EditText;
+import android.widget.RelativeLayout;
+import android.widget.ToggleButton;
+
+public class TagTrackerActivity extends Activity {
+	private NfcAdapter mAdapter;
+    private PendingIntent mPendingIntent;
+    private IntentFilter[] mFilters;
+    private String[][] mTechLists;
+    private FileHandler fh = new FileHandler();
+    private boolean writeAllow = false;
+    private ArrayList<String> cardID = new ArrayList<String>();
+    private RelativeLayout mScreen;
+    
+    @SuppressWarnings("unchecked")
+	@Override
+    public void onCreate(Bundle savedState) {
+        super.onCreate(savedState);
+        final PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
+        WakeLock mWakeLock;
+        setContentView(R.layout.main);
+        final Button button = (Button) findViewById(R.id.zend);
+        button.setOnClickListener(new View.OnClickListener() {
+            public void onClick(View v) {
+            	zenden();
+            }
+        });
+        SharedPreferences p = getPreferences(MODE_PRIVATE);
+        writeAllow = p.getBoolean("writeAllow", false);
+        cardID = (ArrayList<String>) ObjectSerializer.deserialize(p.getString("cardID", ObjectSerializer.serialize(new ArrayList<String>())));
+        ToggleButton tg = (ToggleButton) findViewById(R.id.status);
+        tg.setChecked(writeAllow);
+        mScreen = (RelativeLayout) findViewById(R.id.Screen);
+        mWakeLock = pm.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK | PowerManager.ON_AFTER_RELEASE,"");    
+        mWakeLock.acquire();
+        mAdapter = NfcAdapter.getDefaultAdapter(this);
+
+        // Create a generic PendingIntent that will be deliver to this activity. The NFC stack
+        // will fill in the intent with the details of the discovered tag before delivering to
+        // this activity.
+        mPendingIntent = PendingIntent.getActivity(this, 0, new Intent(this, getClass()).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP), 0);
+
+        // Setup an intent filter for all MIME based dispatches
+        IntentFilter tech = new IntentFilter(NfcAdapter.ACTION_TECH_DISCOVERED);
+        try {
+            tech.addDataType("*/*");
+        } catch (MalformedMimeTypeException e) {
+            throw new RuntimeException("fail", e);
+        }
+        mFilters = new IntentFilter[] {
+               tech,
+        };
+
+        // Setup a tech list for all NfcF tags
+        mTechLists = new String[][] { new String[] { NfcA.class.getName() } };
+    }
+    
+    public void onToggleClicked(View v) {
+        // Perform action on clicks
+        if (((ToggleButton) v).isChecked()) {
+        	if(fh.init())
+            {
+            	fh.writeStart(DateFormat.getDateTimeInstance().format(new Date()));
+            	writeAllow = true;
+            }
+            else
+            {
+            	finish();
+            }
+        } else {
+            fh.writeEnd(DateFormat.getDateTimeInstance().format(new Date()));
+            writeAllow = false;
+            cardID.clear();
+        }
+    }
+
+    @Override
+    public void onResume() {
+        super.onResume();
+        if (mAdapter != null) mAdapter.enableForegroundDispatch(this, mPendingIntent, mFilters,
+                mTechLists);
+    }
+
+    @Override
+    public void onNewIntent(Intent intent) {
+    	if(writeAllow)
+    	{
+	    	byte[] bid = intent.getByteArrayExtra(NfcAdapter.EXTRA_ID); 
+		    	try
+		    	{
+		    		String uid = getHexString(bid);
+		    		String time = DateFormat.getDateTimeInstance().format(new Date());
+		    		if(!cardID.contains(uid))
+			    	{
+			    		//Log.i("Foreground dispatch", "Discovered tag with ID: " + uid);
+			            //mText.append("\r\n["+time+"] Discovered tag " + ++mCount + " with ID: " + uid);
+			            fh.writeUID(uid, time);
+			            cardID.add(uid);
+			            setBackground(0xFF00FF00, 200);
+			            playSound(this.getApplicationContext(), false);
+			    	}
+			    	else
+			    	{
+			    		setBackground(0xFFFFEE00, 1000);
+			    		playSound(this.getApplicationContext(), true);
+			    		//mText.append("\r\n["+time+"] Tag ID " + uid + " is already added.");
+			    	}
+		    	}
+		    	catch (Exception e)
+		    	{
+		    		Log.e("TagTracker", "" + e);
+		    	}
+    	}
+    }
+    
+    public void playSound(Context context, boolean twice) throws IllegalArgumentException, SecurityException, IllegalStateException, IOException {
+		final ToneGenerator tg = new ToneGenerator(AudioManager.STREAM_ALARM, 100);
+	    if(!twice)
+	    {
+	    	tg.startTone(ToneGenerator.TONE_PROP_BEEP);
+	    }
+		//audioManager.setStreamVolume(AudioManager.STREAM_ALARM, maxVolume, AudioManager.FLAG_REMOVE_SOUND_AND_VIBRATE);
+		//mMediaPlayer.setAudioStreamType(AudioManager.STREAM_ALARM);
+		//mMediaPlayer.prepare();
+		//mMediaPlayer.start();
+		
+		if(twice)
+		{
+			//tg.startTone(ToneGenerator.TONE_PROP_BEEP);
+			tg.startTone(ToneGenerator.TONE_PROP_ACK);
+		}
+		
+    }
+        
+    public static String getHexString(byte[] b) throws Exception {
+    	  String result = "";
+    	  for (int i=0; i < b.length; i++) {
+    	    result +=
+    	          Integer.toString( ( b[i] & 0xff ) + 0x100, 16).substring( 1 );
+    	  }
+    	  return result;
+    	}
+    
+    public void setBackground(int color, int time)
+    {
+    	mScreen.setBackgroundColor(color);
+    	Handler handler = new Handler(); 
+        handler.postDelayed(new Runnable() { 
+             public void run() { 
+            	mScreen.setBackgroundColor(android.R.color.white); 
+             } 
+        }, time);     	
+    }
+    @Override
+    public void onPause() {
+        super.onPause();
+        SharedPreferences preferences = getPreferences(MODE_PRIVATE);
+        SharedPreferences.Editor editor = preferences.edit();
+        editor.putBoolean("writeAllow", writeAllow); // value to store
+        editor.putString("cardID", ObjectSerializer.serialize(cardID));
+        editor.commit();
+        if (mAdapter != null) mAdapter.disableForegroundDispatch(this);
+    }
+
+    @Override
+    public boolean onCreateOptionsMenu(Menu menu) {
+        MenuInflater inflater = getMenuInflater();
+        inflater.inflate(R.menu.lo_menu, menu);
+        return true;
+    }
+    @Override
+    public boolean onOptionsItemSelected(MenuItem item) {
+        // Handle item selection
+        switch (item.getItemId()) {
+            case R.id.add_uid:
+                addUID();
+                return true;
+            case R.id.add_note:
+                addNote();
+                return true;
+            case R.id.stopsend:
+            	stopSend();
+            	return true;
+            default:
+                return super.onOptionsItemSelected(item);
+        }
+    }
+    
+    public void addUID()
+    {
+    	if(writeAllow)
+    	{
+	    	AlertDialog.Builder alert = new AlertDialog.Builder(this);                 
+	    	alert.setTitle("UID Toevoegen");  
+	
+	    	// Set an EditText view to get user input   
+	    	final EditText input = new EditText(this); 
+	    	alert.setView(input);
+
+    	    alert.setPositiveButton("Toevoegen", new DialogInterface.OnClickListener() {  
+    	    public void onClick(DialogInterface dialog, int whichButton) {  
+    	        String value = input.getText().toString();
+    	        fh.writeUID(value, DateFormat.getDateTimeInstance().format(new Date()));
+    	        return;                  
+    	       }  
+    	     });  
+
+    	    alert.setNegativeButton("Annuleren", new DialogInterface.OnClickListener() {
+
+    	        public void onClick(DialogInterface dialog, int which) {
+    	            // TODO Auto-generated method stub
+    	            return;   
+    	        }
+    	    });
+    	    alert.show();
+    	}
+    	else
+    	{
+    		AlertDialog.Builder alert = new AlertDialog.Builder(this, 4);                 
+	    	alert.setTitle("Oeps!"); 
+	    	alert.setMessage("Druk op start om een UID toe te voegen");
+	    	alert.setNeutralButton("Ok", new DialogInterface.OnClickListener() {
+				
+				public void onClick(DialogInterface dialog, int which) {
+					// TODO Auto-generated method stub
+					return;
+				}
+			});
+	    	alert.show();
+    	}
+    }
+    
+    public void addNote()
+    {
+    	if(writeAllow)
+    	{
+	    	AlertDialog.Builder alert = new AlertDialog.Builder(this);                 
+	    	alert.setTitle("Notitie Toevoegen");  
+	
+	    	// Set an EditText view to get user input   
+	    	final EditText input = new EditText(this); 
+	    	alert.setView(input);
+
+    	    alert.setPositiveButton("Toevoegen", new DialogInterface.OnClickListener() {  
+    	    public void onClick(DialogInterface dialog, int whichButton) {  
+    	        String value = input.getText().toString();
+    	        fh.writeNote(value);
+    	        return;                  
+    	       }  
+    	     });  
+
+    	    alert.setNegativeButton("Annuleren", new DialogInterface.OnClickListener() {
+
+    	        public void onClick(DialogInterface dialog, int which) {
+    	            // TODO Auto-generated method stub
+    	            return;   
+    	        }
+    	    });
+    	    alert.show();
+    	}
+    	else
+    	{
+    		AlertDialog.Builder alert = new AlertDialog.Builder(this, 4);                 
+	    	alert.setTitle("Oeps!"); 
+	    	alert.setMessage("Druk op start om een Notitie toe te voegen");
+	    	alert.setNeutralButton("Ok", new DialogInterface.OnClickListener() {
+				
+				public void onClick(DialogInterface dialog, int which) {
+					// TODO Auto-generated method stub
+					return;
+				}
+			});
+	    	alert.show();
+    	}
+    }
+    public void stopSend()
+    {
+    	writeAllow = false;
+    	ToggleButton tg = (ToggleButton) findViewById(R.id.status);
+        tg.setChecked(writeAllow);
+    	AlertDialog.Builder alert = new AlertDialog.Builder(this);                 
+    	alert.setTitle("Email Zenden");  
+
+    	// Set an EditText view to get user input   
+    	final EditText input = new EditText(this); 
+    	input.setHint("Email");
+    	input.setInputType(32);
+    	alert.setView(input);
+
+	    alert.setPositiveButton("Verder", new DialogInterface.OnClickListener() {  
+	    public void onClick(DialogInterface dialog, int whichButton) {  
+	        String value = input.getText().toString();
+	        Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); 
+	        emailIntent.setType("text/xml");
+	        emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[] 
+	        {value}); 
+	        emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, 
+	        "Tag Track from " + DateFormat.getDateTimeInstance().format(new Date())); 
+	        emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, 
+	        "XML Attached"); 
+	        File root = new File(Environment.getExternalStorageDirectory(), "TagTracker");
+		    File xmlfile = new File(root, "tags.xml");
+	        emailIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file://"+ xmlfile));
+	        startActivity(Intent.createChooser(emailIntent, "Stuur Email"));
+	        return;                  
+	       }  
+	     });  
+	    alert.show();
+    }
+    public void zenden()
+    {
+    	if(!writeAllow)
+    	{
+    		AlertDialog.Builder alert = new AlertDialog.Builder(this);                 
+        	alert.setTitle("Email Zenden");  
+
+        	// Set an EditText view to get user input   
+        	final EditText input = new EditText(this); 
+        	input.setHint("Email");
+        	input.setInputType(32);
+        	alert.setView(input);
+
+    	    alert.setPositiveButton("Verder", new DialogInterface.OnClickListener() {  
+    	    public void onClick(DialogInterface dialog, int whichButton) {  
+    	        String value = input.getText().toString();
+    	        Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); 
+    	        emailIntent.setType("text/xml");
+    	        emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[] 
+    	        {value}); 
+    	        emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, 
+    	        "Tag Track from " + DateFormat.getDateTimeInstance().format(new Date())); 
+    	        emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, 
+    	        "XML Attached"); 
+    	        File root = new File(Environment.getExternalStorageDirectory(), "TagTracker");
+    		    File xmlfile = new File(root, "tags.xml");
+    	        emailIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file://"+ xmlfile));
+    	        startActivity(Intent.createChooser(emailIntent, "Stuur Email"));
+    	        return;                  
+    	       }  
+    	     });  
+    	    alert.show();
+    	}
+    	else
+    	{
+    		AlertDialog.Builder alert = new AlertDialog.Builder(this, 4);                 
+	    	alert.setTitle("Oeps!"); 
+	    	alert.setMessage("Druk op stop om te verzenden");
+	    	alert.setNeutralButton("Ok", new DialogInterface.OnClickListener() {
+				
+				public void onClick(DialogInterface dialog, int which) {
+					// TODO Auto-generated method stub
+					return;
+				}
+			});
+	    	alert.show();
+    	}
+    }
+}
Index: trunk/TagTracker/src/nl/powercraft/tagtracker/XMLParser.java
===================================================================
--- trunk/TagTracker/src/nl/powercraft/tagtracker/XMLParser.java	(revision 6)
+++ trunk/TagTracker/src/nl/powercraft/tagtracker/XMLParser.java	(revision 6)
@@ -0,0 +1,64 @@
+package nl.powercraft.tagtracker;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.util.ArrayList;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
+
+import android.os.Environment;
+import android.util.Log;
+
+public class XMLParser {
+
+	@SuppressWarnings({ "unchecked", "rawtypes" })
+	public ArrayList init()
+	{
+		ArrayList cardID = new ArrayList();
+		File root = new File(Environment.getExternalStorageDirectory(), "TagTracker");
+	    File xmlfile = new File(root, "tags.log");
+		DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance();
+		DocumentBuilder builder = null;
+		try {
+		    builder = builderFactory.newDocumentBuilder();
+		} catch (ParserConfigurationException e) {
+		    e.printStackTrace();  
+		}
+		try {
+		    Document document = builder.parse(new FileInputStream(xmlfile));
+		    Element rootElement = document.getDocumentElement();
+		    NodeList nodes = rootElement.getChildNodes();
+		    
+		    for(int i=0; i<nodes.getLength(); i++){
+		      Node node = nodes.item(i);
+		      //Log.d("TagTracker", "[" + i + "] " + node.getNodeName());
+		      if(node instanceof Element){
+		        //a child element to process
+		        Element child = (Element) node;
+		        Log.d("TagTracker", "" + (child.getNodeName() == "tag"));
+		        if(child.getNodeName().equals("tag"))
+		        {
+		        	 Log.d("TagTracker", "Toasting...");
+		        	 String attribute = child.getAttribute("uid");
+		        	 cardID.add(attribute);
+		        }
+		      }
+		    }
+		} catch (SAXException e) {
+		    e.printStackTrace();
+		} catch (IOException e) {
+		    e.printStackTrace();
+		}
+		return cardID;	
+	}
+	
+}
