[android-developers] Re: Activity question

2011-07-29 Thread b_t
Now I don't use any flags just call startActivity. I don't know which
flag should I use to get the expected result.


On Jul 29, 9:18 pm, TreKing treking...@gmail.com wrote:
 On Fri, Jul 29, 2011 at 2:13 PM, b_t bartata...@gmail.com wrote:
  I have an app A and an app B. B has an activity called C.

  C can be displayed in two ways:

  - launch B which displays C
  - launch A and from A I start activity C

 How are you launching Activity C that belongs to App B from App A?

 --- 
 --
 TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago
 transit tracking app for Android-powered devices

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Re: Activity question

2011-07-29 Thread TreKing
On Sat, Jul 30, 2011 at 12:44 AM, b_t bartata...@gmail.com wrote:

 Now I don't use any flags just call startActivity.


You are doing much more than that or you're not explaining the problem
correctly. There is no way you're associating an Activity that lives in one
App with another separate App just by default.

-
TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago
transit tracking app for Android-powered devices

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Re: Activity Question

2008-08-27 Thread Gil

webmonkey: I confirm the behavior you are describing. If the
application is started from Eclipse it behaves the way I described
above. Once I start it from the Home screen the problem goes away.

Justin: Given what webmonkey stated I removed all the launch flags
from all the activities in the manifest file. The behavior seems
correct now if I start the app from the Home screen but not if I
launch the app from Eclipse. I added the intent-filter you recommended
but that did not help the situation so for now I took it back out.
Also, I was not trying to optimize anything when I was experimenting
with the launch flags, I was just trying to obtain the correct
behavior; now I know that the launch flags do not help in this case.

Thanks to both of you!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Activity Question

2008-08-27 Thread hackbod

On Aug 27, 1:37 pm, Gil [EMAIL PROTECTED] wrote:
 Justin: Given what webmonkey stated I removed all the launch flags
 from all the activities in the manifest file. The behavior seems
 correct now if I start the app from the Home screen but not if I
 launch the app from Eclipse.

The behavior in Eclipse is correct.  Each time you run from Eclipse,
you are uninstalling and reinstalling the app, so it will be started
completely fresh.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Activity Question

2008-08-27 Thread webmonkey

 The behavior in Eclipse is correct.  Each time you run from Eclipse,
 you are uninstalling and reinstalling the app, so it will be started
 completely fresh.

True, and I wouldn't expect Eclipse to go back to where you left. But
the fact still is that in this freshly started app the problem above
arises unless you use the steps described above.

On Aug 27, 11:00 pm, hackbod [EMAIL PROTECTED] wrote:
 On Aug 27, 1:37 pm, Gil [EMAIL PROTECTED] wrote:

  Justin: Given what webmonkey stated I removed all the launch flags
  from all the activities in the manifest file. The behavior seems
  correct now if I start the app from the Home screen but not if I
  launch the app from Eclipse.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Activity Question

2008-08-27 Thread Gil

Thanks hackbod, I understand that the app is uninstalled and then
reinstalled when started from Eclipse. I guess what I did not
understand is that when you launch the app from Eclipse the behavior
is different (as outlined in the sequence of steps to reproduce the
problem I posted earlier) than when you start the app from the Home
screen. Now I know.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Activity Question

2008-08-25 Thread Gil

Hi Justin,

Any update related to this issue?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Activity Question

2008-08-25 Thread Justin (Google Employee)

No, I would have provided one if there was, :-) . But if your question
is if its still be looked at, the answer is yes.

Cheers,
Justin
Android Team @ Google

On Aug 25, 5:46 pm, Gil [EMAIL PROTECTED] wrote:
 Hi Justin,

 Any update related to this issue?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Activity Question

2008-08-22 Thread Gil

hackbod,

I wrote a simple app, based on the SDK Forwarding example, which
reproduces the problem. The only difference between my app and the
Forwarding app, as far as I can tell, is that the manifest:

?xml version=1.0 encoding=utf-8?
manifest xmlns:android=http://schemas.android.com/apk/res/android;
package=com.multiplefacets.test
application android:icon=@drawable/icon android:label=@string/
app_name
activity android:name=.ActivityA android:label=Activity A
android:launchMode=singleTask
intent-filter
action android:name=android.intent.action.MAIN /
category
android:name=android.intent.category.LAUNCHER /
/intent-filter
/activity
activity android:name=.ActivityB android:label=Activity B
android:launchMode=singleTop/
/application
/manifest

