@@ -17,6 +17,7 @@ |
||
| 17 | 17 |
</activity> |
| 18 | 18 |
<activity |
| 19 | 19 |
android:name="com.ptplib.usbcamera.test.MyTestActivity" |
| 20 |
+ android:launchMode="singleTask" |
|
| 20 | 21 |
android:screenOrientation="portrait"> |
| 21 | 22 |
<intent-filter> |
| 22 | 23 |
<action android:name="android.intent.action.MAIN" /> |
@@ -70,19 +70,24 @@ public class MyTestActivity extends Activity {
|
||
| 70 | 70 |
} |
| 71 | 71 |
|
| 72 | 72 |
@Override |
| 73 |
- protected void onResume() {
|
|
| 74 |
- super.onResume(); |
|
| 73 |
+ protected void onStart() {
|
|
| 74 |
+ super.onStart(); |
|
| 75 | 75 |
registerUSBReceiver(); |
| 76 | 76 |
initDevice (searchDevice ()); |
| 77 | 77 |
} |
| 78 | 78 |
|
| 79 | 79 |
@Override |
| 80 |
- protected void onPause() {
|
|
| 81 |
- super.onPause(); |
|
| 80 |
+ protected void onStop() {
|
|
| 81 |
+ super.onStop(); |
|
| 82 | 82 |
unregisterReceiver(mUsbReceiver); |
| 83 | 83 |
detachDevice(); |
| 84 | 84 |
} |
| 85 | 85 |
|
| 86 |
+ @Override |
|
| 87 |
+ protected void onNewIntent(Intent intent) {
|
|
| 88 |
+ super.onNewIntent(intent); |
|
| 89 |
+ } |
|
| 90 |
+ |
|
| 86 | 91 |
BroadcastReceiver mUsbReceiver = new BroadcastReceiver() {
|
| 87 | 92 |
public void onReceive(Context context, Intent intent) {
|
| 88 | 93 |
String action = intent.getAction(); |