how to post a Tweet and # some people - android

I want to post a tweet with image and text in my android app,but i want to # some other people at the same time,how should I do?
the twett result that I get just like ,that is from my publish # my friend.
my code:
StatusUpdate statu = new StatusUpdate("tweet text");
File tweetImg = getTwitterImagFile();
statu.setMedia(tweetImg);
mTwitter.updateStatus(statu);

You just need to add #[user_handle] to tweet text. If you are replying a tweet, you can set the parameter in_reply_to_status_id in the POST request.
See: https://dev.twitter.com/rest/reference/post/statuses/update

Related

How do I share Facebook contents on Android

I'm trying to share a post on my FB wall by an Android native app.
I'm following the official guide available # FBOfficial
I would know if it's possible to share a text, an image and an hashtag and also tag place or friends in the same post.
I tried to use the ShareContent class with no results.
If I use
new SharePhotoContent.Builder()...
it's not possible to add text, because the method "setQuote" is not available.
Otherwise, if I use
new ShareLinkContent.Builder()
it's not possible to add a picture.
I would also know why
setShareHashtag(new ShareHashtag.Builder())
works perfectly but
setPlaceId(String placeId)
never works, also if I add a valid placeId taken from PlaceIds
Is there a way to solve my problem?
TY in advance

Posting multiple photos in a single tweet

I want to share multiple images along with the tweet on the Twitter, but i am not able to do so. I am able to tweet single photo along with the message but not getting to append other photos in the same tweet since twitter does not allow to tweet the same message for 8-10 hours or even a day. Here is my code, what i have done to tweet the message along the photo. Can anyone please let me know where i am lacking in the code or any better way to implement the requirement.
Here is the code for tweeting:
AccessToken accessToken = new AccessToken(access_token,
access_token_secret);
Twitter twitter = new TwitterFactory(builder.build())
.getInstance(accessToken);
File f = new File(Environment.getExternalStorageDirectory()
.getAbsolutePath().toString()
+ "/xyz.png");
StatusUpdate statusUpdate = new StatusUpdate(status);
statusUpdate.setMedia(f);
twitter.updateStatus(statusUpdate);
Thanks in advance
After doing lot of R & D, i came to know that we can not post more than one image in a single tweet, and also Twitter does not allow same message to be twitted in short span of time. You can post it after several hours(may be around 7-8 hours), since it gives "Duplicate message error". So i called the function which helped posting tweet with the media file by taking one counter variable and checking with the list of images i had. So at the end i was able to post three different tweets as there were three images in my list.
And ya, you can check in this link in which you will come to know the number of images you can post in a single tweet

construct predefined messages with properties to post on Facebook android

I want to post a pre-defined message on Facebook through my android application. I got everything to work except the 'properties' field. I want to post a message where it says:
More information: here
and when the user clicks on 'here', it should link to the page.
This is what I did:
Bundle params = new Bundle();
String s2 = "{'More information':{'text':'here', 'href':" + details + "}}";
params.putString("properties", s2);
where 'details' is the link to the page.
But it seems like facebook is not picking up this line. I successfully set up the caption, picture and other fields.
Any insights? Thanks!
This is by design, as far as I know, we do not support HTML in status updates. We will automatically create a link if you post a valid URL however, so I would suggest just pasting out the full link
".....More information: (www.yourURLhere.com)"
On Facebook, www.yourURLhere.com will be a clickable link.

send email with image in android

I want email with image which is fatch from drowable in android I show bellow given link but same problem arise:
How to add an image in email body
and if I put
email.putExtra(Intent.EXTRA_TEXT,Html.fromHtml("<b>content</b>"+"<img src=\"data:"+getResources().getDrawable(R.drawable.smile)+";base64,#IMAGEDATA#\"‌​>")
and save it it give the Error:
Save Could not be completed
some character can not be mapped using "Cp1252" Character encodding.
please give me the solution, I want send image with mail.
Try this it will really help you:
mail.putExtra(Intent.EXTRA_SUBJECT, subject.toString());
mail.putExtra(Intent.EXTRA_STREAM, Uri.parse("file:"+ file));

Android - Facebook wall post parameters

I am posting to a user's wall on Facebook. How can I add a link to the post next to the like and comment links, as seen on the illustration below. What is the parameter name I should include in my request?
This is what I eventually did:
The link besides the like and comment is called "actions". To add it, you need to create an array of actions (actually, as I understand only one action is supported). For example:
JSONObject actions = new JSONObject();
actions.put("name","Get Your App");
actions.put("link", "Your app URL");
parameters.putString("actions", actions.toString());
Here is list of all Post Fields.
link | The link attached to this post | Requires access_token | string containing the URL

Categories

Resources