Avoid ANFE when nothing can handle a SEND intent, like on an emulator

git-svn-id: https://zxing.googlecode.com/svn/trunk@2360 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
srowen 2012-07-23 18:14:30 +00:00
parent 4a683a8266
commit d4db46ecf6

View file

@ -19,10 +19,12 @@ package com.google.zxing.client.android.history;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.ListActivity;
import android.content.ActivityNotFoundException;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import android.view.ContextMenu;
import android.view.Menu;
import android.view.MenuInflater;
@ -38,6 +40,8 @@ import java.util.List;
public final class HistoryActivity extends ListActivity {
private static final String TAG = HistoryActivity.class.getSimpleName();
private HistoryManager historyManager;
private HistoryItemAdapter adapter;
@ -120,7 +124,11 @@ public final class HistoryActivity extends ListActivity {
intent.putExtra(Intent.EXTRA_TEXT, subject);
intent.putExtra(Intent.EXTRA_STREAM, historyFile);
intent.setType("text/csv");
startActivity(intent);
try {
startActivity(intent);
} catch (ActivityNotFoundException anfe) {
Log.w(TAG, anfe.toString());
}
}
break;
case R.id.menu_history_clear_text: