Re: [android-developers] Re: How to launch an application? Is there a work around for launchMode bug?

2010-11-09 Thread Mark Murphy
On Mon, Nov 8, 2010 at 9:12 PM, John jhn...@yahoo.com wrote:
 1. I am thinking whether it is possible to use a static variable to
 keep track of running NotesList activity:
 increment the variable in NotesList.onCreate and
 decrement  the variable in NotesList.onDestroy
 Then instead of calling StartupActivity.needStartApp simply compare
 the variable with 0.

That would work if both instances are in the same process. I haven't
investigated this problem enough to know whether or not that will be
the case.

 2. Or change some Intent flags, as you suggested before.

Again, that was for your original bug #2. I do not think there is a
way that will help for this scenario, though.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android App Developer Books: http://commonsware.com/books

-- 
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: How to launch an application? Is there a work around for launchMode bug?

2010-11-08 Thread John
 I guess you are trying to do too much.

I cannot agree that launching such a trivial application as Notepad
with only 2 activities is doing too much.

 The basic operation of launching an app is pretty straightforward, and it's 
 definitely not broken.

How can you support your words?
I wrote precise steps, which led to bugs, but you are simply saying
that there it nothing wrong without any prove.
This is not helpful.

 Have you tried writing your own app and checking the behaviour?

Yes. My application also have 2 activities and is very similar to
Notepad.
And my customers filed bugs related to multiple instances created.

 If you still face similar problems with your app, then perhaps, you should
 post your code and let others go through it.

I disagree.
I made an effort to reproduce the problem with the sample Notepad
exactly to avoid posting my own messy code.
We need to fix the standard sample, such as Notepad, so that I and
other people would use it as an example.

Thank you
John



-- 
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: How to launch an application? Is there a work around for launchMode bug?

2010-11-08 Thread Kostya Vasilyev
Have you considered using startActivityForResult when launching secondary
Activities to force ordering?

--
Kostya Vasilyev -- http://kmansoft.wordpress.com

09.11.2010 0:09 пользователь John jhn...@yahoo.com написал:

 I guess you are trying to do too much.
I cannot agree that launching such a trivial application as Notepad
with only 2 activities is doing too much.


 The basic operation of launching an app is pretty straightforward, and
it's definitely not broken...
How can you support your words?
I wrote precise steps, which led to bugs, but you are simply saying
that there it nothing wrong without any prove.
This is not helpful.


 Have you tried writing your own app and checking the behaviour?
Yes. My application also have 2 activities and is very similar to
Notepad.
And my customers filed bugs related to multiple instances created.


 If you still face similar problems with your app, then perhaps, you should
 post your code and l...
I disagree.
I made an effort to reproduce the problem with the sample Notepad
exactly to avoid posting my own messy code.
We need to fix the standard sample, such as Notepad, so that I and
other people would use it as an example.


Thank you
John



-- 
You received this message because you are subscribed to the Google
Groups An...

-- 
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: How to launch an application? Is there a work around for launchMode bug?

2010-11-08 Thread Kumar Bibek
I just checked the sample, with launch mode as standard, and, while I am on
create note screen, I pressed Home button.

I launched the app from the Launcher icon, and I could see the editor
screen. So, obviously, this is not a bug. I could not reproduce it. Tested
with 2.1

2010/11/9 Kostya Vasilyev kmans...@gmail.com

 Have you considered using startActivityForResult when launching secondary
 Activities to force ordering?

 --
 Kostya Vasilyev -- http://kmansoft.wordpress.com

 09.11.2010 0:09 пользователь John jhn...@yahoo.com написал:


  I guess you are trying to do too much.
 I cannot agree that launching such a trivial application as Notepad
 with only 2 activities is doing too much.


  The basic operation of launching an app is pretty straightforward, and
 it's definitely not broken...
 How can you support your words?
 I wrote precise steps, which led to bugs, but you are simply saying
 that there it nothing wrong without any prove.
 This is not helpful.


  Have you tried writing your own app and checking the behaviour?
 Yes. My application also have 2 activities and is very similar to
 Notepad.
 And my customers filed bugs related to multiple instances created.


  If you still face similar problems with your app, then perhaps, you
 should
  post your code and l...
 I disagree.
 I made an effort to reproduce the problem with the sample Notepad
 exactly to avoid posting my own messy code.
 We need to fix the standard sample, such as Notepad, so that I and
 other people would use it as an example.


 Thank you
 John



 --
 You received this message because you are subscribed to the Google
 Groups An...

  --
 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.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en




