Yes I was afraid it'd have to come to that, it's similar to re-inventing the wheel that Android provides for me already.. with a slight tweak.. and for that slight tweak I now have to manage the stack on my own.
On Wednesday, 24 April 2013 03:29:06 UTC-4, Piren wrote: > > Well, when i encountered issues i couldn't overcome because of android's > picky way of deciding which activity to show i just made my own > implementation... had only one entry point to the app using a single > activity which then decided what should be shown next. > > > On Tuesday, April 23, 2013 7:36:19 PM UTC+3, Dritan wrote: >> >> Thank you Piren and Andrei for your replies but neither seem to do the >> same job as singleTop :( >> >> SingleTop remembers which activity you were last on and always brings >> that up when launching from the icon. I have tried setting my application >> to "android:allowTaskReparenting="true"" but that didn't work. >> >> I have tried using launchMode="singleTask" but that brings up only the >> main activity - not the last activity user was on. The user has to re-tap >> within the main activity to get back in the last activity they were on. >> >> SingleInstance is out of the question - it's always a new instance. >> >> My main activity is the only activity with intent filters MAIN and >> LAUNCHER. >> >> I just don't understand why the very first time my app is installed >> sinlgeTop behaves like "standard" and only after quitting and restarting >> the app will singleTop actually work as it should. >> >> Thanks for your help! >> Dritan >> >> >> On Tuesday, 23 April 2013 03:34:58 UTC-4, Andrei Ponomarenko wrote: >>> >>> Here you go: >>> <application android:icon="@drawable/icon" >>> android:label="@string/app_name" >>> android:theme="@android:style/Theme.Black.NoTitleBar" >>> android:debuggable="true" >>> android:allowTaskReparenting="true" >>> android:name="com.company.product.AppName" >>> > >>> >>> <activity >>> android:theme="@style/Theme.Sherlock" >>> android:name="com.company.product.MainActivity" >>> android:label="@string/app_name" >>> android:launchMode="singleTop" >>> >>> > >>> >>> If you don't want singleTask there is a way to make sure singleTop >>> always has only one instance. Just like Piren said - make sure there are no >>> other intents to launch your app - they will create a different instance. >>> If you absolutely need to have other intents that can launch your activity >>> but still want only one instance use this: >>> intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | >>> Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP); >>> It won't be the same instance but there will be only one. >>> Good luck! >>> >>> >>> >>> On Tuesday, April 23, 2013 12:10:12 AM UTC-7, Piren wrote: >>>> >>>> Sorry, you should probably try singleTask before singleInstance :) >>>> >>>> On Tuesday, April 23, 2013 10:08:49 AM UTC+3, Piren wrote: >>>>> >>>>> Sounds like the intent being used to launch the app by default and the >>>>> intent used to launch from the icon behave differently. SingleTop does >>>>> not >>>>> guarantees that only one activity will be shown, rather one per task. >>>>> sounds as if you keep creating different tasks in one instance. I had >>>>> something similar happen to me and it was specific to some Motorola based >>>>> devices.. i guess their launcher treated launch intents a bit differently. >>>>> >>>>> If you can, change it to singleInstance. If not, try checking the >>>>> different intents you use to launch and also see if enabling >>>>> taskReparenting helps you. >>>>> >>>>> On Tuesday, April 23, 2013 2:49:13 AM UTC+3, Dritan wrote: >>>>>> >>>>>> I just noticed that even when I export the app with a debug key via >>>>>> "ant debug" the app behaves the same way as OTA installation, which >>>>>> is >>>>>> the incorrect behavior. >>>>>> >>>>>> How come my app's main activity's "launchMode" stops behaving weirdly >>>>>> AFTER it has run once? I don't have any code handling the activity >>>>>> stack, I left it purely on Android's hands. >>>>>> >>>>>> Any clues? >>>>>> >>>>>> Thanks!! >>>>>> >>>>>> >>>>>> On Apr 22, 6:52 pm, Dritan <[email protected]> wrote: >>>>>> > Hello, >>>>>> > >>>>>> > When I sideload my app to my phone via USB, the very first time it >>>>>> > runs, the main activity behaves as expected. Only 1 instance of >>>>>> main >>>>>> > can be launched, no matter what. >>>>>> > >>>>>> > When I export my app as a signed app, then install the app OTA the >>>>>> > main activity behaves completely different ONLY the first time it >>>>>> > runs. >>>>>> > >>>>>> > After installing the app, the main activity loads. I press the >>>>>> 'Home' >>>>>> > button, then relaunch the app from the icon and a new main activity >>>>>> is >>>>>> > loaded. I can keep on doing this for tens of hundreds of activity >>>>>> > instances. >>>>>> > >>>>>> > Once I have closed all such lose instances and restart the app, >>>>>> then >>>>>> > the main activity returns the expected behavior as being a >>>>>> "singleTop" >>>>>> > instance. >>>>>> > >>>>>> > I have removed all proguard-related lines and files from my app so >>>>>> > when I export as signed, doesn't try to obfuscate? (to my >>>>>> knowledge) >>>>>> > >>>>>> > I do not understand why this is happening, is this a bug with >>>>>> Android >>>>>> > or am I doing something I have never heard of before? Does anyone >>>>>> have >>>>>> > a solution? >>>>>> > >>>>>> > Thank you, >>>>>> > Dritan >>>>>> >>>>> -- -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en --- You received this message because you are subscribed to the Google Groups "Android Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.

