When i first implemented the feature in the app, you could take a pic, it 
would show the thumbnail within the app and once you submitted the form for 
submission, you would see and find the image in your gallery under a folder 
for the app.

Now for whatever reason, whenever i take a picture, it doesnt show up or it 
doesnt show up instantly like it use to. In some cases the only way to get 
it to show up is if i reboot the phone.

Here is what code im using which was samples found online.. (and like i 
said, worked great til recently)

Can anyone see what may be the cause?

These are the permissions i have in my manifest:
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission 
android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    <uses-permission 
android:name="android.permission.READ_EXTERNAL_STORAGE" 
android:maxSdkVersion="18" />

    private ImageButton.OnClickListener takePicture_Button_listener = new 
ImageButton.OnClickListener()
    {
        public void onClick(View v)
        {
            StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
                    .detectDiskReads()
                    .detectDiskWrites()
                    .detectNetwork()
                    .penaltyLog()
                    .build());
            // create Intent to take a picture and return control to the 
calling application
            Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);

            //User fileUri for full path to image taken.
            fileUri = getOutputMediaFileUri(MEDIA_TYPE_IMAGE); // create a 
file to save the image
            fname = 
fileUri.toString().substring(fileUri.toString().lastIndexOf("/")+1);
            intent.putExtra(MediaStore.EXTRA_OUTPUT, fileUri); // set the 
image file name

            // start the image capture Intent
            startActivityForResult(intent, 
CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE);
        }
    };

    /** Create a file Uri for saving an image or video */
    private static Uri getOutputMediaFileUri(int type){
        return Uri.fromFile(getOutputMediaFile(type));
    }

    /** Create a File for saving an image or video */
    private static File getOutputMediaFile(int type){
        // To be safe, you should check that the SDCard is mounted
        // using Environment.getExternalStorageState() before doing this.

        File mediaStorageDir = new 
File(Environment.getExternalStoragePublicDirectory(
                Environment.DIRECTORY_PICTURES), "InventoryImagesApp");
        // This location works best if you want the created images to be 
shared
        // between applications and persist after your app has been 
uninstalled.

        // Create the storage directory if it does not exist
        if (! mediaStorageDir.exists()){
            if (! mediaStorageDir.mkdirs()){
                Log.d("InventoryImagesApp", "failed to create directory");
                return null;
            }
        }
        // Create a media file name
        String timeStamp = new 
SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
        File mediaFile;
        if (type == MEDIA_TYPE_IMAGE)
        {
            mediaFile = new File(mediaStorageDir.getPath() + File.separator 
+
                    "IMG_"+ timeStamp + ".jpg");
        }
        else
        {
            return null;
        }

        return mediaFile;
    }

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to