android- How to launch an app from your app in android - android

Im trying to launch an application from another one. Ive used the fingerpaint api demo and added a save and some different brushes and Id like the user to be prompted on saving the picture to select something like photoshop to do color correction of photomanipulation to the photo and once they are done with the photo and its saved in photoshop have the fingerpaint app reopen with the photo they just manipulated in the screen and ready for them to add more to if they chose to do so.
Will I have to set a background activity to read the photoshops state and when it saves? Thats what Im thinking I will have to do but Im not sure at this point.
Im not asking for some one to code it out for me but if any one has an idea of how or where I can see an example of an app opening another that would be awesome.
( and please do not be so vague as to say look at the android.com dev section as there is WAY to much info to look through on there. I spend half my day on there already :p )

Intents are used to launch other activities. Best way would be to save the image and get the uri for the image.
Intent i = new Intent(Intent.ACTION_EDIT, imageUri);
this.startActivity(i);
That will launch whatever activity that can handle that uri and intent type. You can also use createChooser to give the user the option to pick an Activity. (similar to have the share option works in most apps).
To do the saving recognition I'm not sure if startActivityForResult would do what you want. it depends on how the Photoshop app is setup.

Related

Android intent ACTION_VIEW with share options

I'm using an intent with ACTION_VIEW to view a photo on android, but it doesnt open with any of the options the gallery has when viewing other pictures (specifically share). Anyone know how to make it have those options?
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(location, mimeType);
intent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
gives me a viewer like this:
but just viewing in the gallery, i get all this stuff:
these issues are similar, but had no answer
Intent Action_View for image opens gallery with no delete option
Android image intent : sharing/editing options
and the interesting thing is both of those issues talk about those options ALREADY being available... so im not sure what im doing wrong.
but it doesnt open with any of the options the gallery has when viewing other pictures (specifically share)
There are ~2 billion Android devices, made up of thousands of device models. Many of those device models will ship with 1+ activities that support your Intent structure, and many of the actual devices will have other apps that support it, installed by users. None have to offer a "share" option.
Anyone know how to make it have those options?
Strictly speaking, you can't.
Those image-viewing apps were written by developers, and those developers can do whatever they want. Perhaps there are different activities for internal use vs. ACTION_VIEW. Perhaps it is the same activity, but they only offer those options when the activity is reached internally (vs. from outside apps via ACTION_VIEW). Perhaps they only share certain Uri schemes or MIME types. Perhaps they do not share images because it is Tuesday.
And, again, the behavior will be different on different devices, based on which image-viewing apps the user has and chooses to use.
If you want to have a "share" option, put it in your app. If you want that share option to be on the screen that shows the image, show the image in your app. Right now, you are delegating all of that to third-party apps, and those apps do not have to do what you want.

Find how many files/images can be shared by an app in Android

In my app, I am trying to find no. of files can be shared by an application. Like user can share only 10 images with WhatsApp. I want to know this before I could start sharing the image so that I could notify to user and avoid App launch call.
As of now, I can know only either App can handle single or multiple file share using intent action using ACTION_SEND and ACTION_SEND_MULTIPLE but don't know how many files can be shared.
Is there a way to figure this out?
Is there a way to figure this out?
No.

Android get pictures from gallery and give user the option to launch camera

I know how to launch camera and let user take a picture; I also know how to launch gallery and let user pick one of the pictures on the device; however, on the gallery launching page, the only option to user is "cancel".
I want to give user more options on that page such as, opening camera,crop, delete, etc. just like how native gallery works. Do I need to use putExtra()? If I do, how to find out what I can use with it.
I understand an option is to have a page/dialog to let user choose between two options, but it does not look so stunning.
At that point you will be messing with the receiving intent's activity. Unless it gives you that ability (I don't know of one that does), you can't do it. You have to return the image to your own activity and display a menu there.
Keep in mind that a user can have any number of galleries installed, and the user might not be looking at the image in the stock gallery app depending on their personal settings/preference.
What if you created an activity that displayed the image, then had a simple listview alertdialog show with some options? That might look clean enough.

How to set profile picture app from Android Gallery

I want a simple way where there is an ImageView representing a user profile picture. It is set to a default photo if they have not picked one.
I would like them to simply click on it and it opens up the gallery and they can set (and crop) a profile picture. That picture than is set in the ImageView (and stays there the next time the app is opened -- I am also using an Internet MySQL database to connect to that I may need to store the picture in so other users can see. I just need to see the Android side of things).
I am assuming I may need to use an Intent of some sort? Can I see basic code on how one might do this?
Here's a tutorial on using an intent with the Gallery: http://www.helloandroid.com/tutorials/gallery-intent-tutorial

Android Intent.ACTION_SEND Youtube

I want to use my application to upload videos on YouTube. I'm using this code:
uploadIntent.setDataAndType(Uri.fromFile(f), "video/quicktime");
startActivity(Intent.createChooser(uploadIntent, "Upload"));
but it also shows me options for bluetooth, gmail etc. when I want to it to display only the YouTube option. How can I display only the YouTube option?
I had misunderstood what you were asking. It seems that you have the upload working but want to restrict it to only YouTube. To achieve this, you should not use Intent.createChooser since there's no point in choosing if you only want to display one option. Instead, you can use Intent.setClassName to specify the package and class for YouTube.
You can discover the correct values by simply examining the Intents passed back in your current code when you select YouTube. You'll want to set the return value of Intent.createChooser from PackageManger.queryIntentActivites to a local variable, set a breakpoint in the line after and examine the contents of the YouTube Intent when it breaks.

Categories

Resources