-- 
Kumar Bibek
http://techdroid.kbeanie.com
http://www.kbeanie.com

-- 
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: How to launch an application? Is there a work around for launchMode bug?

2010-11-08 Thread Mark Murphy
On Mon, Nov 8, 2010 at 4:08 PM, John jhn...@yahoo.com wrote:
 The basic operation of launching an app is pretty straightforward, and it's 
 definitely not broken.

 How can you support your words?
 I wrote precise steps, which led to bugs, but you are simply saying
 that there it nothing wrong without any prove.

There were no bugs in your original post. There was behavior you did
not like, which you attributed to being a bug. Of course, you didn't
bother to explain what behavior you were seeking very clearly, forcing
us to have to read between the lines and guess. Rather than blaming
others, please consider just writing better questions.

 Yes. My application also have 2 activities and is very similar to
 Notepad.
 And my customers filed bugs related to multiple instances created.

Please examine the Intent class and the various FLAG_ACTIVITY_ flags
you can use when starting an activity. android:launchMode does not
need to be changed all that often -- you control the inter-activity
navigation via Intent flags.

For example, your complaints regarding having multiple instances of
the same activity probably is covered by
FLAG_ACTIVITY_REORDER_TO_FRONT.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android Training in Atlanta: http://bignerdranch.com/classes/android

-- 
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: How to launch an application? Is there a work around for launchMode bug?

2010-11-08 Thread Kumar Bibek
The Notepad sample doesn't have any bugs, btw.

On Tue, Nov 9, 2010 at 2:56 AM, Mark Murphy mmur...@commonsware.com wrote:

 On Mon, Nov 8, 2010 at 4:08 PM, John jhn...@yahoo.com wrote:
  The basic operation of launching an app is pretty straightforward, and
 it's definitely not broken.
 
  How can you support your words?
  I wrote precise steps, which led to bugs, but you are simply saying
  that there it nothing wrong without any prove.

 There were no bugs in your original post. There was behavior you did
 not like, which you attributed to being a bug. Of course, you didn't
 bother to explain what behavior you were seeking very clearly, forcing
 us to have to read between the lines and guess. Rather than blaming
 others, please consider just writing better questions.

  Yes. My application also have 2 activities and is very similar to
  Notepad.
  And my customers filed bugs related to multiple instances created.

 Please examine the Intent class and the various FLAG_ACTIVITY_ flags
 you can use when starting an activity. android:launchMode does not
 need to be changed all that often -- you control the inter-activity
 navigation via Intent flags.

 For example, your complaints regarding having multiple instances of
 the same activity probably is covered by
 FLAG_ACTIVITY_REORDER_TO_FRONT.

 --
 Mark Murphy (a Commons Guy)
 http://commonsware.com | http://github.com/commonsguy
 http://commonsware.com/blog | http://twitter.com/commonsguy

 Android Training in Atlanta: http://bignerdranch.com/classes/android

 --
 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.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en




-- 
Kumar Bibek
http://techdroid.kbeanie.com
http://www.kbeanie.com

-- 
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: How to launch an application? Is there a work around for launchMode bug?

2010-11-08 Thread Kumar Bibek
:) I just pressed Back once, and it was gone. Although I did not follow all
of your well explained steps, and did not bother to check all your so-called
bugs, because, I couldn't reproduce your first bug.

And I would not bother to attach a video of me walking through the sample
step by step as well.

On Tue, Nov 9, 2010 at 3:08 AM, John jhn...@yahoo.com wrote:

 Thank you for all your answers.

  I launched the app from the Launcher icon, and I could see the editor
  screen. So, obviously, this is not a bug. I could not reproduce it.
 Tested
  with 2.1

 Sorry, but you did not bother to follow my steps from 1 to 9.
 If you would, you will see multiple instances of Notepad activities
 being launched.
 This would be clear to you because you will have to press Back many
 times.

  There were no bugs in your original post. There was behavior you did
  not like, which you attributed to being a bug

 Sorry, but multiple instances of Notepad are launched, which is
 inconsistent and may cause out of memory condition.
 If this is not a bug, than what is?

  Please examine the Intent class and the various FLAG_ACTIVITY_ flags
  you can use when starting an activity.
  For example, your complaints regarding having multiple instances of
  the same activity probably is covered by
  FLAG_ACTIVITY_REORDER_TO_FRONT.

 Sorry, I do not understand.
 This is the OS, which launches the NotesList activity, not my code.
 So, I do not send any intent to launch NotesList.
 So, what intent class you want me to modify?

 Thank you
 John

 --
 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.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en




