Last active
February 3, 2018 14:19
-
-
Save wannaphong/46d34b16501d1e3724e2d4f987bb6893 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<provider | |
android:name="android.support.v4.content.FileProvider" | |
android:authorities="${applicationId}.provider" | |
android:exported="false" | |
android:grantUriPermissions="true"> | |
<meta-data | |
android:name="android.support.FILE_PROVIDER_PATHS" | |
android:resource="@xml/provider_paths"/> | |
</provider> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void take(){ | |
storage =1; | |
Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); | |
file = new File(Environment.getExternalStorageDirectory(), | |
String.valueOf(System.currentTimeMillis()) + ".jpg"); | |
//fileUri = Uri.fromFile(file); | |
fileUri = FileProvider.getUriForFile(this, BuildConfig.APPLICATION_ID + ".provider", file); | |
takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, fileUri); | |
if (takePictureIntent.resolveActivity(getPackageManager()) != null) { | |
startActivityForResult(takePictureIntent, 1); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<paths xmlns:android="http://schemas.android.com/apk/res/android"> | |
<external-path name="external_files" path="."/> | |
</paths> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment