1. Check out our companion app, Forums for Android! Download from Google Play

Problem while using croping activity

Discussion in 'Application Development' started by regisg, Sep 29, 2009.

  1. regisg

    regisg New Member
    Thread Starter
    5

    Sep 29, 2009
    1
    0
    5
    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 !
     

    Advertisement

Share This Page

Loading...