-- 
Kumar Bibek
http://techdroid.kbeanie.com
http://www.kbeanie.com

-- 
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: How to launch an application? Is there a work around for launchMode bug?

2010-11-08 Thread John
 :) I just pressed Back once, and it was gone. Although I did not follow all
 of your well explained steps, and did not bother to check all your so-called
 bugs, because, I couldn't reproduce your first bug.

This is not helpful.
My steps are reproducible on emulator 2.1, 2.2 and Drod X 2.2.

But you simply did not bother repeating them and claim that there is
no bug.
Shame on you.

John

-- 
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: How to launch an application? Is there a work around for launchMode bug?

2010-11-08 Thread Kumar Bibek
Sorry, What I meant was, after opening the app multiple times, and pressing
the Home button multiple times, I could not see multiple instances of the
activity. I just had to press BACK once, and it was gone.

Apologies

On Tue, Nov 9, 2010 at 3:15 AM, John jhn...@yahoo.com wrote:

  :) I just pressed Back once, and it was gone. Although I did not follow
 all
  of your well explained steps, and did not bother to check all your
 so-called
  bugs, because, I couldn't reproduce your first bug.

 This is not helpful.
 My steps are reproducible on emulator 2.1, 2.2 and Drod X 2.2.

 But you simply did not bother repeating them and claim that there is
 no bug.
 Shame on you.

 John

 --
 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.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en




-- 
Kumar Bibek
http://techdroid.kbeanie.com
http://www.kbeanie.com

-- 
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: How to launch an application? Is there a work around for launchMode bug?

2010-11-08 Thread John
Thank you for all your answers.

 I launched the app from the Launcher icon, and I could see the editor
 screen. So, obviously, this is not a bug. I could not reproduce it. Tested
 with 2.1

Sorry, but you did not bother to follow my steps from 1 to 9.
If you would, you will see multiple instances of Notepad activities
being launched.
This would be clear to you because you will have to press Back many
times.

 There were no bugs in your original post. There was behavior you did
 not like, which you attributed to being a bug

Sorry, but multiple instances of Notepad are launched, which is
inconsistent and may cause out of memory condition.
If this is not a bug, than what is?

 Please examine the Intent class and the various FLAG_ACTIVITY_ flags
 you can use when starting an activity.
 For example, your complaints regarding having multiple instances of
 the same activity probably is covered by
 FLAG_ACTIVITY_REORDER_TO_FRONT.

Sorry, I do not understand.
This is the OS, which launches the NotesList activity, not my code.
So, I do not send any intent to launch NotesList.
So, what intent class you want me to modify?

Thank you
John

-- 
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: How to launch an application? Is there a work around for launchMode bug?

2010-11-08 Thread John
 Sorry, What I meant was, after opening the app multiple times, and pressing
 the Home button multiple times, I could not see multiple instances of the
 activity. I just had to press BACK once, and it was gone.

Sorry,
but you did not follow my steps.

I guess that you did not follow the very first step:
1. When installing NotePad application tap Open.

This makes the difference: when you launch an application from
Installer,
then press Home button and then launch it again from the Home screen
you get multiple instances of the main activity.
This is by design of launchMode:standard
And this causes the bug.

I just verified them on DroidX one more time.
Let me repeat the steps:

1. When installing NotePad application tap Open.
2. Create a new note, begin editing, then press Home button.
3. Launch NotePad from the home screen - the editor disappeared, only
the list displayed. This is bug #1.
4. Tap on the note and continue editing.
5. Note: if user continues repeating Home/Launch cycle, then there may
be multiple activities created
   and the application will run out of memory.
6. Press Back. Return to the list.
7. Press Back. Again see the editor! This is bug #2 (actually it is
the same bug, but customers are not aware of it and report it
separately).
8. Press Back. Return to the list.
9. Press Back. Return to the home screen.
Now the application is closed.

-- 
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: How to launch an application? Is there a work around for launchMode bug?

2010-11-08 Thread Kumar Bibek
Perhaps your DroidX is broken. I give up. Sorry again.

