Skip to content

Instantly share code, notes, and snippets.

View asadfareed777's full-sized avatar
🎯
Focusing

asadfareed777

🎯
Focusing
View GitHub Profile
@asadfareed777
asadfareed777 / Utils
Created September 4, 2023 07:17
Add these functions in your PickerUtilicty class. It will always open system default camera no matter what camera set as default.
private void captureImageFromCamera() {
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
File path = AppFolders.getImageFilePath();
if (!path.exists()) {
path.mkdirs();
}
File file = new File(AppFolders.getRandomImageFilePath());
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
imageCaptureUri = FileProvider.getUriForFile(mContext, LWMCApplication.getInstance().getPackageName() + ".provider", getRandomFileName());
} else {
import android.app.Activity
import android.app.Fragment
import android.content.Context
import android.content.res.Resources
import android.util.Log
import android.view.View
import android.view.inputmethod.InputMethodManager
import android.widget.Toast