Sens intent with action and also when back pressed
This commit is contained in:
parent
0fb7c4530f
commit
daa7112642
@ -57,6 +57,12 @@ public final class SelectPrinterActivity extends Activity {
|
|||||||
public static final String EXTRA_PRINTER_ID =
|
public static final String EXTRA_PRINTER_ID =
|
||||||
"INTENT_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.
|
* Reference to the main view which lists all discovered printers.
|
||||||
*/
|
*/
|
||||||
@ -99,6 +105,15 @@ public final class SelectPrinterActivity extends Activity {
|
|||||||
super.onDestroy();
|
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
|
* Sends an intent with the specified printer back to the owning activity
|
||||||
* and finishes that activity.
|
* and finishes that activity.
|
||||||
@ -110,6 +125,7 @@ public final class SelectPrinterActivity extends Activity {
|
|||||||
Intent intent = new Intent();
|
Intent intent = new Intent();
|
||||||
|
|
||||||
intent.putExtra(EXTRA_PRINTER_ID, printerId);
|
intent.putExtra(EXTRA_PRINTER_ID, printerId);
|
||||||
|
intent.setAction(ACTION_SELECT_PRINTER);
|
||||||
setResult(RESULT_OK, intent);
|
setResult(RESULT_OK, intent);
|
||||||
|
|
||||||
finish();
|
finish();
|
||||||
|
Loading…
Reference in New Issue
Block a user