Advertisement
Guest User

Untitled

a guest
Nov 27th, 2014
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.98 KB | None | 0 0
  1. <shape xmlns:android="http://schemas.android.com/apk/res/android"
  2. android:shape="oval" >
  3. <gradient
  4. android:angle="90"
  5. android:endColor="#f58383"
  6. android:startColor="#ee6464" />
  7. <stroke
  8. android:width="1dp"
  9. android:color="#a13939" />
  10. </shape>
  11.  
  12. <dimen name="activity_horizontal_margin">100dp</dimen>
  13. <dimen name="activity_vertical_margin">100dp</dimen>
  14. <dimen name="map_dot_marker_size">50dp</dimen>
  15.  
  16. public void onActivityResult(int requestCode, int resultCode, Intent data) {
  17. super.onActivityResult(requestCode, resultCode, data);
  18. switch (requestCode) {
  19. case TAKE_PICTURE:
  20. if (resultCode == Activity.RESULT_OK) {
  21. Uri selectedImage = imageUri;
  22. getContentResolver().notifyChange(selectedImage, null);
  23. ContentResolver cr = getContentResolver();
  24. Bitmap bitmap;
  25. try {
  26. bitmap = android.provider.MediaStore.Images.Media
  27. .getBitmap(cr, selectedImage);
  28. int px = getResources().getDimensionPixelSize(R.dimen.map_dot_marker_size);
  29. bitmap = Bitmap.createBitmap(px, px, Bitmap.Config.ARGB_8888);
  30. Canvas canvas = new Canvas(bitmap);
  31. canvas.drawBitmap(bitmap, px, px, null);
  32. Drawable shape = getResources().getDrawable(R.drawable.map_dot_red);
  33. shape.setBounds(px, px, bitmap.getWidth(), bitmap.getHeight());
  34. shape.draw(canvas);
  35. final MarkerOptions markerOptions = new MarkerOptions()
  36. .position(point)
  37. .icon(BitmapDescriptorFactory.fromBitmap(bitmap));
  38. googleMap.addMarker(markerOptions);
  39.  
  40. Toast.makeText(this, selectedImage.toString(),
  41. Toast.LENGTH_LONG).show();
  42. } catch (Exception e) {
  43. Toast.makeText(this, "Failed to load", Toast.LENGTH_SHORT)
  44. .show();
  45. Log.e("Camera", e.toString());
  46. }
  47. }
  48. }
  49. }
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement