Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <shape xmlns:android="http://schemas.android.com/apk/res/android"
- android:shape="oval" >
- <gradient
- android:angle="90"
- android:endColor="#f58383"
- android:startColor="#ee6464" />
- <stroke
- android:width="1dp"
- android:color="#a13939" />
- </shape>
- <dimen name="activity_horizontal_margin">100dp</dimen>
- <dimen name="activity_vertical_margin">100dp</dimen>
- <dimen name="map_dot_marker_size">50dp</dimen>
- public void onActivityResult(int requestCode, int resultCode, Intent data) {
- super.onActivityResult(requestCode, resultCode, data);
- switch (requestCode) {
- case TAKE_PICTURE:
- if (resultCode == Activity.RESULT_OK) {
- Uri selectedImage = imageUri;
- getContentResolver().notifyChange(selectedImage, null);
- ContentResolver cr = getContentResolver();
- Bitmap bitmap;
- try {
- bitmap = android.provider.MediaStore.Images.Media
- .getBitmap(cr, selectedImage);
- int px = getResources().getDimensionPixelSize(R.dimen.map_dot_marker_size);
- bitmap = Bitmap.createBitmap(px, px, Bitmap.Config.ARGB_8888);
- Canvas canvas = new Canvas(bitmap);
- canvas.drawBitmap(bitmap, px, px, null);
- Drawable shape = getResources().getDrawable(R.drawable.map_dot_red);
- shape.setBounds(px, px, bitmap.getWidth(), bitmap.getHeight());
- shape.draw(canvas);
- final MarkerOptions markerOptions = new MarkerOptions()
- .position(point)
- .icon(BitmapDescriptorFactory.fromBitmap(bitmap));
- googleMap.addMarker(markerOptions);
- Toast.makeText(this, selectedImage.toString(),
- Toast.LENGTH_LONG).show();
- } catch (Exception e) {
- Toast.makeText(this, "Failed to load", Toast.LENGTH_SHORT)
- .show();
- Log.e("Camera", e.toString());
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement