Difference Between 2 Ways To Start An Activity

I have seen the following two examples of starting activities in android:

Example 1


Example 2


It seems the obvious difference between the two examples is that you attach the logic of how an activity is created to the implementation of the activity. Are there any other key differences? (e.g. Is the calling activity told to wait until the called activity finishes in one case, but not in the other, etc. )

View Full Post With 1 Replies

Related Forum Messages:

Please Follow Index to Quick Jump to the Message.

Activity Lifecycle Difference Between Device And Emulator

I recently noticed there is a difference in behavior between an actual device (htc magic in my case) and the emulator. What i noticed is that in the device when another activity is started via startactivity(), the calling activity does not get destroyed. In the emulator, the calling activity is paused, and right after the new activity is resumed, the calling activity is destroyed.

Does anyone know if these behaviors can exist in any device or the emulator behavior is local to it? I thought the emulator is supposed to behave like an actual device since the codebase are the same? Btw, both are using adroid 1. 5.

If this topic is already present in the discussions, sorry for the duplicate and kindly point me to the right direction.

Posted On: Jun 18 . View Related Posts . . View 2 Replies .

Start An Activity At A Specified Time

I'm making an alarm clock of sorts, and i was wondering what the best way to start an activity at a certain time would be. Would it be using the broadcast service or.

Posted On: Sep 22 at 23:07 . View Related Posts . . View 1 Replies .

Activity Will Not Start After Action_screen_on Is Received

I am creating a lock replacement application which obviously requires it to have an activity that starts the action_screen_on is called.

These are the portions of my code relevant to it:


Since action_screen_on cannot be called from the manifest i registered it dynamically in my main activity.

This is in my oncreate function of my main class (lockdown)


Posted On: Jan 3 at 7:40 . View Related Posts . . View 1 Replies .

Start Activity With A Bitmap Attached

I have this code.

Which successfully launches an messaging app on android.

But how can i attach a bitmap object when launching the intent?

I have read, the closet thing to what i need is extra_stream, like this:
Intent2. Putextra(intent. Extra_stream, _uri);

But my case, i have a reference of bitmap object, not an uri of an

Please tell me what can i do to attach a bitmap object?

Posted On: Jun 25 09 at 19:57 . View Related Posts . . View 2 Replies .

Can We Start New Activity / At Least Display Toast

I tried to deploy a timer and switch the user to another dialog for setting if times out. But the dialog just cannot display. No error/exception reported. Vibration works fine though.

Posted On: Feb 6 2009 . View Related Posts . . View 2 Replies .

Force Destruction Of Old Activity And Start A New One With Parameters

I have a service that starts an activity on certain event passing to it some parameters.

The problem is if the activity is still open, when the service tries to startactivity() again, the activity isn't started because it's already started.

Is there a way to force the destruction of the old activity and start a new one with the new parameters?

Posted On: Apr 18 2009 . View Related Posts . . View 15 Replies .

Possible To Start Multiple Instances Of An Activity In Same Task

I tried using this code to start multiple activities from a parent activity code.

However, according to my log in myactivity. Oncreate(), only 1 activity was actually created. Is this behavior expected? If so, what's the proper way to launch multiple activities?

Posted On: Jul 26 at 20:00 . View Related Posts . . View 1 Replies .

Can Start New Activity Thats Not Specified Androidmanifst.xml File

I'm trying to write some dynamic code that i load a new class that's supposed to be an activity and i want to start it, but using the regular startactivity(intent) wants the activity to be "declared" in the androidmanifest.xml file.

Posted On: Jun 25 . View Related Posts . . View 4 Replies .

Can't Start Activity From A Class Extending Itemizedoverlay / Way To Do

I have a class that extends itemizedoverlay.

In it, i have code.

When i click the "details" button, i want to start an activity or setcontentview, but those methods do not exist.

Any ideas?

Posted On: Sep 16 at 13:48 . View Related Posts . . View 2 Replies .

