public class ResourceUtils
extends java.lang.Object
Constructor and Description |
---|
ResourceUtils() |
Modifier and Type | Method and Description |
---|---|
static boolean |
granted(android.content.Context context,
java.lang.String permission) |
static org.json.JSONObject |
read_json(android.content.res.Resources res,
int res_id)
Returns the mapped
JSONObject of a given RawRes id whose content is json encoded. |
static java.lang.String |
read_text(android.content.res.Resources res,
int res_id)
Returns the raw string content of a given
RawRes id. |
static java.util.ArrayList<java.lang.String> |
text_to_paragraphs(android.content.res.Resources res,
int resource_id)
Interprets a given resource id as text and splits it into an array of paragraphs.
|
@Nullable public static org.json.JSONObject read_json(@NonNull android.content.res.Resources res, @RawRes int res_id)
JSONObject
of a given RawRes
id whose content is json encoded.res
- A Resources
instanceres_id
- A RawRes
id of the corresponding json file to readJSONObject
interface.@Nullable public static java.lang.String read_text(@NonNull android.content.res.Resources res, @RawRes int res_id)
RawRes
id.res
- A Resources
instanceres_id
- A RawRes
id of the corresponding json file to readRawRes
.@Nullable public static java.util.ArrayList<java.lang.String> text_to_paragraphs(@NonNull android.content.res.Resources res, @RawRes int resource_id)
res
- A Resources
instanceresource_id
- A RawRes
id for the text fileString
or null
if a problem happened.public static boolean granted(android.content.Context context, java.lang.String permission)