Android :: Implicit Vs Explicit Intents
May 26, 2010
Working with android I realized that implicit intents are good choice in most of cases due to their's flexibility. But what's about explicit intents? What are benefits of using them? What are common cases when it's a good practice to use them?
View 1 Replies
Aug 29, 2010
Was trying to call another application using an *explicit* intent, but am finding it does not seem possible. I do not wish to use implicit intents. To test it out, try calling the YouTube main activity.
Intent i = new Intent(); ComponentName cn = new ComponentName("com.google.android.youtube","com.google.android.youtube.HomeActivity.class"); i.setComponent(cn); startActivity(i);
I get this error:
08-29 00:54:26.598: ERROR/AndroidRuntime(7332): Caused by: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.google.android.youtube/ com.google.android.youtube.HomeActivity.class}; have you declared this activity in your AndroidManifest.xml? Does anyone know whether this is possible? (using explicit intents to call another application)
View 3 Replies
View Related
Nov 7, 2009
I have some code that is creating and removing alarms, and which works great in Android 1.5 and 1.6 but breaks on the Android 2.0 AVD.The code that's giving this exception is: Code...
View 3 Replies
View Related
Oct 26, 2010
on my pim you can only set a reminder alarm as an offset from the event date/time and not as a specific date/time for the alarm itself
View 21 Replies
View Related
Mar 21, 2010
To understand the implicit intents by example.
View 2 Replies
View Related
May 21, 2009
I`m trying to develop an application, just to test the ability of android to call an activity with an intent based not in the specific class name but specifying the action, category and data information. Acording to this link
http://developer.android.com/guide/topics/intents/intents-filters.html
only three aspects are consulted when comparing an intent object to select the future activity to run. I created two android projects (and two activities), the first is the main project who sends the request and the second can be called directly or through the filter. This is the call of the activity in the main project:
CODE:..................
This is the part of the manifest that specifies (or at least I try to specify) in the secondary activity that it`s available to be selected to run with that information:
CODE:...............
I installed both separatelly and I was expecteing to see the second activity after the called but instead I got an ActivityNotFoundException. By the way if I comment the t3.addCategory (Intent.CATEGORY_HOME); line and change the t3.setAction (Intent.ACTION_EDIT); to t3.setAction(Intent.ACTION_VIEW); the browser is executed so I think the problem is in the manifest of the second activity.
View 4 Replies
View Related
Aug 19, 2010
I'm currently using this in preferences.xml: .......................
This allows to trigger a custom Activity when this specific preferences item is triggered. Copying from the documentation, I'm using an implicit intent, and it's working. But I'd solve a problem if I could use an explicit intent, that is writing the fully qualified class name of the target Activity. I didn't find documentation about this, so I don't know whether it's possible and how to do that.
View 2 Replies
View Related
Sep 30, 2009
I have some code that starts another activity based on a menu item selection:
..........
I've spent quite a bit of time on this and am inclined to file a bug report at this point. I can see a reference to the allegedly missing class in the classes.dex file inside the APK and the code works properly in the emulator. I haven't been able to find anything like this, so if there is, an RTFM pointer will be humbly accepted.
View 4 Replies
View Related
Aug 20, 2010
I was trying to open an Activity of an other applicatoin by using an implicit Intent. It doesn't work, I thought it is possible to start an Activity of an other Application by using implicit Intent. Or do I missunderstand it?
I added following intent-filter to the AndroidManifest of Application A:
CODE:..............
And called the Intent in Application B by using folloing code:
CODE:.............
All I get ist, the error message that Application A was stoped unexpectedly.
View 5 Replies
View Related
Mar 5, 2010
I am trying to launch an activity by specifying only its action(custom) defined in its intent filter from an activity in other application. The activity to be launched is the main activity of its application thus have android.intent.action.MAIN & android.intent.category.LAUNCHER set as action and category in its intent filter. Now according to android doc on Intent and Intent Filter, i do not need to specify DEFAULT category at all in this case. But doing the same i am i am unable to launch the activity.
LogCat says, Activity could not be found...
Am i misinterpreting the text or is there something else missing...?
Code, used for calling the activity
CODE:.............
Definition of Activity being called in the manifest file
COE:....................
View 1 Replies
View Related
Sep 7, 2010
I couldnt figure out the exact understanding of implicit intents.
When i was going through the tutorial i read about it.
Here are some important points to remember: 1 - Implicit Intents do not specify a target component 2 - Components willing to receive implicit intents have to declare their ability to handle a specific intent by declaring intent filters 3 - A component can declare any number of Intent Filters 4 - There can be more than one component that declares the same Intent Filters and hence can respond to the same implicit intent. In that case the user is presented both the component options and he can choose which one he wants to continue with 5- You can set priorities for the intent filters to ensure the order of responses.
I read this about Implicit Intents.
I couldnt get visualisation of 4th point. So wanted to try it out by writing some examples.
I tested this like below. Wrote two apps.
I had written two activities in one app, CallingActivity & anotherActivity.
CODE:...........
One more app,which has two activities like below.
CODE:..................
I ran the first app in emulator and pressed home screen, it mean it runs in the background.(Not exited ) Then i opened the second app and clicked a button in frirst activity(testmain) and tried to call setAction "com.android.localguide.GET_RESULT"
i.setAction("com.android.localguide.GET_RESULT");
But it is opening the activity "results".. It dint showed a options to choose which components( i expected first app ) activity i need to use ?
Am i right in executing in the right context to understand that point no 4 ?
View 3 Replies
View Related
Aug 22, 2010
The error I receive is, "android.content.ActivityNotFoundException: Unable to find explicit activity class {com.droidea.birthday/ EditBirthdayActivity}; have you declared this activity in your AndroidManifest.xml?"
The error seems simple enough, but I don't see a problem with the way I have identified this activity in my manifest file. I have also been unable to see any problems with the activity class itself..............
View 4 Replies
View Related
Aug 26, 2010
Is it possible to call the built-in Video Recorder in Android through an implicit Intent? I did some search but haven't figured out yet.
View 1 Replies
View Related
Apr 18, 2012
I am trying to activate an activity from another activity using implicit intent.
Code fragment of mail activity:
Code:
public void onClick(View view) {
intent = new Intent(Intent.ACTION_SEND);
int id = view.getId();[code].....
View 2 Replies
View Related
Mar 16, 2010
Is it possible to receive an explicit intent with the component option set? Example: Starting activity: Intent { action=android.intent.action.VIEW data=http://example.org flags=0x10000000 comp={com.android.browser/com.android.browser.BrowserActivity}}
The reason why i want to this this is because i want receive this intent above, launch another browser than the default one, and drop the intent before it starts the default browser. In another words, i want to make another browser the default one.
View 1 Replies
View Related
Mar 26, 2010
When I use a RelativeLayout with either fill_parent or wrap_content as height and an element which specifies: android:layout_alignParentBottom="true" it is ignored and it is aligned at the top. Setting the height of the RelativeLayout to an explicit value makes it work.
View 3 Replies
View Related
Mar 7, 2009
My app needs to have a intent-filter that responds to a intent that has it's component set (a explicit intent.) Here is a example.
Intent i = new Intent();
i.setClassName("com.compareeverywhere","com.compareeverywhere.ScanActivity");
startActivity(i);
Just a simple intent-filter will not do - because the intent is made for a specific component (activity,) it just launches that without looking for intents at all. Is there a way to do this?
View 1 Replies
View Related
Sep 8, 2010
implicit intent with class name as action defined in intentfilter. is not working. Only it it is defined as "android.intent.action." it is picked up ? is it so ?
I have app A with the following in manifest.xml file
CODE:.............
In app B, i tried to call the activity in A using below code.
CODE:.............
This code works. But not above line.
View 2 Replies
View Related
Oct 30, 2010
I have an IntentService that broadcasts an Intent each time if finishes some work. Each broadcast Intent is identical except that it contains a Bundle with some result information from the IntentService. Evidently, having different data in the Bundle is not enough for Android to think it's a different Intent. If the IntentService broadcasts two of these Intents back-to-back, the second one is dropped as a duplicate.
I know I've read about this behavior in this forum in the past but I can't find in the documentation where this duplicate elimination logic is described in detail. Mostly, I just want to differentiate the Intents enough that they are not considered duplicates. Any pointers would be appreciated.
View 13 Replies
View Related
Mar 9, 2010
I've a succession of 2 Intent: Intent intent = new Intent(); intent.setClass(EntryPoint.this, MainClass.class); startActivity(intent);
And I'd like an animation (which is present in res/anim) occurs during the transition between these 2 Intents...
View 2 Replies
View Related
Aug 15, 2010
I have a auto-complete textbox in which the user makes a selection. From here I want to load a tabbed layout which is based on the user selection. The problem is I cant figure out a clean way to pass that selection to each of the tabs. At the moment I can pass an intent to the 'tabhost' activity and then pass to each child activity explicitly, however this just seems like messy iterative code to me! So basically how can I pass my intent data bundles to the tabs activities cleanly & efficiently! Psuedo code is also very welcome.
View 2 Replies
View Related
Aug 7, 2010
I am trying to create intents that will be set using alarmmanager. Currently, I can do this with one intent, add extra data to it (strings, but i send them as one string with a seperator), and everything works fine and goes off at the correct time. However, when I try to send multiple intents like this, they are overwritten and only one goes off at the correct time. How can i structure my intents so that they appear different to the alarmmanager (i think they are getting deleted when filterIntent() is run).
long story short- putExtra() makes all the intents look the same still... how can i make them look different so they wont get deleted (and keep track of them in case i want to delete a specific one)
View 2 Replies
View Related
Oct 27, 2010
I want to received the Android broadcast, is there a list of all intents?
View 2 Replies
View Related
Nov 17, 2010
I have searched and searched and I just can't get this code to work. I have a main.xml layout and a setting.xml. I have some values I would like the Settings.class to change in my main apps class.Three string to be exact. I have tried this simple test code in my main app class.
settings.setOnClickListener(new OnClickListener(){
@Override
public void onClick(View v) {
Intent intent = new Intent(v.getContext(), Settings.class);
startActivityForResult(intent, 0);}});
//Then a function
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent intent){
super.onActivityResult(requestCode, resultCode, intent);
Bundle extras = intent.getExtras();
String value = extras.getString("myKey");
if(value!=null){
Log.d("hmmm",value);}}}
In my settings.class I have the following
returnHome.setOnClickListener(new OnClickListener(){
@Override
public void onClick(View v) {
Intent intent = new Intent();
intent.putExtra("myKey", "YEAH");
setResult(RESULT_OK, intent);
finish();}});
Back in main app class it is not getting logged. Like I said I have three string in the main class that I want settings class to change and send back.
View 2 Replies
View Related
Apr 6, 2010
On the market, there's an application called App Protector, which seems to effectively block the launching of configured activities until a password is correctly provided. By default, it blocks access to itself (not very interesting), Settings, and a few others. I wrote my own app to launch settings (rather than doing so through the home screen) and App Protector continued to do the job it claims to do.
When an activity that is protected is started, App Protector's password input activity is shown instead. Once the correct password is provided, the activity that was started comes to the front.
First -- does anyone know how this app is able to get between the rest of the system and the activities it protects? I would like to do something along these lines in my own application as well. Perhaps this app is receiving a broadcast about other activities coming to the foreground, and when the foreground activity is protected, it forces itself to the foreground?
Second -- does anyone know how well this technique will stand up to attack? Are there other ways to circumvent, where start Activity(...) fails to? It seems that one could use adb to un install it, thus removing its protection easily, but if I pursue my plans here, the app will be a part of a device's firmware (which, I assume, offers some protection against its apps being installed?)
View 2 Replies
View Related
Aug 10, 2010
Found similar examples--not exactly what I need. I simply need to start messaging (SMS) and email intents from my app with their "to" fields already populated. So I need to send a number with the sms intent and an email address with the email intent.
View 1 Replies
View Related
Sep 19, 2010
Developers. I am a newbie to Android but a seasoned developer in UI, Java , and ECLIPSE. I am trying to do something I believe is very simple yet I am struggling. I have two tabs, A & B. I want to put an Activity in each tab. I want to have the 'B' Activity live inside 'A' so I can access it within 'A'. 'A' has a clock and every second that passes I need to update information in 'B', even if 'A' is not currently shown. I put 'B' into the 2nd tab as follows:TabSpec mapInfo=tabs.newTabSpec("tag3"); Intent intent = new Intent(this, MathleteMapActivity.class)mapInfo.setContent(intent); mapInfo.setIndicator("Course Map");tabs.addTab(mapInfo); I am totally confused on how to get the "MathleteMapActivity" Activity from the Intent 'intent'. There appears no way to do this. Can anyone please recommend a cleaner way to do this knowing what I am trying to do?
View 4 Replies
View Related
Aug 9, 2010
I am implementing a simple app. I need to start an activity based on the state of the Activity. Lets take i am using a button to start the activity.
1. If the activity is not started, I need to start XYZ activity.
2. If the XYZ activity is on focus, then i need to close the activity on the button press.
3. If the XYZ activity is not in focus (like onPause) state then, I need to change the button state.Can you please help me in the flags that i need to use for starting the intent. Is it possible to get the state of activity before I start that activity?
View 2 Replies
View Related
Jan 8, 2010
I have two applications A and B (in different packages,but it doesn't matter).Application B is an sms application that i have made and contains one activity.This activity has a method called sendSMS(String number,String text).I want to call this method from application A and send an SMS without opening the activity(the GUI) of application B but just send an SMS in the background by calling just the method of the activity.Any ideas?
View 10 Replies
View Related
Jul 14, 2010
I have few intents in my manifest file and an AIR application. How can I instantiate AIR application from android.
View 3 Replies
View Related