Startactivityforresult - Return 0 Result Code After Start New Activity

I've use startactivityforresult as it described in many examples but it return 0 result code after start new activity.

In main activity i use such code for sub activity invocation


And such code for getting results.


This code should work according many examples. And it should return result_ok after btnok clicked but after i click this button it only closes showvideo activity.

Posted On: Mar 11 2009 . View Related Posts . . View 3 Replies .

Tabspec.setcontent(intent) Doesn't Appear To Work - Start New Activity Inside A Tab

I have several tabs in my application. Each of which contains an activity. One of these is a listactivity and i would like to open up another activity (in the same tab) when the user clicks on a listitem.

I have created a public static on the tabactivity which i am using to reference tabspec(s) however setcontent(intent i) just doesn't appear to be working.code.

Posted On: Aug 11 2009 . View Related Posts . . View 0 Replies .

Activity Lifecycle - Pressing Back Key Finishes Current Activity And Displays Previous Activity

""by default, pressing the back key finishes (destroys) the current activity and displays the previous activity to the user. ""

I made and run an app and pressed the back key and returned to the main menu. However, when i typed the 'ps' command in the terminal emulator the process of my app was still there. My app constists only of this activity. Shouldn't the process be killed?

Posted On: Dec 5 2009 . View Related Posts . . View 2 Replies .

Media - Are There Any Apps Or Ways Could Stream Audio

Let me first say i am an insane blackhawks fan, and i haven't missed any of the playoffs or any regular season games that were available in denver. A close friend of mine is getting married tomorrow at the exact time the puck drops, i want to find a way to at least listen to the game (ya know one ear bud discreatly in one ear) while at the wedding . Are there any apps or ways i could stream this audio?I have the mlb app that lets me listen to all the games an nhl version would be the tits. But haven't found anything

Posted On: 06-03-2010, 04:22 PM . View Related Posts . . View 19 Replies .

Htc Hero - Delete Google Contacts Both Ways

My hero did sync "all" my google contacts. Also every one i've ever sent an email to.

So, i found out i can sync only one group. Therefore i made a group for the contacts that i want on my phone.

But, how do i delete the contacts already one the phone that i don want. Without deleting them on my google contact as soon as i sync?

Posted On: 09-30-2009, 11:20 AM . View Related Posts . . View 2 Replies .

Lg Ally - Easy Ways To Get Ringtones , Apps And Websites

I have never had a problem with getting ringtones on my phone, but this new phone is really different. Can someone please let me know some easy ways to get ringtones. Apps? Websites? Ways to do it?

I use to use and then send it through a txt and save it to my phone. This ally doesn't seem to want to do that.

Posted On: 08-28-2010, 02:54 PM . View Related Posts . . View 8 Replies .

Make Table Layout To Scroll Both Ways ( Horizontally, Vertically)

I am having a table defined in xml file, which currently set to scroll vertically. But i also want it scroll horizontally as required.

Here is the code of xml in use code.

Posted On: Mar 2 at 10:35 . View Related Posts . . View 1 Replies .

Sony Ericsson Xperia X10 - Syncing Contacts - Does It Work Both Ways?

I have made a few changes to my contacts' details over the last couple of days, both online and on my phone (x10a). If i sync the contacts, will the online stuff over-ride the changes i've made in the phone, or will the phone take priority?  I'd like it to give me a choice of which changes to keep. If it uses the details i have most recently changed, that would be ideal, but i don't really want to try it until i know what will happen.

Posted On: Jun 26, 2010 12:25 PM . View Related Posts . . View 2 Replies .

Htc Hero - Mms Message Crashed My Phone / More Effective Ways To Handle It

After using my hero for a bit over a month, i've had my first run in with a serious problem. I received a mms text message, and every time i tried viewing the messages page (using the default messaging program) for that contact, i would get a force close error for Mms.

