diff --git a/src/android/ui/SelectPrinterActivity.java b/src/android/ui/SelectPrinterActivity.java index 18bd7d2..e92fc1d 100644 --- a/src/android/ui/SelectPrinterActivity.java +++ b/src/android/ui/SelectPrinterActivity.java @@ -57,6 +57,12 @@ public final class SelectPrinterActivity extends Activity { public static final String EXTRA_PRINTER_ID = "INTENT_EXTRA_PRINTER_ID"; + /** + * The action of the intent. + */ + public static final String ACTION_SELECT_PRINTER = + "ACTION_SELECT_PRINTER"; + /** * Reference to the main view which lists all discovered printers. */ @@ -99,6 +105,15 @@ public final class SelectPrinterActivity extends Activity { super.onDestroy(); } + /** + * Sent intent with empty result. + */ + @Override + public void onBackPressed() { + onPrinterSelected(null); + super.onBackPressed(); + } + /** * Sends an intent with the specified printer back to the owning activity * and finishes that activity. @@ -110,6 +125,7 @@ public final class SelectPrinterActivity extends Activity { Intent intent = new Intent(); intent.putExtra(EXTRA_PRINTER_ID, printerId); + intent.setAction(ACTION_SELECT_PRINTER); setResult(RESULT_OK, intent); finish();