Reputation: 83
I am trying to open twitter account from my android application by using the following code. But it fails and getting this message.
cannot get users at this time please try again later
Code
public static void openTwitterHandle(String mTwitterHandle, FragmentActivity activity) {
Intent intent = null;
try {
activity.getPackageManager().getPackageInfo("com.twitter.android", 0);
intent = new Intent(Intent.ACTION_VIEW, Uri.parse("twitter://user?user_id=" + mTwitterHandle));
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
} catch (Exception e) {
intent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://twitter.com/" + mTwitterHandle));
}
activity.startActivity(intent);
}
Upvotes: 3
Views: 1393
Reputation: 6426
Try to use this (change user_id
to screen_name
):
"twitter://user?screen_name=" + mTwitterHandle
Upvotes: 3