Android's camera doesn't go back to my app when photo has been taken

It even can't make a folder on the sdcard. When the camera takes the photo, it doesn't respond when I press the 'OK' Button. What's wrong with my code?

public static final String MACCHA_PATH = Environment.getExternalStorageDirectory().getPath() + "/Twigit";
public static final String PHOTO_PATH = MACCHA_PATH + "/camera.jpg";

public static boolean takePhoto(Activity activity) {
    Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
    File fileDir = new File(MACCHA_PATH);
    boolean isSuccessful = true;
    if (!fileDir.exists()) {
        isSuccessful = fileDir.mkdir();
    if(!isSuccessful) {
        return false;
    } else {
        File file = new File(PHOTO_PATH);
        Uri outputFileUri = Uri.fromFile(file);
        intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);
        activity.startActivityForResult(intent, TAKEPHOTO);
        return true;


do you have this? You need to override the onActivityResult. which will be called before onResume when you use startActivityForResult. The requestCode will be the code you used to start the photo taking activity. In your case it would be TAKEPHOTO..

protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (requestCode == TAKEPHOTO) {
        if (resultCode == RESULT_OK) {
            //Pic taken
        } else {
            //Pic not taken

EDIT: take a look at this link

Need Your Help

Multithreaded approach for large datasets

c# multithreading task

I have a large data set of 51 classes (51 folders/directories) each class has 10 different instances (10 sub directories per directory) and each instance has 600 views (600 files of 10 MB each per ...

Hide/Show table row(s) based on checkbox

javascript jquery jquery-selectors

I have a dynamic list of dates. I want to create a checkbox for each unique date, and then list all dates in a table row format below. The goal is when a checkbox is checked/unchecked, any rows wit...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.