After trying a few more times, rebooting the phone, etc, i decided to try handcent sms. Fortunately, handcent did not crash when i viewed that contacts messages, but it also couldn't read the message stating something like "handcent sms is unable to read this message. " Oddly though, i was able to use the save mms option not only to see the image, but successfully save it as well. I was happy about this, but when i tried to delete the message so that i could continue to use the default messaging program (i like the widget, sorry), it could not delete the message.

The only way i could rectify the problem was by deleting the entire messaging thread with that contact.

Now, this has only happened once so far, and i have yet to try to reproduce it; nonetheless, it's a pressing issue i'd like more information on. Has anyone else had this happen? Are there any more effective ways to handle it other than deleting the entire contact thread?

Posted On: 11-10-2009, 03:33 AM . View Related Posts . . View 4 Replies .

Helix 1.0 Vs 2.o / Difference Between Them

So what is the difference between helix 1. 0 and 2. O?

Posted On: 05-07-2010, 08:04 PM . View Related Posts . . View 13 Replies .

Instrumentationtestcase Vs Activityinstrumentationtestcas­e2 - Difference Between These

Can anybody tell me the difference between these two test case?

Posted On: Dec 8 2009 . View Related Posts . . View 2 Replies .

Difference Between Invalidate() And Postinvalidate()

What is the difference between invalidate() and postinvalidate(), except the obvious (i know that postinvalidate post an invalidate- request on the ui-thread, while a call to invalidate() invalidates the view immediately). I've done a viewgroup with some scrolling- animations, and to redraw the view from computescroll(), i needed to call postinvalidate(), the regular invalidate() does not redraw the screen. This is how it's done in scrollview too, so why isn't the screen redrawn when i call invalidate() from computescroll?

Posted On: Jun 18 2009 . View Related Posts . . View 6 Replies .

Difference Between Onclicklistener And Ontouchlistener

What is difference between onclicklistener and ontouchlistener? I don't found any specific difference between them.

Posted On: Feb 21 2009 . View Related Posts . . View 4 Replies .

Difference Between U And Regular Droid

Is there any difference between u android than regular android.

Posted On: 03-04-2010, 10:52 AM . View Related Posts . . View 2 Replies .

Screen Protectors Difference

Are all screen protectors the same? I've bought a cheap screen protector off ebay, and its applied with bubbles. Should i try for quality with a premium brand or just order in quantity? 10 for £2. I don't really see what difference there is between different screen protectors.

Posted On: 2012-04-01 . View Related Posts . . View 9 Replies .

Nexus Vs One X - Camera Difference

I know the difference in mp's but has there been any good comparisons between the two cameras? The one x has some nice features but is it definitively better than the nexus's camera?

Posted On: 2012-04-21 . View Related Posts . . View 21 Replies .

Textview- Difference Between Setheight And Settextsize

What is the difference between setheight and settextsize?

Posted On: Aug 3 at 6:24 . View Related Posts . . View 2 Replies .

What's Difference Between Application And Widget

I've had my android (droid incredible) for about a month now and just starting to get into looking through good apps. I was looking at the different calendar apps because the stock app isn't that great. One thread on best calendar apps talks about pure calendar. When i go onto the android market i see a couple of widgets for pure calendar. So what's the difference between an application and a widget?

Posted On: 07-22-2010, 02:50 PM . View Related Posts . . View 3 Replies .

Is There Speed / Software Difference Between Mytouch And G1

So i been using an iphone 2g for a while, and because of the good reviews android is getting i would like to change it. Im a t-mobile customer. Which phone would you guys recommend? Is there speed/software difference between the mytouch and the g1?

Posted On: 03-05-2010, 05:16 PM . View Related Posts . . View 7 Replies .

Difference Between Managedquery() And Getcontentresolver().query()

I have read:

But i don't understand what is the difference between managedquery() and getcontentresolver(). Query()? Seems to me both take a uri and query parameters and then return a cursor.

Posted On: Feb 5 2009 . View Related Posts . . View 2 Replies .