I'm running a TabActivity
. In the following line:
spec = tabHost.newTabSpec("alltime").setIndicator(R.string.plots_allTime)
.setContent(intent);
I get an error because setIndicator()
expects a CharSequence
. I'm not really sure how to fix this, because I should be able to pass a string into that parameter. I think the issue lies in the fact that the generated R.java
initializes everything in the strings.xml
file as public static final int
. The setIndicator() method doesn't seem to like that too much. Is there any way around this?
spec = tabHost.newTabSpec("alltime").setIndicator(getString(R.string.plots_allTime))
.setContent(intent);
You need to get a string corresponding to the ID from R.string: use context.getText, which returns a localized, styled CharSequence from the application's package's default string table:
setIndicator(context.getText(R.string.plots_allTime) )
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With