Android :: Starting Activity Through Notification - Avoiding Duplicate Activities

Feb 24, 2010

I am currently showing a notification. When the user clicks this noticiation, the application is started. The notification persists, to indicate that the service is running in the background.

CODE:..............

However, I have detected a case where a bug appears. If the user starts the application through clicking the normal icon, and while the activity is running clicks the notification, then a new activity is started without the earlier one exiting, the later being on top of the earlier. And that is not all: Further clicks on the notification will create additional activities and place them on top of those already running. How can I prevent this? Is there a nice check to do to see if a certain activity is currently being shown or is loaded?

Android :: Starting Activity through notification - Avoiding duplicate activities


Android :: Starting One Activity Brings All Other Activities In Same Process To Front

Apr 20, 2010

I have an application consisting of two activities (call them Display and Preferences) and one service which listens for incoming phonecalls. When it detects one it launches the Display-activity with a delay of 3sec in order to let the PhoneApp launch first. The Display- activity is transparent so the user can still use the PhoneApp as normal (ie answering the call) even though my Display-activity is "on top". So far so good

Now to my problem. Lets say that the Preferences-activity is active when there is an incoming call. The PhoneApp is launched on top of the Preferences-activity as expected. However when the Display-activity is launched the Preferences-activity pops up as well, hiding the PhoneApp. My question is if it is possible to work around this in some way? Since I do not want my Preferences-activity to block the PhoneApp and hence making it impossible for the user to answer the incoming phone call.

View 3 Replies View Related

Android :: Avoiding Duplicate Contacts With Gmail / Microsoft Exchange

Jul 5, 2010

I have Gmail set up on my Nexus One (personal email). I also have Microsoft exchange setup (work email) and both work fine. The problem is that under my contacts there are duplicate entries both for Gmail and Microsoft exchange. That is causing some problems with my SMS app (duplicate contacts) and wanted to see how I could avoid syncing Microsoft exchange and delete it from my contact but still keep it on my phone. I have already unchecked the box to not sync my contacts but did that after adding it.

View 3 Replies View Related

Android :: Avoiding Duplicate Resources In Project / Want Some Of Landscape Images

Aug 25, 2010

I have some images in my drawable folder and they have landscape versions in drawable-land. However I want some of the landscape images to be shared, as it seems a waste to duplicate the file with a different name. Is it possible to make a sym link (shortcut) or something for one of the duplicated files to prevent wasting space

Folder explanation below as I'm not great at explaining myself:

/drawable
> image1.png
> image2.png
/drawable-land
>image1.png <-- This image
>image2.png <-- is identical to this file

View 1 Replies View Related

Android :: Avoiding Activity Stack Overflow

Sep 17, 2009

I have the following situation. I have a task with the following activity stack -- A - B - C I have a menu item that allows me to start activity D; so my activity stack looks like this -- A - B - C - D Then I could select a menu item that allows me to start an activity C, which would cause my activity stack to look like this: A - B - C - D - C Then I could go back (via the menu item) to activity D, making my activity stack look like this: A - B - C - D - C - D Doing this a few more times, it would wind up looking like this -- A - B - C - D - C - D - C - D - C - D - C - D - C - D - C - D - C - D - C - D - C - D This seems kinda stupid to me. I'd like it to simply re-use an activity, or pop the activity below to be on top (which goes against the nature of a "stack"). So, what I mean is if I had this activity stack: A - B - C - D And I started activity C (from the menu), I would get: A - B - D - C And if I then started activity D (from the menu), I would get: A - B - C - D Is there a way to do this without keeping some global list of activities and doing gross things to them to reorder them?

View 3 Replies View Related

Android :: Avoiding Softinput Specifically In One Activity?

Sep 29, 2009

I want to avoid softinput specifically in one activity in a very specific case.

When i *long press "menu" button *softkeypad is coming irrespective of the activity.

How can i avoid this? i have tried "stateAlwaysHidden" etc for that activity. But did it work.

Al other cases ok. Just this case* long press "menu" button*.

View 6 Replies View Related

Android :: Any Best Practices For Starting / Handling Activities

Oct 23, 2010

