how to attach your contact with bluetooth,like:
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setClassName("com.android.bluetooth",
"com.android.bluetooth.opp.BluetoothOppLauncherActivity");
intent.putExtra(Intent.EXTRA_STREAM, Uri.parse("
file:///sdcard/caixin.png")); // imageUri set previously
intent.setType("image/png");
startActivity(intent);
but i don't konw the contract path,so how can i get??
2011/4/9, Ian Menzies <[email protected]>:
> Hey guys,
>
> I have a program that successfully accesses a gallery, allows a user
> to select a picture from that gallery, and display that pic to the
> user. I have tried to add a facedetector into this program but some
> issues have arised, the picture is still displayed to the user but
> when I try to use canvas to draw an image around a face within a
> picture it doesnt and the picture is shown without any square. Im not
> sure whether its an issue with Identifying the face or drawing a
> square around the face. Any help would be really appreciated. Thanks
> for your time.
>
> The code is as follows
>
> [code]
>
>
>
> public class Activity3 extends Activity {
>
> private static final int ACTIVITY_SELECT_IMAGE = 1;
> private static final int GALLERY_ID = Menu.FIRST + 1;
> public String mCurrentImagePath = null;
> public int imageWidth, imageHeight;
> public int numberOfFace = 5;
> public FaceDetector myFaceDetect;
> public FaceDetector.Face[] myFace;
> float myEyesDistance;
> int numberOfFaceDetected;
> Bitmap bitmap;
> public Canvas canvas;
>
>
>
> private ImageView mImageView;
>
>
>
> /** Called when the activity is first created. */
> @Override
> public void onCreate(Bundle savedInstanceState) {
> super.onCreate(savedInstanceState);
> mImageView = new ImageView(this);
> setContentView(mImageView);
>
>
> }
>
> // the canvas is below
>
>
> public void onDraw(Canvas c) {
> // TODO Auto-generated method stub
>
> canvas.drawBitmap(bitmap, 0, 0, null);
>
> Paint myPaint = new Paint();
> myPaint.setColor(Color.GREEN);
> myPaint.setStyle(Paint.Style.STROKE);
> myPaint.setStrokeWidth(3);
>
> for(int i=0; i < numberOfFaceDetected; i++)
> {
> Face face = myFace[i];
> PointF myMidPoint = new PointF();
> face.getMidPoint(myMidPoint);
> myEyesDistance = face.eyesDistance();
> c.drawRect(
> (int)(myMidPoint.x - myEyesDistance),
> (int)(myMidPoint.y - myEyesDistance),
> (int)(myMidPoint.x + myEyesDistance),
> (int)(myMidPoint.y + myEyesDistance),
> myPaint);
>
> }
> }
>
>
> //adds a menu
>
> @Override
> public boolean onCreateOptionsMenu(Menu menu) {
> super.onCreateOptionsMenu(menu);
>
> menu.add(0, GALLERY_ID, 0, "Gallery");
> return true;
> }
>
>
>
>
> //if gallery is chosen begin activity and allow user to select a
> pic from the gallery
>
> @Override
> public boolean onMenuItemSelected(int featureId, MenuItem item) {
> switch (item.getItemId()) {
>
> case GALLERY_ID:
> Intent galleryIntent = new Intent(Intent.ACTION_PICK,
> Images.Media.INTERNAL_CONTENT_URI);
> startActivityForResult(galleryIntent, ACTIVITY_SELECT_IMAGE);
> return true;
> }
>
> return super.onMenuItemSelected(featureId, item);
> }
>
>
> //when the user has selected an image and no error has been occurred
> retrieve the image detect faces within the image and display the
> image.
>
> @Override
> public void onActivityResult(int requestCode, int resultCode, Intent
> data) {
>
> if (requestCode == ACTIVITY_SELECT_IMAGE && resultCode == RESULT_OK)
> {
> try {
>
> Uri currImageURI = data.getData();
> String[] proj = { Images.Media.DATA,
> Images.Media.ORIENTATION };
> Cursor cursor = managedQuery(currImageURI, proj, null,
> null,null);
> int columnIndex = cursor.getColumnIndex(proj[0]);
> cursor.moveToFirst();
> mCurrentImagePath = cursor.getString(columnIndex);
>
>
> BitmapFactory.Options BitmapFactoryOptionsbfo = new
> BitmapFactory.Options();
> BitmapFactoryOptionsbfo.inPreferredConfig =
> Bitmap.Config.RGB_565;
>
>
> bitmap = BitmapFactory.decodeFile(mCurrentImagePath);
> int width = bitmap.getWidth();
> int height = bitmap.getHeight();
>
>
> myFace = new FaceDetector.Face[numberOfFace];
> myFaceDetect = new FaceDetector(width, height,
> numberOfFace);
> numberOfFaceDetected = myFaceDetect.findFaces(bitmap,
> myFace);
> canvas= new Canvas();
>
> mImageView.setImageBitmap(bitmap);
>
>
>
>
>
> }
>
> catch (Exception e) {
> }
>
> }
>
> }
>
> }
> [/code]
>
>
>
>
>
>
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> 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 post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en