I m trying to upload new pdf file to google drive in android application. but it throws null exception. it only upload image format. so please give any suggestion how to upload pdf file.
protected void onActivityResult(final int requestCode, final int resultCode,
final Intent data) {
switch (requestCode) {
case REQUEST_CODE_CAPTURE_IMAGE:
if (resultCode == Activity.RESULT_OK) {
Uri uri = data.getData();
try {
mBitmapToSave = BitmapFactory.decodeStream(
getContentResolver().openInputStream(uri));
Toast.makeText(getApplicationContext(), filenameSP, 3000).show();
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
mBitmapToSave = BitmapFactory.decodeStream(
getContentResolver().openInputStream(uri));
Here I am passing my pdf file path its throw nullPointerException
.