Note the launchModes for the two Activities. The source for ActivityA
and ActivityB is not worth posting; it is almost identical to the
Forwarding app code.

Thanks for your unrelenting help!


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Activity Question

2008-08-22 Thread Gil

If I use singleTop for both activities the code works as expected.
The singleTask launchMode is causing the behavior described
above.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Activity Question

2008-08-22 Thread Gil

It turns out that singleTask is what I need in my app for my main
(LAUNCHER) activity otherwise sometimes I end up with multiple
instances of my activities.

On Aug 22, 10:33 am, Gil [EMAIL PROTECTED] wrote:
 If I use singleTop for both activities the code works as expected.
 The singleTask launchMode is causing the behavior described
 above.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Activity Question

2008-08-22 Thread Justin (Google Employee)

I've replicated the behavior you're seeing, and it seems anomalous, so
I'll keep looking at it.

Cheers,
Justin
Android Team @ Google

On Aug 22, 12:20 pm, Gil [EMAIL PROTECTED] wrote:
 It turns out that singleTask is what I need in my app for my main
 (LAUNCHER) activity otherwise sometimes I end up with multiple
 instances of my activities.

 On Aug 22, 10:33 am, Gil [EMAIL PROTECTED] wrote:

  If I use singleTop for both activities the code works as expected.
  The singleTask launchMode is causing the behavior described
  above.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Activity Question

2008-08-21 Thread hackbod

The normal behavior would be for the user to return to activity B.
You must be doing something more than you describe here.

Fwiw, this might be useful: http://code.google.com/android/intro/appmodel.html

Also from a command like prompt, adb shell dumpsys activity while
the emulator is running will let you see the current state of the
activity stack in the system.

On Aug 20, 9:30 pm, Gil [EMAIL PROTECTED] wrote:
 I have an Activity A (the main activity) which invokes
 startActivityForResult with an ACTION_EDIT Intent and the associated
 data URI, to launch Activity B. While Activity B is displayed, the
 user hits the Home button. From the home screen if I click my
 application icon the application displays Activity A which is my main
 activity. I would like it to display Activity B and restore the data
 URI of the item I was editing. What is the correct way to implement
 this behavior?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Activity Question

2008-08-21 Thread Gil

I did more research on this subject and I have a new situation.
Activity A is the main activity and it uses the singleTask launch
mode. Activity B uses the singleTop launch mode. In my app Activity A
is the login activity for my application. The user enters the username
and password and if it is correct I call finish() on Activity A an
call startActivity to start Activty B.

If I hit the Home button while in the Activity B and then hit the home
screen icon of the app something interesting happens: Activity A comes
to the front. If I hit the Back button I now see Activity B. I thought
to my self: If I know that the user is logged in I can call finish()
in the onCreate() of Activty A.That works, meaning that while I'm in
Activity B I hit the Home button, clicking the home screen app icon
returns me to Activity B without displaying Activty A; so far so good.
The problem now is that if I hit Back from Activity B and then click
the home screen app icon of course nothing happens because Activity A
calls finish().

Please let me know if I'm on the right path. Thanks!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Activity Question

2008-08-21 Thread Gil

Dianne, please save me one more time.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Activity Question

2008-08-21 Thread Justin (Google Employee)

 The user enters the username
 and password and if it is correct I call finish() on Activity A an
 call startActivity to start Activty B.

You are calling startActivity from onPause() then? If you are calling
startActivity and then finish(), finish() won't actually execute until
the new activity you started finishes. At the moment you call
startActivity on B, A's onPause will be called and B will start
executing.

 I thought
 to my self: If I know that the user is logged in I can call finish()
 in the onCreate() of Activty A.

From the rest of your description I'm also not clear if your code is
the same when you started your question as it is when you finish it.
Do your comments after this point in your post relate to code that is
different.

 The problem now is that if I hit Back from Activity B and then click
 the home screen app icon of course nothing happens because Activity A
 calls finish().

What do you mean nothing happens? Something has to happen, something
will be launch, even it it closes immediately. If you were in B and
you press 'back' and see the home screen, then an instance of A no
longer exists, because it would be behind B. My guess is what is
actually happening is that when you hit 'back' from B, A is
immediately finishing. When you try to launch your application from
the home screen again, I'm not sure what is happening.

Hopefully you can clarify exactly what you're doing.

Cheers,
Justin
Android Team @ Google

