My question is simple, Can i start Instagram's Options activity from another app (Where you can find friends, invite friends, change password, sign out...) via intent? Something like:
Intent insta_intent = getPackageManager().getLaunchIntentForPackage("com.instagram.android");
insta_intent.setComponent(new ComponentName("com.instagram.android", "com.instagram.android.activity.UrlHandlerActivity"));
insta_intent.setData(Uri.parse("http://instagram.com/settings"));
startActivity(insta_intent);
How can i do that?
I think, it would be something like this:
Intent intent = new Intent();
intent.setComponent(new ComponentName("com.instagram",
"com.instagram.SettingsActivity"));
startActivity(intent);
Related
I have a quick click button to start activity by intent in my android application, it succeed to target activity ,but back to the desktop, I can not understand.
please guide me to resolve this.
Intent intent = new Intent(getContext(), ActivityDetailActivity.class);
startActivity(intent);
enter image description here
enter image description here
You need to call intent like this :
Intent intent = new Intent(MainActivity.this, ActivityDetailActivity.class);
startActivity(intent);
From within my app, I'd like to start the set up new email account activity of the Email App which looks like this: http://i.stack.imgur.com/BNYnj.png
I've looked at this http://source-android.frandroid.com/packages/apps/Email/AndroidManifest.xml
and tried to start the set up email activity:
Intent intent = new Intent("com.android.email.CREATE_ACCOUNT");
startActivity(intent);
But I got an exception:
E/AndroidRuntime(517): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=com.android.email.CREATE_ACCOUNT }
Anyone please help me?
Thanks so much,
John
you could try using an explicit intent. instead of
new Intent("com.android.email.CREATE_ACCOUNT")
use
new Intent(context, com.android.email.activity.setup.AccountSetupBasics.class)
you may also want to look into the whole ACTION_ADD_ACCOUNT action string. it may do what you are looking for without having to use a SPECIFIC app. for example, when an oem installs a different email app from the stock android one. if it happens there won't be anything to handle either the explicity or implicit intent.
This works for from APIs 4.0+.
Intent intent = new Intent("com.android.email.CREATE_ACCOUNT");
intent.putExtra("FLOW_MODE", 0);
startActivity(intent);
Below works for from APIs 2.1+. Maybe also work for lower versions (not tested).
Intent intent = new Intent();
intent.setClassName("com.android.email", "com.android.email.activity.setup.AccountSetupBasics");
intent.putExtra("FLOW_MODE", 0);
startActivity(intent);
I am creating an application where I need to call another application that is already installed in the device on button click.
I have done some research on it and I understand that I will need to call an intent for the same. What I dont understand is I do not have a class name for the application I want to call. For example, if I want to call the device's gallery from my application on button click, how do I do that?
Uri uri = Uri.parse("file:///sdcard/");
Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
intent.setData(uri);
intent.setType("application/pdf");
startActivity(intent);
return true;
Thanks guys. I have tried this code but it said document could not be opened.
You will need to call Implicit Intents
From the documentation:
Implicit Intents have not specified a component; instead, they must
include enough information for the system to determine which of the
available components is best to run for that intent.
These intents can be triggered providing any action, type or category information
For example you want to open browser Activity and you don't know the Activity class name you will use something like this:
Intent in = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.google.com"));
startActivity(in);
Another example: you don't know the Gallery Activity class, you will call it using Implicit Intent like this:
Intent intent = new Intent();
intent.setType("image/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(intent,"Select Picture"), SELECT_PICTURE);
Here the call
Enjoy coding....
Intent res = new Intent();
String mPackage = "com.ReachOut";
String mClass = ".splash1";
res.setComponent(new ComponentName(mPackage,mPackage+mClass));
startActivity(res);
If the exact application is less important, and you just need something that will display your content, you can omit the component name entirely, too. Just set the action, data, and (optionally) type on the intent and let the OS do the work.
Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
intent.setData(/*your data uri*/);
intent.setType(/*your data's MIME type*/);
startActivity(intent);
This intent will be handled by some app that has registered for intents with the view action and the appropriate MIME type. This is an implicit intent, like Adil mentioned.
I want to direct the user from one app the user is currently running, to the market, to download another app.
The link to the market is: market://search?q=pname:your.package.name
use this in your code:
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("market://details?id=com.android.example"));
startActivity(intent);
from: http://developer.android.com/guide/publishing/publishing.html#marketintent
Yes. Try this:
Intent intent = new Intent(Intent.ACTION_VIEW,
Uri.parse("https://market.android.com/details?id=com.hg.cyberlords"));
c.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
c.startActivity(intent);
This will open the market app with "Cyberlords" app.
Is it possible to open up the default Android Messaging activity from inside an activity you write yourself? Like for example: I press a "Mail" button inside my program, and it opens the Android Messaging app just like as if I was to press the Messaging icon on the main screen.
I did something similar to this with the Contacts activity, but only the contact list comes up, no extra functionality like Adding/Modifying/Deleting, etc.
Any ideas?
edit: I found this way to open the "Compose New Message" Activity, I just need to back it up a step. Does anyone know the correct MIME type instead of this one?
Intent sendIntent = new Intent(Intent.ACTION_VIEW);
sendIntent.setType("vnd.android-dir/mms-sms");
m_activity.startActivity(sendIntent);
This starts the messaging app from another app:
Intent intent = new Intent("android.intent.action.MAIN");
intent.setComponent(new ComponentName("com.android.mms","com.android.mms.ui.ConversationList"));
startActivity(intent);
Just put it inside a button listener or whatever user input you want to open it from.
Enjoy :-)
If you want to open the messaging app to view messages and not for sending a message, this should do the job:
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.addCategory(Intent.CATEGORY_LAUNCHER);
intent.setPackage("com.google.android.apps.messaging");
startActivity(intent);