Skip to content

Commit 9b93001

Browse files
committed
use MediaScannerConnection istead of sendBroadcast
1 parent d87ce32 commit 9b93001

4 files changed

Lines changed: 22 additions & 25 deletions

File tree

.idea/libraries/protocol_1_0_4.xml

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/libraries/sentry_0_1_4.xml

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

fooCam/fooCam-fooCam.iml

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -70,28 +70,8 @@
7070
<orderEntry type="jdk" jdkName="Android API 18 Platform" jdkType="Android SDK" />
7171
<orderEntry type="sourceFolder" forTests="false" />
7272
<orderEntry type="library" exported="" name="support-v4-18.0.0" level="project" />
73-
<orderEntry type="module-library">
74-
<library>
75-
<CLASSES>
76-
<root url="jar://$MODULE_DIR$/lib/protocol-1.0.4.jar!/" />
77-
</CLASSES>
78-
<JAVADOC />
79-
<SOURCES>
80-
<root url="jar://$MODULE_DIR$/lib/protocol-1.0.4.jar!/" />
81-
</SOURCES>
82-
</library>
83-
</orderEntry>
84-
<orderEntry type="module-library">
85-
<library>
86-
<CLASSES>
87-
<root url="jar://$MODULE_DIR$/lib/sentry-0.1.4.jar!/" />
88-
</CLASSES>
89-
<JAVADOC />
90-
<SOURCES>
91-
<root url="jar://$MODULE_DIR$/lib/sentry-0.1.4.jar!/" />
92-
</SOURCES>
93-
</library>
94-
</orderEntry>
73+
<orderEntry type="library" exported="" name="sentry-0.1.4" level="project" />
74+
<orderEntry type="library" exported="" name="protocol-1.0.4" level="project" />
9575
</component>
9676
</module>
9777

fooCam/src/main/java/net/phunehehe/foocam/MainActivity.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
package net.phunehehe.foocam;
22

33
import android.app.Activity;
4-
import android.content.Intent;
54
import android.hardware.Camera;
65
import android.hardware.Camera.PictureCallback;
7-
import android.net.Uri;
6+
import android.media.MediaScannerConnection;
87
import android.os.Bundle;
98
import android.os.Environment;
109
import android.view.Display;
@@ -145,7 +144,7 @@ public void onPictureTaken(byte[] data, Camera camera) {
145144
FileOutputStream fos = new FileOutputStream(pictureFile);
146145
fos.write(data);
147146
fos.close();
148-
sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED, Uri.fromFile(pictureFile)));
147+
MediaScannerConnection.scanFile(this, new String[]{pictureFile.toString()}, null, null);
149148
} catch (IOException e) {
150149
Toast.makeText(this, e.getMessage(), Toast.LENGTH_SHORT).show();
151150
}

0 commit comments

Comments
 (0)