Answer the question
In order to leave comments, you need to log in
How to use assets/ directory instead of res/?
There is a JAR library that I need to embed into my application.
The catch is that it comes with its files in res/, and for technical reasons I can't change this directory, but I have full access to assets/.
In res/ there are various pictures of different resolutions, layouts, a font file, a sound file and just localized strings in xml.
The library was easily decompiled and found the following class inside it.
package com.purplebrain.giftiz.sdk.util;
import android.content.Context;
import android.content.res.Resources;
public class GDKId
{
public static int getId(String paramString, Context paramContext)
{
return paramContext.getResources().getIdentifier(paramString, "id", paramContext.getPackageName());
}
public static int getString(String paramString, Context paramContext)
{
return paramContext.getResources().getIdentifier(paramString, "string", paramContext.getPackageName());
}
public static int getLayout(String paramString, Context paramContext)
{
return paramContext.getResources().getIdentifier(paramString, "layout", paramContext.getPackageName());
}
public static int getAnim(String paramString, Context paramContext)
{
return paramContext.getResources().getIdentifier(paramString, "anim", paramContext.getPackageName());
}
public static int getRaw(String paramString, Context paramContext)
{
return paramContext.getResources().getIdentifier(paramString, "raw", paramContext.getPackageName());
}
public static int getDrawable(String paramString, Context paramContext)
{
return paramContext.getResources().getIdentifier(paramString, "drawable", paramContext.getPackageName());
}
}
Answer the question
In order to leave comments, you need to log in
It turns out this is impossible. But I was still able to solve my problem using apktool.
I unpack the APK, copy additional resources to res/, pack it back.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question