Understanding how to declare activities in the manifest file, how to set the appropriate flags when starting them through intents, is quite challenging in all but the default cases. The combination of all these settings and flags is daunting. I've been developing for Android for over a year now, have read the application fundamentals and the reference guide for 'Intent' quite a few times and still I don't have a good grasp of which manifest settings or intent-flags should be used for starting activities in many situations (workflows). Is there some source/document that can explain certain work-flows (ways of navigation through activities and tasks), that shows examples of how to configure and start activities?

View 4 Replies View Related

Android :: Framework Support For Detecting Starting And Stopping Of Activities

May 13, 2009

To support usability studies on what applications are used, i want to write a service that logs when an activity is started and also when it has finished. This is to understand how the users are using the device:

One straightforward option is to have the applications modify, to write this out. But this is tedious having to modify all applications and will not work esp with third party or built in applications.

Is there any alternatives that makes this simpler and easier?

BTW: Looking at the android framework source ActivityManagerNative seems to be invoking a Binder interface when an Activity is started and finished. Any information on what this service is? Is this something i can tap into?

View 8 Replies View Related

Android : Avoiding An Activity To Destroy - Just Stopping Or Pausing It When Pushing The Back Button

Mar 19, 2010

I would like to pausing or putting the application on background when pressing the back button, I don't want the application to go through the destroy state. Things are when I override onKeyDown and when I force to pause or stop the application by using onPause, I have some issuees with the wakelock and application crash, but when I press home button I go through onPause method and I have no exception, it's weird!

View 1 Replies View Related

Android :: Starting Second Activity From Main Activity On Button Click

Dec 4, 2009

Need an example of how to create/start a new activity from the main activity. I have a button click event on the main layout. Originally I just used setContentView(R.layout.secondactivity); which brings up the layout but I don't think that is correct since the secondactivity class is not instantiated at this point yet. I have looked for such an example and can not find one.

View 3 Replies View Related

Android :: Starting Map Activity From Normal Activity

Apr 25, 2010

I have a map app which works fine when its stand alone but it causes an unexpected error when I try to add it as part of another app. My current app which extends Activity tries to launch the map activity with the following lines of code Intent m = new Intent(this, HomeSetter.class); startActivity(m); I also have the xml setup correctly <activity android:name=".HomeSetter" android:label="Screen 4"> </activity> <uses-library android:name="com.google.android.maps" /> </application> However when I try to launch it crashes everytime. I've tried searching the net but I've had no joy in finding a solution 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+unsubscribe @googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

View 4 Replies View Related

Android :: Starting Activity Behind Current Activity

Oct 2, 2009

startActivity() displays the new Activity on top of the current one. But how to display it underneath instead? BTW, I'm starting an Activity from another application, if that makes a difference.

View 5 Replies View Related

Android :: Way To Prevent Duplicate Activity?

Nov 30, 2009

I have an Activity which is launched from a Service. This Activity can spawn other children Activities. Now under certain conditions (particularly related to using screen lock), I can end up with the Service starting a second copy of the Activity again. For reasons of performance, the Service is being started and stopped at various times, and cannot be relied on to hold state. What is the best way to prevent this second launch? Can I (for example) detect that the Activity is already running in the stack and do finish()?

View 5 Replies View Related

Android :: Prevent Duplicate Browser / Activity Launching

Jun 29, 2010

I would like to know if there is a way of preventing a duplicate launch of browser/activity, while the user is already focused on it.mybe there is a way to detect before if the user's current screen is already focused on the same activity/browser i intent to launch?

View 2 Replies View Related

Android :: Starting New Activity From Activity

Jun 9, 2010

When I was originally learning about Android a few months ago I swear I read something about a way to immediately launch an activity when starting a task. I am curious about this now because I need to display an intro screen on launch but I don't want the intro screen to be the root activity. Does anyone know if there is something like this and if not what is the best way to handle an intro screen?I tried googling for a few hours to find it but can't for the life of me.

View 1 Replies View Related

Android :: Starting Activity With FLAG ACTIVITY MULTIPLE TASK To See Multiple Instances

Feb 2, 2009

