Android :: More Than One Instance Of Application

Apr 9, 2009

Is there a way to prevent the user of opening more than one instance of my application?

For example: User clicks on App and opens it. The user clicks on the home button. (the app is still running in the background) The user clicks on (not the menu button, but the button above it in the homescreen), and then opens the application again. Does it open the same instance, or does it create another one? If it does create another one, how can I prevent it from creating another one, and just opening the existing instance?

Android :: More Than One Instance of Application


Android :: Single Ui Element Instance Across The Application?

Jul 29, 2010

I have created a custom component and i want it to be singleton in my application and i want all actvities my application to have this custom component which is singleton.

View 2 Replies View Related

Android :: Possible To Have A Single Ui Element Instance Across Application

Jul 29, 2010

It doesnt seem possible, all code I've looked at from Google applications repeats the common portions of activity display in all layout files.

View 4 Replies View Related

Android :: Save Instance State Of My Application?

Jan 11, 2010

As a follow on from my question on sharing state between Activities, how can I save the instance state of my Application? Since Application does not extend Activity, there is no onSaveInstanceState method to override.

NB: In advance, this is not a duplicate. Despite its name, How do I save an Android application's state? relates to Activity state

View 1 Replies View Related

Android :: Android - Safe To Create Static Method To Return Application Instance?

Sep 3, 2010

I am thinking to create a static method to return a reference to the application instance. I am not sure if it is safe to assume there is only one instance of the Application in one application. Apparently, the Application class in Android SDK doesn't provide such method to return the instance reference. So I suspect there must be a reason?

View 1 Replies View Related

Android :: 2 Instance Of Same Activityes

Apr 2, 2009