On 09-Nov-2010 3:32 AM, John jhn...@yahoo.com wrote:

 Sorry, What I meant was, after opening the app multiple times, and
pressing
 the Home button mult...
Sorry,
but you did not follow my steps.

I guess that you did not follow the very first step:

1. When installing NotePad application tap Open.
This makes the difference: when you launch an application from
Installer,
then press Home button and then launch it again from the Home screen
you get multiple instances of the main activity.
This is by design of launchMode:standard
And this causes the bug.

I just verified them on DroidX one more time.
Let me repeat the steps:


1. When installing NotePad application tap Open.
2. Create a new note, begin editing, then press ...
--

You received this message because you are subscribed to the Google
Groups Android Developers group...

-- 
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: How to launch an application? Is there a work around for launchMode bug?

2010-11-08 Thread John
 Perhaps your DroidX is broken. I give up. Sorry again.

Or, please,
This behavior is reproducible with a simulator 2.1, 2.2
and, according to other posts, which I quoted above,
was in Android OS since the very beginning.

Any solution?

In particular, I would appreciate if Mark Murphy will elaborate on his
suggestions about FLAG_ACTIVITY_REORDER_TO_FRONT.
As I understood from other posts, people suggest to create some other
dummy activity to be launched by OS
and then launch the main GUI activity programmatically. But I am not
sure whether that would be the best solution for this so common
problem.

Thank you
John

-- 
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: How to launch an application? Is there a work around for launchMode bug?

2010-11-08 Thread Mark Murphy
On Mon, Nov 8, 2010 at 5:19 PM, John jhn...@yahoo.com wrote:
 In particular, I would appreciate if Mark Murphy will elaborate on his
 suggestions about FLAG_ACTIVITY_REORDER_TO_FRONT.

That was more aimed at your bug #2.

If I understand your steps correctly -- particularly after your
clarifications to Kumar -- bug #1 may be related to this:

http://code.google.com/p/android/issues/detail?id=2373

 As I understood from other posts, people suggest to create some other
 dummy activity to be launched by OS
 and then launch the main GUI activity programmatically.

I am assuming you are referring to stuff like this:

https://github.com/cleverua/android_startup_activity

...which, since it requires GET_TASKS, is a bit scary.

 But I am not
 sure whether that would be the best solution for this so common
 problem.

It probably isn't. However, the bug has been outstanding for quite
some time. While repeatable, it does not occur in too many places --
most people would encounter it after upgrading the app, as I
understand it. There might be a better approach, using
ACTION_PACKAGE_REPLACED, but I haven't tried thinking it through.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android Training in Atlanta: http://bignerdranch.com/classes/android

-- 
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: How to launch an application? Is there a work around for launchMode bug?

2010-11-08 Thread John
 Perhaps your DroidX is broken. I give up. Sorry again.

Or, please,
This behavior is reproducible with a simulator 2.1, 2.2
and, according to other posts, which I quoted above,
was in Android OS since the very beginning.

Any solution?

In particular, I would appreciate if Mark Murphy will elaborate on his
suggestions about FLAG_ACTIVITY_REORDER_TO_FRONT.
As I understood from other posts, people suggest to create some other
dummy activity to be launched by OS
and then launch the main GUI activity programmatically. But I am not
sure whether that would be the best solution for this so common
problem.

Thank you
John

-- 
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: How to launch an application? Is there a work around for launchMode bug?

2010-11-08 Thread John
Thank you for your reply.

 bug #1 may be related to this:
 http://code.google.com/p/android/issues/detail?id=2373

I do not know.
That post says:
This only happens when launching the app from Eclipse

My bug, on the other hand, is 100% reproducible by every user.
Just launch the app from the installer, press home, launch it again
and you have it.

 I am assuming you are referring to stuff like this:
 https://github.com/cleverua/android_startup_activity

Yes.
Thank you.
Spent the whole Sunday googling, but missed that post.
Now I will try to apply that approach in NotePad sample.

 it does not occur in too many places --
 most people would encounter it after upgrading the app, as I
 understand it.

No.
After the first installation as well.
Other people also report it when the application is launched by other
sources, such as a browser.
Basically, a single instance of application is created when it is
launched only by a single place, such as icon in Home screen (this is
what Kumar was doing). But if an application is launched by multiple
places (Home screen, Installer, Browser, etc),
then multiple instances are launched.
Since Installer has that big Open button, which most users click,
the bug is almost impossible to avoid.

 There might be a better approach, using
 ACTION_PACKAGE_REPLACED, but I haven't tried thinking it through.

