Guys i need help i aam facing a very strange problem and I would like to hear your opinion i added a share button to share images.
I used
Intent intent = new Intent ();
intent.setType("image/png");
intent.putExtra(Intent.EXTRA_STREAM, imageUri);
startActivity (Intent.createChooser (intent,"Share Using...."));
and it is working perfectly except for one thing if i choose the picture to share then pressed the share button and choose to share via whatsapp or G+ the application loads and the post is created with the chosen image if i backpressed i go back to my app then if i try to share another image and choose whatsapp or g+ both keep showing the old image in the new post and here comes the strange part if i post or send the image the new image is sent to the receipent and not the old image shown in the post. .... any help would be appreciated by the way i have tried using all flags with the intent but the problem persists
You need to pass a new Intent every time you want to post a new value, or clear the current object for that matter.
Can you also elaborate on this one, i didn't quite get what you meant:
if i try to share any other image whatsapp and g+ keep showing the old image in the new post and here comes the strange part if i post or send the image the new image is sent to the receipent
Related
while sharing image via android share intent hangout shows old image inside image preview screen which appears before sending image,but whatsapp and facebook shows cuurently selected image itself,
even it shows wrong image in preview ater clicking send, in chat correct image will only be displayed.
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("image/png");
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
intent.putExtra(Intent.EXTRA_STREAM, uri);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
startActivity(Intent.createChooser(intent, "Share news via.."));
can any one help with this issue
I found reason behind this issue, i was giving same name everytime to store and share the image, by defalut hangout image send preview screen will display old image , if image name is same. so changing image name everytime will fix the issue.
I'm going to develop a simple app to list .jpg files and after a click call an Intent.ACTION_VIEW, below the code:
File imageFile = new File(filename);
Intent i = new Intent();
i.setAction(android.content.Intent.ACTION_VIEW);
i.setDataAndType(Uri.fromFile(imageFile), "image/jpeg");
startActivity(i);
The intent works properly, in fact in app I receive the message to select an app to show the selected image. But I noticed that after the choice, for example with Google Photos, not all function are enabled. For example the share function is not visible, has someone already noticed this behavior?
Some other details; if I choose Google Photos I only have the "Info" and "Guide and Feedback" options. If I choose gallery app (I have a Samsung Ace 3) I have only "Info" and "Set as wallpaper" options.
Note: if I open the same image directly from Google Photos all functions are enabled...
The ACTION_VIEW intent calls another application to view the content that you present, in your case a JPEG image. If there is more than on application that can handle that Intent, Android lets the user choose an app to display the image. Once the application receives the Intent, it is up to that application to display the content how it sees fit.
Basically, you have no control over what functions are available with Intent.ACTION_VIEW. If you want more control, you can create your own Activity in which you can view the image and provide whatever functions you would like.
In my android app i want to share a Link to my website using intent but i dont want it to be visible to other user
example i want to share "smoe website link"
But to user it should look like "Click me to see it".
I tried this but wasnt successfull it just shows the simple text and was not clickable
<string name="app_link">Click me!</string>
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra("PostID", postID);
intent.putExtra("UserID", userID);
intent.putExtra(android.content.Intent.EXTRA_TEXT,activity.getString(R.string.app_link);
activity.startActivity(Intent.createChooser(intent, "Share"));
Any help will be really appreciated.
What you want is not realistically possible right now.
EXTRA_TEXT must always be interpreted as plain text by the receiving app. You could try using EXTRA_HTML_TEXT which was added with API 16. But many apps don't support HTML and will simply use EXTRA_TEXT instead (or not show any text at all if you omit EXTRA_TEXT).
So far I've been able to send an image as an attachment but I would like to make it part of the email's body. I know in iOS it is possible to simply pass a link to the image in an but this does not seem to work in Android. I tried using this:
intent.putExtra(Intent.EXTRA_TEXT, Html.fromHtml(removeImgTags("<img.../>"));
But this only appends an object that is however not parsed as an image. I also tried the other version of this method:
Html.fromHtml(url, new MyImageGetter(), null)
And this had the same effect. So is this even possible?
i´m trying to achieve a solution where the app ask if facebook.katana aka facebook app is installed in your android phone, if it is installed, check if the user is logged, and if it's logged send a picture with a text (better if it is to a folder), if the user is not logged go to the facebook.katana.LoginActivity and log him, after that make the procedure.
I have this working with a Web View, but i'm interested on how to do it using the app if possible, what i got so far is the uncompiled facebook.katana in this URL where i'm testing the activities:
http://xt720.ru/miui-trans/apk-decompiled/Facebook/smali/com/facebook/katana/
I also know that an image can be attached to that app, since can start the facebook app using this:
final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
emailIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
emailIntent.putExtra(Intent.EXTRA_STREAM,imageUri);
emailIntent.setType("image/png");
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Whatever");
startActivity(Intent.createChooser(emailIntent, "Send email using"));
This method would be great for an email, but as it says it creates a chooser, but i don't want to let that option open. So i tried something like:
Intent intent = new Intent("android.intent.category.LAUNCHER");
intent.setClassName("com.facebook.katana", "com.facebook.katana.LoginActivity");
startActivity(intent);
Also you can use the ShareLinkActivity to add an extra to your intent like this:
intent.putExtra(Intent.EXTRA_TEXT, "http://www.google.com/");
The problem is that i don't see how to attach the image to the katana, neither, how to add it to a folder, or how to add it through an application, of course this is much easier via facebook API for android, but like i said that's already done, i want to make it with the facebook App, i have tried, attaching the Bundle to the app as a parcelable, with the usual way it is done in the API, but not luck, this is the snippet:
Bundle params = new Bundle();
params.putByteArray("picture", bitmapdata);
params.putString("title", url);
params.putString("message","Wathever message");
and try to send the params, also tried sending only the image, but not luck, maybe i'm not using the right class (see the uncopiled facebook.katana URL) or i´m attaching in a bad way the info, it should work somehow, cause it works for ACTION_SEND, so, anybody knows how to solve any of this problems:
Attach an image to the facebook.katana
Attach an image to the facebook.katana in a folder
Attach an image to the facebook.katana as an external app
Request the log status of the user to the facebook.katana (i think this would be automatically)
Attach the picture, title, message params to the facebook.katana.
Publish as the app that opens the facebook.katana (i.e. publishin with the WebView will show "published from X app"