My application has 2 activities. The main activity will create the "child" activity through startActivityForResult((...). When the child activity needs to exit, it calls setResult(..) and finish(). Child activity will start and exit multiple time upon user selection. The activity are start and exit as expected and onAcitivtyResult(..) also got invoked.

However, I found a problem with child activity, when the child activity was created the second time ( Main activity called startActivityForResult(...) upon some user event ), a new instance of child activity was created, but the displayed is the FIRST instance child activity! ( so any state in second instance of child activity was not accessible ). The onKey(...) was always go to first instance of child activity. Make things more interesting, the getInstanceCount () returns 3.

I have checked the code and no where holds the first instance of child activity which should be garbage collected after finish().

View 3 Replies View Related

Android :: Get Instance Of The Activity?

Jul 9, 2010

Is there a way to get an instance of the activity that has called the currently running activity from the intent object that has been passed to it? eg. if A has called B, I would like to retrieve A's instance from the intent in B's onCreate method. As Activity is not Serializable i am not able to pass the instance in the extras bundle.

View 1 Replies View Related

Android :: Launching New Instance?

Sep 7, 2010

I have two activities.A and B. A starts B.Both are running in the screen and both are visible. Say now B is visible.

On a special key press, I want to bring the A to the front and make it active. The problem I am facing is when the special key is pressed, another instance of A is launched and the new instance is brought to the front.

But I want the original A to come to the front. I want to make this change in the framework layer rather than application specific by using the singleInstance theme in the launchMode in AndroidManifest file.

View 5 Replies View Related

Android :: Instance Of Widget Currently On Homescreen?

Jun 24, 2010

Is there a way to know if there is an instance of your widget currently on the homescreen? I always end up using variables that change state with onUpdate() and onDeleted() calls, but that obviously that isn't effective in every scenario.

View 9 Replies View Related

Android :: Display Calendar Instance

Nov 22, 2010

I have referred the example given on: , But it is not showing the exact DatePicker dialog as given in the book example, what i should do to display the same dialog box or Calendar instance in my application ?

View 4 Replies View Related

Android :: Identify Among Various Service Instance

Nov 6, 2009

Im creating a mail application, where i need to start a service instance for every account, which will check for the new mails for that account. Now my problem is that i want to identify how my service i have created so far (by calling startService()). And also i want to stop a specific instance of service. I know that calling stopService() will stop all the instances of that service. Is there any work around to it.

View 2 Replies View Related

Android :: Get File Path From URI Instance

Nov 17, 2009

I am trying to do the following.

I have an Image viewer where in the user picks an Image from within the gallery. The uri to that selected Image is available to me. Now, I want to use this URI information and send it as a file over a socket using FileInputStream. Is this a valid syntax to perform the above action?


View 10 Replies View Related

Android :: Recover An Instance Of An Activity

May 9, 2010

I have a bunch of tab activities (which I implemented myself, didn't want to use the tabviews with activities inside them), so It's basically 5 activities calling each other every time the user clicks on the tabs displayed as a row of LinearLayouts at the bottom of the screen.

The thing is that the way I do it now, everytime the user jumps from one activity to another, a new activity is created and launched. Of course, I can see I'm wasting resources this way. So what I would like to do is to create every activity only once; and then if the user wants to go back to the previous (or any one that was already created and is probably paused) just check on some kind of list or array to see if the activity can be recovered and only in the case it can't; to lauch a new one.

My question is, how can I check this? should I save the intents? and how to recover the activities afterwards? I'm kind of new with java.

View 2 Replies View Related

Android :: Obtain An Instance Of ServiceState

Jun 26, 2010

I'm trying to obtain an instance of ServiceState in my Activity. But how am i supposed to do this? There is no static method to obtain an instance or any method on any service that returns an ServiceState instance.
There is the TelephonyManager.listen() call. But i want to get the ServiceState instance when i want, not when android calls my listener because something changed.

The documentation of ServiceState can be found here:

View 2 Replies View Related

Android :: Get Instance Of The Launched Activity

Jul 19, 2010

Is there any way to get the instance of a launched activity(or any view in that activity )of a application in another application.

View 1 Replies View Related

Android :: How Finish An Activity In This Instance

Aug 16, 2010

We all know that hitting the back button on the device doesn't kill the application, it merely finishes (destroys) the activity running on the foreground.

Well I have come across some code which helps me capture the back button signal so that I cannot exit the application. The only way to exit it in such cases is to press the home key.

Now this situation presents me with a unique disadvantage! The inability to kill finish the application on a time of my own choosing allows the application to keep running in the background like nothing has changed.

So in such cases is the task manager my only friend or is there a way for me to otherwise kill this application?

View 2 Replies View Related

Android :: Restore Instance State

Aug 24, 2010

I need to save some state when the user leaves my game during game play. Saving the state doesn't seem to be an issue, but I can't figure out how to restore it. The onCreate function isn't called when the Activity is resumed (only when it is first created), so I can't get my state back there. Logically, I would use onRestoreInstanceState, but it isn't being called.


I see log output from onSaveInstanceState, onResume, onCreate, etc, but I never see a log message from onRestoreInstanceState and savedState is always null. Why isn't onRestoreInstanceState being called, and is there another way to get my state back?

View 1 Replies View Related

Android :: Create Only One Instance Of Service

Sep 11, 2010

How can I make sure that only one instance of Service is created?

I have checked some functions with logging (WeatherService is the class who extends Service):


It gives different hash codes even when I am sure that the same function is running twice (downloading):


I am binding a Activity to the service with:


And the service can run for minutes until it is completed, therefore the service can be binded to/created by many Activities.

View 1 Replies View Related

Android :: MediaPlayer - Only One Instance At Any Given Time?

Jun 28, 2010

I have a audio player app, where there is a Main activity that shows 3 audio sample urls. On click on one, it goes to a Details Activity, which has a play and pause button, to start and pause the audio.

My problem is that, when I start the Main activity, and say click on audio 1, I hit play on Details activity. This starts the MediaPlayer and the audio starts to play. When I go back to the Main activity, the audio is still playing, which is what I want. Now, when I click on audio 1 again, and go to Details Activity and hit play again, there seems to be a new MediaPlayer starting the audio. So I have 2 tracks playing together!

Is there a way I can have only one MediaPlayer instance at any given time?

View 1 Replies View Related

Android :: Get An Instance From A Service Running?

Feb 16, 2010

I have a service running in background. I start it from an Activity, but i want to recovery an instance of that service from other activity (in the same app) in order to call one method.

View 1 Replies View Related

Android :: How To Get Local Service Instance

Jun 11, 2010

I'm starting a service in my application using startService.

I do not want to use bindService as I want to handle the service life time myself.

How can I get an instance to the service started if I do not use bindService? I want to be able to get a handler I've created in the service class to post messages from the activity.

View 1 Replies View Related

Android :: Way To Have Instance Specific Preferences

Mar 8, 2010

I am creating a simple Android widget with a typical usecase of having many instances of it running at once.

Using the stock preferencesmanager, it seems each instance of the widget shares the same preferences.

Is there any way to not have this happen?

View 1 Replies View Related

Android :: How To Set Abstract Class Object As An Instance Of Another One?

Jul 8, 2010

I have Class in having an abstract class object as a field in JAVA layer. I want to set this field From Native code C++. I am Trying to use SetObjectField() to set, but it does not work out. Does anyone try this before or know who to do it please shed some light on it.

View 2 Replies View Related

Android :: Get Absolute File Path From URI Instance

Sep 2, 2009

I need to get the absolute path of the file associated with a specific instance. I know how to get the URI instance based on the file instance (with Uri.fromFile(file)) and i need the inverse action.

View 4 Replies View Related

Android :: Multiple Instance - Set Priority For Applications?

Jul 4, 2010

I have few question in application side. Questions are below 1. Can LMK (Low Memory Killer) kill service ? 2. Can I open multiple instance of same applications ? 3. Can I set the priority for the application? 4. LMK kills application(process) or one activity(suppose in application 4 activity). If it can kill activity then how activity stack handling this.

View 3 Replies View Related

Android :: How To Save A Bitmap Instance To A Bmp File?

Jun 27, 2009

How can i save a Bitmap instance to a *.bmp file?Anyone knows? Is it strange that we can only save a bitmap instance to a png or jpg file?

View 7 Replies View Related

Motorola :: Class Instance Sizes In Android

Aug 9, 2010

I'm currently implementing some image processing code for Android. I'm aware of the memory limits and am happy to code within them. However, I cannot find any documentation that lets me work out how many bytes are used for each instance of a given class that I might want to instantiate (on the heap). I'm an experienced C++ programmer and so am relatively competent at working out such struct/class sizing issues for my C++ code (taking into account processor data path width, platform alignment issues etc). I know that Java in general is at a higher level of abstraction and so that I may not be able to guarantee particular memory usage for a general Java VM. However given that android is running on a different VM, and given that developers are strongly memory constrained: I'm assuming that there may be a relatively deterministic set of rules for working out how big a given object instance will be, given knowledge of the members.

View 2 Replies View Related

Android :: Strange Instance Of App Not Responding Error

Aug 31, 2010

A customer just notified me that she's experiencing the infamous "app not responding / wait, force close" message during a specific operation. By just waiting enough, the app resumes ok. Now, that specific operation is indeed long and in fact it has been programmed in a background thread, with a progress dialog signaling the wait. I can't reproduce the problem on my development phone - I suppose because it's perhaps faster than the phone of the user. But I can't reproduce the problem either with the emulator, which I suppose is slow enough. Generally speaking, I think I could be able to solve this specific problem with the customer giving me the proper feedback. It's the general issue that hassles me. This part of the application is very good covered by tests at different levels, including automated black-box tests with Robotium that drive the UI as the user would do, and even in "stress mode" (repeating the test multiple times). So I supposed to be very safe in that area and I'm disappointed to discover that it was a false sense of safety. What am I possibly missing? Also, is it possible / does make sense to "slow down" a phone during tests? I was thinking of a service running in background just consuming some CPU cycles to make the phone less responsive. Fabrizio Giudici - Java Architect, Project Manager Tidalwave s.a.s. - "We make Java work. Everywhere." - -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.14 (Darwin) Comment: Using GnuPG with Mozilla -

View 3 Replies View Related

Android :: Push New Instance Of Main Activity?

Sep 2, 2010

Is it possible to create/push-onto-stack a new Activity of the same main Activity in an Android application with an argument passed to the Activities constructor? Specifically from a Dialog object...

View 1 Replies View Related

Android :: Save Instance State For Dialogs?

Sep 24, 2009

I wonder what is the right way to implement this? Could anybody advice whether my solution is correct?

Activity is created
User clicks on button and dialog is launched (Dialog, not dialog styled activity)
User opens keyboard
we have onSaveInstanceState called where we save that our dialog was opened and all respective dialog input
we have onRestoreInstanceState and here we check whether dialog was shown, recreate the dialog with respective input.

Is it the right approach? or there is smth. that is done by Android and I am doing some redundant actions.

View 2 Replies View Related

Copyrights 2005-15, All rights reserved