I am trying to launch an activity from another activity .. Within the com.android.SingleLauncher..

I have activity launch code as ..

CODE:...........

I have set the android:multiprocess="true" in the AndroidManifest.xml of TargetSL I don't seem to see the multiple instances of TargetSL, which i am expecting ..

All i see is 2 process, where i was hoping to see an instance of TargetSL, for each launch that was invoked by the singleLauncher!

View 3 Replies View Related

Android :: Starting Activity With Tabs

May 7, 2010

I have four activity in a Tab and after the user clicked on the list I would like to start another one activity, but I can't use startActivity(Intent), because then I lost the TabHost view, and I get an activity witch is reserving the full screen:( So the user won't be able to click on the other tabs. What should I use? BroadCastReciver or What? If anyone have any good idea please help on me.

View 4 Replies View Related

Android :: Starting Activity By Package Name

Mar 25, 2010

I have the code to get the list of packages installed in phone. I have represented the list in the form of Array List, below is the code snippet. But upon clicking in the package name I want to start that application, but how do I get the respective class name and package name to run? Is there any other method which I can try to start an application? arrayList<String> PackageNames = null; List<PackageInfo> lis = pm.getInstalled Packages(GET_MINIMAL); Pkgs = (ListView) findViewById(R.id.package_list); for (Package Info pi : lis)packages.put(pi.packageName, pi); PackageNames = new ArrayList<String> packages.keySet()); Collections.sort(PackageNames); PackageNames.add(0, "All"); pgs.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple _list_ item_1, PackageNames)); Pkgs.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView<?> arg0, View v, int pos,long rowId) { Intent i = new Intent(); i.setComponent(new ComponentName(class name,packagename)); startActivity(i); I have tried intent to start the activity, but don't know the class name and package name to pass in the ComponentName() to start activity.

View 2 Replies View Related

Android :: Error When Starting Activity

Mar 22, 2010

I'm starting an activity when a button is pressed, and normally (in other apps) haven't had an issue. But when I press the button in this app, I get an "unable to marshal value" error.Exact(ish) error from LogCat:
03-22 02:49:02.883:
WARN/System.err(252):
java.lang.RuntimeException: Parcel:
unable to marshal value
{CLASSNAME}@44dcf1b8
I feel that this might be related to the extra that I'm passing to the intent. I'm passing an ArrayList as a serializable to this new intent. My concern is that the data structure that the ArrayList contains isn't being serialized (as it's a personal data structure).Is the array list content data structure causing this? Something else that I'm missing?

View 1 Replies View Related

Android :: Starting An Activity For Different Third Party App

Aug 19, 2010

I'm working on an app and I want to integrate the Last.fm app into it. Basically, when someone is looking at an artist in my app, I would like to have a button that they can tap to open up Last.fm application with the artist's information.

This intent works, but it loads a menu asking which app I would like to use (Browser or Last.fm):

CODE:..........

However, I just want to start the Last.fm app and skip the dialog asking which app to use, I thought maybe using the setPackage() method would work like this: i.setPackage("fm.last.android");


But it causes the app to crash:

CODE:............

Is it possible to just start the Last.fm app?

Here's a copy of Last.fm's AndroidManifest.xml for reference.

View 1 Replies View Related

Android :: Error When Starting A Tab Activity?

May 16, 2010

I followed the directions verbatim in this Android tutorial, copying/pasting the code from the site to my app. http://developer.android.com/resources/tutorials/views/hello-tabwidget.html

However, when I try to run in the Android emulator, I get the error: "The application Hello Tab Widget has stopped unexpectedly. Please try again."

I tried debugging by introducing a breakpoint in the first line of the onCreate method, but the error occurs before the breakpoint is even hit. Any idea of what is going wrong, or any other way I can debug this issue? I am using Eclipse.

View 2 Replies View Related

Android :: Tabs - Starting A New Activity

Dec 31, 2009

I have 4 Tabs in a TabHost...let them be A,B,C,D.... now each one is just an index page and clicking on any of them shows a different activity...

The problem is that i need to start another activity wen user selects something from the content displayed in the tab... The other activity should also be displayed in the parent tab itself... is it by any chance possible or i'll have to try some other way around?

