androidではstring.xml等の設定ファイルに定数を定義して
それを各モジュールで使用するのんだけど、それの取得方法が意外と面倒くさい。
通常の取得方法はこんな感じになります。
- public class SampleActivity extends Activity {
- @Override
- public void onCreate(final Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- // string.xmlから"hoge"で定義されている文字列を取得する
- final String hoge = getString(R.string.hoge);
- }
- }
- @EActivity
- public class SampleActivity extends Activity {
- // 引数を指定しない場合は、フィールド名から取得する
- @StringRes
- protected String hoge;
- // 引数を指定した場合は指定したものを取得する
- @StringRes(R.string.hello)
- protected String fuga;
- }
設定ファイルで定義しておけるものはほとんど定義できますので詳しくは、 https://github.com/excilys/androidannotations/wiki/Resourcesを参照してください。
If you need to hire a real hacker to remotely monitor / hack your partner's phone, recover your stolen bitcoin / any other cryptocurrency, or hack a database with guaranteed privacy, contact easybinarysolutions@gmail.com or whatsapp: +1 3478577580, they are efficient and confidential.
返信削除