Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import android.content.Context;

import android.graphics.Bitmap;

import android.net.Uri;

import android.provider.MediaStore;

public class Main {
    public static Uri getUriFromBitmap(Bitmap bitmap, Context context) {
        try {
            Uri uri = Uri
                    .parse(MediaStore.Images.Media.insertImage(context.getContentResolver(), bitmap, null, null));
            return uri;
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }
}