<commit_before>package com.michalmazur.orphanedtexts;

import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.ActivityNotFoundException;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.provider.ContactsContract.PhoneLookup;
import android.util.Log;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import android.widget.TextView;
import android.app.AlertDialog.Builder;

public class OrphanedTextsActivity extends Activity {

	String uriString;
	Uri uri;
	private String output;
	ArrayList<Orphan> orphans;
	private static final String PREFS_NAME = "preferences";
	private static final String DATABASE_LAST_EMPTIED = "database_last_emptied";

	public OrphanedTextsActivity() {
		super();

		uriString = "content://sms/raw";
		uri = Uri.parse(uriString);
		output = "";
	}

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		RawSmsReader reader = new RawSmsReader(this.getApplicationContext());
//		reader = new RawSmsReader();

		orphans = reader.getOrphans();
		setContentView(R.layout.main);
		output = new CsvConverter().convert(orphans);
		displayOrphanList();
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		MenuInflater inflater = getMenuInflater();
		inflater.inflate(R.menu.menu, menu);
		return true;
	}

	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		switch (item.getItemId()) {
		case R.id.email:
			email();
			return true;
		case R.id.delete_all:
			deleteAll();
			return true;
		default:
			return super.onOptionsItemSelected(item);
		}
	}
<commit_msg>Fix crash on launch. (issue #8)<commit_after>package com.michalmazur.orphanedtexts;

import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.ActivityNotFoundException;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.database.Cursor;
import android.database.sqlite.SQLiteException;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.provider.ContactsContract.PhoneLookup;
import android.util.Log;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import android.widget.TextView;
import android.app.AlertDialog.Builder;

public class OrphanedTextsActivity extends Activity {

	String uriString;
	Uri uri;
	private String output;
	ArrayList<Orphan> orphans;
	private static final String PREFS_NAME = "preferences";
	private static final String DATABASE_LAST_EMPTIED = "database_last_emptied";
	private boolean isMenuEnabled = true;

	public OrphanedTextsActivity() {
		super();

		uriString = "content://sms/raw";
		uri = Uri.parse(uriString);
		output = "";
	}

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		RawSmsReader reader = new RawSmsReader(this.getApplicationContext());
//		reader = new RawSmsReader();

		try {
			orphans = reader.getOrphans();
			setContentView(R.layout.main);
			output = new CsvConverter().convert(orphans);
			displayOrphanList();
		} catch (SQLiteException e) {
			isMenuEnabled = false;
			if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
				invalidateOptionsMenu();
			}
			displayAlertDialog("Error: " + e.getMessage() + "\n\nPlease restart the app and file an issue on GitHub if the problem persists.");
		}
	}

	@Override
	public boolean onPrepareOptionsMenu(Menu m) {
		return isMenuEnabled;
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		MenuInflater inflater = getMenuInflater();
		inflater.inflate(R.menu.menu, menu);
		return true;
	}

	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		switch (item.getItemId()) {
		case R.id.email:
			email();
			return true;
		case R.id.delete_all:
			deleteAll();
			return true;
		default:
			return super.onOptionsItemSelected(item);
		}
	}

{'fraction_non_alphanumeric': 0.10396039603960396, 'fraction_numerical': 0.000225022502250225, 'mean_word_length': 5.2081005586592175, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7485823', 'n_tokens_mistral': 1462, 'n_tokens_neox': 1343, 'n_words': 310}