-3

Code to remove error in android studio

Code to remove error in android studio

Rohit5k2
  • 17,948
  • 8
  • 45
  • 57
jk multi
  • 61
  • 2
  • 7

1 Answers1

2

By your photo, you are using the wrong method.

You should place assignmenttitle.docx to /res/raw should not to /assets.

Since the file is within your application, you shouldn't use "file:///android_asset/assignmenttitle.docx".

This means the file path to Android Device storage, not the application's resource.

Instead, you should use like this!

Uri uri= Uri.parse(ContentResolver.SCHEME_ANDROID_RESOURCE + "://" + context.getPackageName() +
                    "/raw/assignmenttitle.docx");

or

InputStream ins = context.get().getResources().openRawResource(R.raw.assignmenttitle.docx);
Htin Linn Zaw
  • 223
  • 2
  • 7