Why can't I use Resources.getSystem() without a Runtime error?

后端 未结 3 1227
孤城傲影
孤城傲影 2020-11-29 12:29
public class BobDatabase extends SQLiteOpenHelper{
private static final String DATABASE_NAME = \"bob.db\";
private static final int DATABASE_VERSION = 1;
public stat         


        
3条回答
  •  时光说笑
    2020-11-29 13:02

    According to Android documentation, Resources.getSystem() only provides system-level resources, not application-level ones (like the resources inside your strings.xml file).

    http://developer.android.com/reference/android/content/res/Resources.html#getSystem()

    Try using the application's context if you really want to retrieve your strings this way, or take my suggestion in the comment to your question.

提交回复
热议问题