Trying to populate tweets from strings using StatusesService


#1

Hi, I am trying to post a tweet on the click of a button, that contains both some predefined data plus some user entered data from a string. Is this possible? I am succesfully tweeting using:

“public void tweetTest(View view) {
TwitterApiClient twitterApiClient = TwitterCore.getInstance().getApiClient();
StatusesService searchService = twitterApiClient.getStatusesService();
searchService.update(“trying to build a Hashbombing android app is hard! #IDARB”, null, null, null, null, null, null, null, new Callback()” etc

but ideally I want the message to be “some text” + R.string.userData + “some text”

Is this at all doable?

Many thanks!

EDIT: I have had some success but when I post the tweet, I’m getting This is a test! 2131165252 2131165253 rather than This is a test! stringContent stringContent

Forgive me if this is a rookie error, I’m very new to android development!


#2

Hi AgentCBishop,

This is all doable, you’ll want to use the [context.getResources().getString(R.string.userData)][1] to retrieve the actual string value.

For more information about string resources in android, take a look at:
http://developer.android.com/guide/topics/resources/string-resource.html and
http://developer.android.com/guide/topics/resources/accessing-resources.html
[1]: http://developer.android.com/reference/android/content/res/Resources.html#getString(int)


#4