On Aug 21, 12:38 pm, Gil [EMAIL PROTECTED] wrote:
 I did more research on this subject and I have a new situation.
 Activity A is the main activity and it uses the singleTask launch
 mode. Activity B uses the singleTop launch mode. In my app Activity A
 is the login activity for my application. The user enters the username
 and password and if it is correct I call finish() on Activity A an
 call startActivity to start Activty B.

 If I hit the Home button while in the Activity B and then hit the home
 screen icon of the app something interesting happens: Activity A comes
 to the front. If I hit the Back button I now see Activity B. I thought
 to my self: If I know that the user is logged in I can call finish()
 in the onCreate() of Activty A.That works, meaning that while I'm in
 Activity B I hit the Home button, clicking the home screen app icon
 returns me to Activity B without displaying Activty A; so far so good.
 The problem now is that if I hit Back from Activity B and then click
 the home screen app icon of course nothing happens because Activity A
 calls finish().

 Please let me know if I'm on the right path. Thanks!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Activity Question

2008-08-21 Thread Gil

Sorry it was not clear.Please let me try to explain the second part in
a different way.

1) Start the application for the first time. Activity A is displayed
(it is the main Activity i.e. uses MAIN/LAUNCHER in the intent
filter). Activity A also uses singleTask launch mode.
2) User enters username and password. An asynchronous authentication
is started. When authetication completes I execute the following code
inside the authentication callback:

finish();
Intent intent = new Intent( this, ActivityB.class);
intent.setAction( Intent.ACTION_VIEW);
intent.setData( m_signedInUser.getContentUri());
startActivity( intent);

3) Now, Activity B is visible. BTW, Activity B uses the singleTop
launch mode.
4) User hits the Home button. Activity B is no longer visible.
5) The user clicks the app icon in the home screen. Activity A is
displayed.
Note: As hackbod said earlier, Activity B should be displayed.
6) While Activity A is still visible hit the Back button. Activity B
is now visible.

Hope this is clearer. Thanks for helping out!


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Activity Question

2008-08-21 Thread Justin (Google Employee)

How are you performing your asynchronous authentication? Are you just
starting another thread from your Activity or are you using a specific
class?

Cheers,
Justin
Android Team @ Google

On Aug 21, 4:13 pm, Gil [EMAIL PROTECTED] wrote:
 Sorry it was not clear.Please let me try to explain the second part in
 a different way.

 1) Start the application for the first time. Activity A is displayed
 (it is the main Activity i.e. uses MAIN/LAUNCHER in the intent
 filter). Activity A also uses singleTask launch mode.
 2) User enters username and password. An asynchronous authentication
 is started. When authetication completes I execute the following code
 inside the authentication callback:

 finish();
 Intent intent = new Intent( this, ActivityB.class);
 intent.setAction( Intent.ACTION_VIEW);
 intent.setData( m_signedInUser.getContentUri());
 startActivity( intent);

 3) Now, Activity B is visible. BTW, Activity B uses the singleTop
 launch mode.
 4) User hits the Home button. Activity B is no longer visible.
 5) The user clicks the app icon in the home screen. Activity A is
 displayed.
 Note: As hackbod said earlier, Activity B should be displayed.
 6) While Activity A is still visible hit the Back button. Activity B
 is now visible.

 Hope this is clearer. Thanks for helping out!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Activity Question

2008-08-21 Thread Gil

I'm starting my own thread from Activity A and then I use a Handler to
post the callback to make it thread safe.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Activity Question

2008-08-21 Thread hackbod

On Aug 21, 4:13 pm, Gil [EMAIL PROTECTED] wrote:
 finish();
 Intent intent = new Intent( this, ActivityB.class);
 intent.setAction( Intent.ACTION_VIEW);
 intent.setData( m_signedInUser.getContentUri());
 startActivity( intent);

You should call finish -after- starting the next activity.  Otherwise
you are starting the next activity from no activity (upon calling
finish(), the system as starting closing down your activity and
transitioning back to the previous activity).

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Activity Question

2008-08-21 Thread Gil

Thanks hackbod! I moved the call to finish() after startActivity().
The behavior has not changed though.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Activity Question

2008-08-21 Thread hackbod

If you look at ApiDemos  App  Activity  Forwarding, you will see an
example that does this exact same thing, so there must be something
different that you are doing.  Just making an activity singleTop won't
have that effect (though singleInstance or singleTask -would).

On Aug 21, 7:09 pm, Gil [EMAIL PROTECTED] wrote:
 Thanks hackbod! I moved the call to finish() after startActivity().
 The behavior has not changed though.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Activity Question

2008-08-21 Thread Gil

Thanks hackbod! I'll look into that example tomorrow to try to
understand the differences.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---