views:

76

answers:

0

hi. here is the problem: i have searched for an answer for this and so far i made it work for the custom camera app that comes with htc phones.

i have the folowing

 protected void onActivityResult(int requestCode, int resultCode, Intent data){

         if (requestCode == REQUEST_FROM_CAMERA && resultCode == RESULT_OK) {
                 InputStream is=null;

                 File file=mInterface.getTempFile();


                 try {
                     is=new FileInputStream(file);
                 } catch (FileNotFoundException e) {
                     e.printStackTrace();
                 }

                 if(is==null){
                     try {
                         u = data.getData();
                         is=getContentResolver().openInputStream(u);
                         mInterface.saveStringPreferences(GlobalInterface.URI_SAVENAME, u.toString());
                     } catch (FileNotFoundException e) {
                         e.printStackTrace();
                     }
                 }

                 //Now "is" stream contains the required photo, you can process it
                 setImage(is);

               }

//and this is the code to the function that calls the intent:

 Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
     // intent.putExtra(MediaStore.EXTRA_OUTPUT,Uri.fromFile(mInterface.getTempFile()));
      startActivityForResult(intent, REQUEST_FROM_CAMERA);

the remaining functions getTempFile() is to create a temp file on /sdcard/blabla.tmp and a function to set the captured image in an image view.

so the problem is that i tested this code on the custom camera on a lg phone and it crashes. the question is: is there a way to get an uri for the image location (i dont need a specific save location it could be the default set from the camera) and there were also some issues i came across which i dont need to solve like getting a smaller resolution image. i just need one image and to be able to set it in an imageView and the method to work for every camera app that is there, custom or native regardless.

is this possible or i need to create a new camera class for this? in my opinion the camera apps that come with the phone are more adjusted to the phone model so i would prefer using them against building a custom one.

tnx.