Problem while using croping activity

All your problems with Audio, Video and Images.

Problem while using croping activity

Postby regisg » Sun Sep 27, 2009 9:48 pm

Hello,

I'm trying to use the android built-in activity via the intent com.android.camera.action.CROP.
Here is my code :
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2. package rg.test;
  3.  
  4.  
  5.  
  6. import java.io.File;
  7.  
  8.  
  9.  
  10. import android.app.Activity;
  11.  
  12. import android.content.Intent;
  13.  
  14. import android.net.Uri;
  15.  
  16. import android.os.Bundle;
  17.  
  18. import android.os.Environment;
  19.  
  20. import android.view.View;
  21.  
  22. import android.widget.Button;
  23.  
  24.  
  25.  
  26. public class testCrop extends Activity {
  27.  
  28.         private Button btnTest;
  29.  
  30.         private final int REQUEST_CROP_IMAGE = 44;
  31.  
  32.     /** Called when the activity is first created. */
  33.  
  34.     @Override
  35.  
  36.     public void onCreate(Bundle savedInstanceState) {
  37.  
  38.         super.onCreate(savedInstanceState);
  39.  
  40.         setContentView(R.layout.main);
  41.  
  42.         btnTest = (Button) findViewById(R.id.btnTest);
  43.  
  44.        
  45.  
  46.     btnTest.setOnClickListener(new View.OnClickListener() {
  47.  
  48.         public void onClick(View v) {
  49.  
  50.                 final File mFile = new File(Environment.getExternalStorageDirectory()+"/photo.jpg");
  51.  
  52.             final Intent intent = new Intent("com.android.camera.action.CROP");
  53.  
  54.             intent.setClassName("com.android.camera", "com.android.camera.CropImage");
  55.  
  56.             intent.setData(Uri.fromFile(mFile));
  57.  
  58.             intent.putExtra("outputX", 200);
  59.  
  60.             intent.putExtra("outputY", 200);
  61.  
  62.             intent.putExtra("aspectX", 200);
  63.  
  64.             intent.putExtra("aspectY", 200);
  65.  
  66.             intent.putExtra("scale", true);
  67.  
  68.             intent.putExtra("noFaceDetection", true);
  69.  
  70.             intent.putExtra("output", Uri.parse("file:/" + mFile.getAbsolutePath()));
  71.  
  72.  
  73.  
  74.             startActivityForResult(intent, REQUEST_CROP_IMAGE);
  75.  
  76.  
  77.  
  78.         }
  79.  
  80.     });
  81.  
  82.    
  83.  
  84.     }
  85.  
  86.    
  87.  
  88.  
  89.  
  90.     @Override
  91.  
  92.     protected void onActivityResult(int requestCode, int resultCode, Intent data) {
  93.  
  94.     }    
  95.  
  96.    
  97.  
  98. }
  99.  
  100.  
Parsed in 0.038 seconds, using GeSHi 1.0.8.4


This activity is not found...

I've found a code example in android apps :

http://code.google.com/p/apps-for-andro ... ivity.java

Does anyone knows how to fix this ? Thanks for your help !
regisg
Once Poster
Once Poster
 
Posts: 1
Joined: Sat Sep 05, 2009 8:57 am

Top

Return to Multimedia Problems

Who is online

Users browsing this forum: No registered users and 14 guests