• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Problem while using croping activity

regisg

Lurker
Sep 29, 2009
1
0
Hello,

I'm trying to use the android built-in activity via the intent com.android.camera.action.CROP.
Here is my code :

package rg.test;

import java.io.File;

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.view.View;
import android.widget.Button;

public class testCrop extends Activity {
private Button btnTest;
private final int REQUEST_CROP_IMAGE = 44;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
btnTest = (Button) findViewById(R.id.btnTest);

btnTest.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
final File mFile = new File(Environment.getExternalStorageDirectory()+"/photo.jpg");
final Intent intent = new Intent("com.android.camera.action.CROP");
intent.setClassName("com.android.camera", "com.android.camera.CropImage");
intent.setData(Uri.fromFile(mFile));
intent.putExtra("outputX", 200);
intent.putExtra("outputY", 200);
intent.putExtra("aspectX", 200);
intent.putExtra("aspectY", 200);
intent.putExtra("scale", true);
intent.putExtra("noFaceDetection", true);
intent.putExtra("output", Uri.parse("file:/" + mFile.getAbsolutePath()));

startActivityForResult(intent, REQUEST_CROP_IMAGE);

}
});

}


@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
...
}

}



This activity is not found...

I've found a code example in android apps :

ViewPhotoActivity.java - apps-for-android - Project Hosting on Google Code

Does anyone knows how to fix this ? Thanks for your help !
 

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones