Hi all,

I want to get the string resource with R refference like R.string... but there is an issue that my class is not an activity.

deviceNameEditor.setText(settings.getString(Constants.LOCAL_DEVICE_NAME, <def_val> ));

how can I use the def value setten in the strings by using R.string indicator.

since R.string will return a int ref. to the string value I am just get lost :(

Recommended Answers

All 2 Replies

A) Provide this as parameter when calling upon this class (meaning before you call the class, you retrieve reference and then just forward it to class)
B) When calling class provide instance of activity as one of the parameters of call (this will allow you to use activity directly from simple class)

However "A" woud be more desirable approach

Hey,

thanks. I find a solution to my problem.

I sent the context to the layout drawer class ( sipmly ) and solved the issue.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.