View 2 Replies View Related

Android :: Starting An Activity In OnStart

Apr 14, 2010

I'm trying to start a floating activity from onStart to retrieve some info from the user right when the initial activity begins.

I have the following:

CODE:............

And callProfileDialog() is just:

CODE:..........

ProfileDialog.class returns a String from an input box. If the result returned is RESULT_CANCELED then I restart the activity.

The problem I'm having is that when the program starts, the screen is just black. If I hit the Back button a RESULT_CANCELED is returned then the initial activity shows as well as the floating activity (since it recalled itself when it got a RESULT_CANCELED). Why can't I get the activities show by calling ProfileDialog.class from onStart()? I got the same result when I called it at the end of onCreate() which is way I switch over to use onStart().

I have also tried the following:

CODE:.........

But this doesn't work either. It all works fine once I hit the back button but without doing that, it's all black.

View 3 Replies View Related

Android :: OnRecieve Starting Activity?

Jun 23, 2009

I would like to know the reason behind this behaviour.I have a broadcast reciever and in onrecieve i am trying to start an activity,however if i am not giving the flags it is giving an exception .On declaring the flags it is working perfectly fine,why?

I was under the impression that onRecieve runs in the main UI thread and we can launch an activity in onRecieve.Error given by the emulator is self explanatory but still why do i need to create an activity in a new task(only in onRecieve)?

CODE:....................

View 4 Replies View Related

Android :: Name Of Droid App Taken As Of Starting Activity / Why Is This?

Oct 18, 2010

In my manifest file, I have given the application name as MyApp and the name of the starting activity as Main Menu.code...

When I see the app icon in the default menu screen of android, the name shown is Main Menu. Why is MyApp not the name shown for the app?

View 2 Replies View Related

Android :: Progress Dialog While Starting New Activity

Feb 9, 2010

this button is shown on my start activity. After pressing it a new activity will be launched but this takes some time cause on initialization of that new activity some data is gathered from the Internet. This works half. The progress dialoge is shown but the progress wheel is not spinning.

Can somebody tell me why this happens?
Button b4 = (Button) findViewById(R.id.Button01);
b4.setOnClickListener(new View.OnClickListener() {
public void onClick (View view) {
final ProgressDialog pd = ProgressDialog.show(pak.this,
"", "Working..", true);......................

View 1 Replies View Related

Android :: Previous App Launches Not Starting Activity

Jun 2, 2010

I need a way to detect if this is the first time the user is ever opening the application, if so, start an activity. Then all previous application launches wouldn't start that activity. I've read in a few places about using preferences to accomplish this. Anyone got any ideas?

View 2 Replies View Related

Android :: Starting An Activity From Callback Class

Aug 18, 2010

I have an activity class(Application Class ) which calls a service class(Service Class) and closes. The service class takes about 5 seconds to complete its task and calls a method which is present in another class(Callback Class). Now according to the result, the callback needs to notify the Application class.Once i get the callback from the service, I tried calling a method defined in the Application class. In this method i create a new intent of Application class and call startActivity(Application Class). But this is not working. Can anyone tell where i am going wrong and what can I do to solve this issue.

View 5 Replies View Related

Android :: Starting An Activity From Broadcast Receiver

May 28, 2010

I am trying to launch the Main Activity from a broadcast receiver. Can anyone guide me as to how I can do it? I always get "Process is Bad" message.

View 1 Replies View Related

Android :: Starting Activity From Service / Receiver?

Oct 27, 2009

I have a service that sometimes starts applications.The problem is: if the *previous app* (any app) was recently exited via the home key, then the following message appears in the log:ActivityManager: Activity start request from 10024 stopped.And there's then around a 5 second delay before the target app (any) is launched.If the previous app was exited with the back key, there's no problem.If the previous app exited more than a few second ago, no problem.The same also occurs with a broadcast receiver (which also requires the NEW_TASK intent flag to launch an activity).I don't know if the delay was there in 1.5, but I'm assuming not since I can't find the error message in the 1.5 source code.

View 5 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved