I have an Android module aboutscreenlibrary
, which is to implement an information activity about the app.
Module: aboutscreenlibrary
With a AboutActivity
activity that loads a menu to see what's new, which should be obtained from res/raw/changelog.txt
directories:
res/drawable
/layout
/menú
/raw/changelog.txt
credits.txt
Inside that module I have a
public class CustomDialogHTML extends DialogFragment...'
...
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
...
Uri uri = Uri.parse(getArguments().getString("uri", ""));
String fileName = uri.getHost();
...
InputStream inputStream = getResources().openRawResource(
getResources().getIdentifier(fileName,
"raw", getActivity().getApplicationContext().getPackageName()));
Project
I only call the activity of the module, in the project the res/raw/...
directory does not exist since in principle I wanted to have them inside the module.
In Debug
mode everything works correctly, that's when I change to reléase
that shows me empty.
The error I think is in
getResources().getIdentifier(fileName,"raw", getActivity().getApplicationContext().getPackageName()
since that refers to the context of the activity and not the module.
How can I refer to the resource directory of the module?