If you will come up with something, please, tell me.
Application launch is the very first thing in lifecycle and it has to
be done properly.

Thank you
John

-- 
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: How to launch an application? Is there a work around for launchMode bug?

2010-11-08 Thread John
Thank you for your reply.

 bug #1 may be related to this:
 http://code.google.com/p/android/issues/detail?id=2373

I do not know.
That post says:
This only happens when launching the app from Eclipse

My bug, on the other hand, is 100% reproducible by every user.
Just launch the app from the installer, press home, launch it again
and you have it.

 I am assuming you are referring to stuff like this:
 https://github.com/cleverua/android_startup_activity

Yes.
Thank you.
Spent the whole Sunday googling, but missed that post.
Now I will try to apply that approach in NotePad sample.

 it does not occur in too many places --
 most people would encounter it after upgrading the app, as I
 understand it.

No.
After the first installation as well.
Other people also report it when the application is launched by other
sources, such as a browser.
Basically, a single instance of application is created when it is
launched only by a single place, such as icon in Home screen (this is
what Kumar was doing). But if an application is launched by multiple
places (Home screen, Installer, Browser, etc),
then multiple instances are launched.
Since Installer has that big Open button, which most users click,
the bug is almost impossible to avoid.

 There might be a better approach, using
 ACTION_PACKAGE_REPLACED, but I haven't tried thinking it through.

If you will come up with something, please, tell me.
Application launch is the very first thing in lifecycle and it has to
be done properly.

Thank you
John

-- 
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: How to launch an application? Is there a work around for launchMode bug?

2010-11-08 Thread Mark Murphy
On Mon, Nov 8, 2010 at 5:49 PM, John jhn...@yahoo.com wrote:
 bug #1 may be related to this:
 http://code.google.com/p/android/issues/detail?id=2373

 I do not know.
 That post says:
 This only happens when launching the app from Eclipse

Please read the whole issue.

 My bug, on the other hand, is 100% reproducible by every user.
 Just launch the app from the installer, press home, launch it again
 and you have it.

Which is mentioned in comment #5 of the issue that I supplied, if you
would care to read it.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android Training in Atlanta: http://bignerdranch.com/classes/android

-- 
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: How to launch an application? Is there a work around for launchMode bug?

2010-11-08 Thread John
 http://code.google.com/p/android/issues/detail?id=2373
 Which is mentioned in comment #5 of the issue that I supplied

Yes. Thank you.

I implemented the changes in Notepad:

1. Inserted
activity android:name=.StartupActivity
android:configChanges=orientation|keyboardHidden
android:theme=@android:style/Theme.NoTitleBar.Fullscreen
intent-filter
action android:name=android.intent.action.MAIN /
category
android:name=android.intent.category.LAUNCHER /
/intent-filter
/activity
to AndroidManifest of Notepad

2. Remove
intent-filter
action android:name=android.intent.action.MAIN /
category
android:name=android.intent.category.LAUNCHER /
/intent-filter
from
activity android:name=NotesList

3. Insert
uses-permission android:name=android.permission.GET_TASKS /

4. Copy StartupActivity.java to NotePad\src\com\example\android
\notepad

5. Change Package name, change
new Intent(StartupActivity.this, MainActivity.class);
to
new Intent(StartupActivity.this, NotesList.class);

Just a summary: StartupActivity.needStartApp does something like:
getSystemService(Context.ACTIVITY_SERVICE);
tasksInfo = getRunningTasks(1024);
size = tasksInfo.size();
for (int i = 0; i  size; i++) {
  if
(ourAppPackageName.equals(tasksInfo.get(i).baseActivity.getPackageName()))
{
  return tasksInfo.get(i).numActivities == 1;

So, now the question is: how to get rid of GET_TASKS?

1. I am thinking whether it is possible to use a static variable to
keep track of running NotesList activity:
increment the variable in NotesList.onCreate and
decrement  the variable in NotesList.onDestroy
Then instead of calling StartupActivity.needStartApp simply compare
the variable with 0.

2. Or change some Intent flags, as you suggested before.

So, what is the most proper way in your opinion?

Thank you
John

-- 
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