LoginSignup
7
7

More than 5 years have passed since last update.

com.android.internal.RのリソースIDの取り方

Posted at

忘れがちなのでメモ

// com.android.internal.R.string.hogeのリソースIDを取得
int resId = Resources.getSystem().gerIdentifier("hoge", "string", "android");

ちなみに一般アプリのリソースの取り方は

// com.example.sampleアプリのR.string.hogeのリソースIDを取得
int resId = context.getResources().gerIdentifier("hoge", "string", "com.example.sample");

こっちの場合はContextが必要

7
7
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
7