currently I am writing a Class in Java for Android. Basically, I am using this piece of code, R.id.content
, a ton. Now, I was wondering, sense the content
part of it may change at any time, how could I write this so I would only have to change it in one place? I was thinking I could do something like the following:
public {unknown data-type} varName = R.id.content;
But then I realized that this is actually a class, so then I was wondering if I could write it like this:
public {unknown data-type} varName = content;
.... R.id.varName;
Problem is I am not exactly sure on how I would do that either. So simply, my question is, how could I write R.id.content
so I can easily change the content
part of it (like put the content
in to a variable)?