Android :: Live Singleton After Ending Activity
Sep 1, 2010
On Wed, Sep 1, 2010 at 1:19 PM, siva <sivaraj.r...@gmail.com> wrote: > I have a singleton in an activity. When I end my application (like > pressing back button), and start it again after some time, the > singleton is not recreated, but is holding previous state. Singleton > is not destroyed if the application is destroyed?
View 4 Replies
Aug 3, 2010
If an Activity is a singleton in practice, I think I can gain some efficiency by declaring appropriate members "static", with zero risk. Yes?
View 4 Replies
View Related
Feb 3, 2010
I have created a small sample Live Wallpaper, and I want to use it with a small test Activity I have also created. However, I cannot seem to find an example of how to do this. The examples I have seen on the Web and in the Android sources all seem to focus on creating the live wallpaper itself, not how to link it to an Activity and display it behind the activity with transparency, etc. So far, all I have is a Live Wallpaper service, with no idea how to go about using it! Does anyone know where I could find _all_ the steps to do this?
View 4 Replies
View Related
Jun 30, 2010
I am making a basic activity to stream this live show http://ice2.securenetsystems.net/WHBRM here is the pastebin of my activity http://pastebin.com/N5g69j7i
I realize that it is better to be in a service but this is just a test. Anyways it seems to be working fine except for in froyo my error listener gets an unknown error about every 10 seconds. Infolistener and bufferinglistener are also never called.
my hack of sorts using the errorlistener to catch the error and restart the stream is working but since the error happens every 10 seconds or so it is making the audio very choppy.
I also get a system log that says MediaPlayer error (1, -2147483648) before each crash also AwesomePlayer Not sending buffering status because duration is unknown.
I assume the second error is because its a live stream and it has no end, however how do you handle that case.
View 3 Replies
View Related
Jun 1, 2010
I'm trying to crop a photo to use in a Live Wallpaper but I'm getting a FileNotFoundException when the crop activity tries to save my new cropped image. This is the code I'm using:
File file = new File(getFilesDir(), "wallpaper.jpg");
Intent intent = new Intent("com.android.camera.action.CROP");
intent.setData(uri);
DisplayMetrics metrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(metrics);
intent.putExtra("outputX", metrics.widthPixels * 2);
intent.putExtra("outputY", metrics.heightPixels);
intent.putExtra("aspectX", metrics.widthPixels * 2);
intent.putExtra("aspectY", metrics.heightPixels);
intent.putExtra("scale", true);
intent.putExtra("noFaceDetection", true);
intent.putExtra("output", Uri.parse("file:/" + file.getAbsolutePath()));
startActivityForResult(intent, REQUEST_CROP_IMAGE);
The wallpaper.jpg file seems to exist on DDMS file explorer so I'm not sure what I'm doing wrong.
View 2 Replies
View Related
Apr 9, 2010
Android has such concept as a Service. It makes sense for interprocess communication. But if I need this service from Activities running in the same process regular singleton seems to be more convenient. No need to register, to bind. Are there any benefits to use service in the same process?
View 17 Replies
View Related
Aug 25, 2010
I'm quite new to Android development. When is it a good idea to create an Android Service instead of just using a simple Singleton class?
Take, for example, the data layer downloading information feeds from the internet. Using a Service seems too much for some cases but sometimes I might need access to a Context so I'm a little unsure about how to design the app.
View 1 Replies
View Related
Oct 10, 2010
I often run into the following dilemma: I need some singleton-like object in my app (typically some central manager-like thing) and this object needs a context for various things. This means that I either have to pass a context to all methods needing one or have some sort of init-pattern to the object. Neither is pretty I think. What is the correct way of doing this? Or is this simply (even the definition of) a Service?
View 15 Replies
View Related
May 3, 2010
I'm considering creating a singleton wrapper for a Context so my model objects, if necessary, can open and read from a database connection. My model objects do not have access to a Context, and I'd like to avoid needing to pass a reference to a Context from object to object.I was planning to place into this singleton a reference to the Context returned by Application.getApplicationContext(). This singleton object would be initialized in my custom Application instance before anything else would need to or have a chance to use it.Can anyone think of a reason to not do this?
View 3 Replies
View Related
Feb 11, 2010
I'd like to know if it's possible to create a Singleton Service throughout an application ? Let's say I'd like to cerate a Service to play some mp3... I'd like it to be a Singleton, we don't want two mp3 tracks playing through each other (well maybe some would want that, but in my case I'm not making a DJ app) :P Also this Service should be somewhat dynamic as in there should be some interface so that I can stop, pauze and play the mp3 file/ stream. Now I have a couple of questions : - is this feasible ? - should I be using a Service or something else ? - how can an interface be set up in between an application and a service so that I can start, stop, pauze stuff ? - can there be something like a Singleton Service?
View 9 Replies
View Related
Mar 23, 2010
I have a singleton class and I am using it to access databases. I would like to know how it would behave if I use the same from my remote service class which runs as a separate process. Will it create a new instance in that process or will it use the instance from the other process?
View 3 Replies
View Related
Aug 17, 2010
I'm adapting Image Downloader from Google Android blog. I want ImageDownloader to be singleton since I'll be using it in multiple places in my application. I want also to be able to manipulate Bitmaps using different Strategies (eg. produce transparent bitmaps).I want to be able to use ImageDownloader in one activity and set transparent bitmaps, and in another use the same ImageDownloader but get black&white bitmaps using different strategy object.
View 5 Replies
View Related
Sep 1, 2010
I have a singleton in an activity. When I end my application (like pressing back button), and start it again after some time, the singleton is not recreated, but is holding previous state. Singleton is not destroyed if the application is destroyed? Do I have to null its static members in onDestroy() to avoid memory leak.
View 1 Replies
View Related
Mar 25, 2009
Can anyone tell me where can I see the active process and current process. I think we can see in the DDMS --> Devices.But when see the process list, when I launch a application it showing that applications process in the list. after finishing that application also it showing it process in the process list.So how can see only the current active prcocess (Foregroud,Background..etc). I want to see only the current process which running on the device/emulator.One more thing. when I hold on the Home button for long time, It is showing a list. What that list means. whether that list is For the forgrund running apps or active apps or that is a History.
View 2 Replies
View Related
Dec 14, 2009
Is the AudioTrack fundamentally designed to be a singleton? Methods on the OnPlaybackPositionUpdateListener receive just one argument, which is the AudioTrack itself. And since the AudioTrack does not have getTag/setTag methods I don't see any way to distinguish among multiple AudioTracks in the OnPlaybackPositionUpdateListener methods short of keeping track of references. So, if it's so why it's not implemented as a singleton? Any thoughts. I am trying to implement concurrent use of the AudioTrack. Anybody has any experience with this approach? Am I wasting time?
View 3 Replies
View Related
Mar 17, 2009
In order to communicate with the server I need a huge global object (class with some hashmaps). all my activities (about 10) need that huge global object. which options do I have? I am thinking about passing the object using intends and about the possibility to make the object a singleton. using the db will be much too slow.
View 3 Replies
View Related
Sep 17, 2010
I have a singleton which stores some prudent information about the user of my application. At the moment, it stores the user's login and the user's location.The location is found via a Service. At the moment, the Service references my singleton directly to stuff the longitude and latitude into it. I would like to use a Broadcast Receiver to send a broadcast that the singleton hears and uses to update the values, instead. However, to register the Broadcast Receiver, I need a Context in my singleton. What is the slickest way to achieve what I'm wanting. Is Broadcast Receiver possibly not the appropriate object? Also, what problems am I looking at with using a singleton? I assume that Android will possibly reclaim this memory at any given time (which would obviously be bad); so how can I prevent that? Would passing in the application's Context and storing it in a member variable thwart this? The Android documentation states: "But, the life cycle of a static is not well under your control; so to abide by the life-cycle model, the application class should initiate and tear down these static objects in the onCreate() and on Terminate() methods of the Application Class," but I'm not entirely sure how to accomplish this.
View 1 Replies
View Related
Mar 25, 2009
I have two services, both of them lies in separate apk, which run in same process. The two service share same jar file by <uses-library> method. The jar file implement a class, say "test", is a singleton. But I found that two instance of test is created under this case, could anybody give me some tips? I want to ensure it's singleton. Code...
View 8 Replies
View Related
Nov 15, 2010
Let me give you the scenario.
Say that my first Activity that loads up, also creates a thread, which will run indefinitely in the background.
Now, if I move to another Activity, I assume that the thread that I initially created in the main activity will continue to run.
So, now to my main question - in order to manage this background thread from other Activities, is it safe to store a reference to that thread in a singleton object?
View 2 Replies
View Related
Sep 28, 2010
I've found lots of great tutorial on starting a thread, however what's the best way to close a thread that's using a SurfaceView in a game loop and set a new view? Could you provide some sample code?
View 5 Replies
View Related
Dec 15, 2009
so the phone does the great thing of recognizing when you're using the phone on a call but if you hold the phone with you shoulder or just not right against your face it activates the screen and you hang up on people. does anyone know how (or if) you can turn that function off so that if you want to activate the screen during a call you have to press a button or physically activate the screen?
View 2 Replies
View Related
Sep 3, 2010
Can I pass a singleton class's object from one activity to another activity using intent? I am using singleton class as image class img = image class.get Instance();, so i need the img instance for another activity, how can i pass an object instance in Android.
View 2 Replies
View Related
Oct 6, 2009
I tried to make an Android program where I can call a single number by clicking button. Works fine but as I end calling, the emulator shows call log. Instead of this I would that my program returns to the screen where is that calling button I made.
View 4 Replies
View Related
May 1, 2012
I am using commitva z71 category phone. (motorola quench xt3 xt502).
I had been using cyanogenmod roms on it. presently i have CM 7.1 EAV 7.2. The roms usually came with ADW launcher as default. But one problem I have been facing is that some times my phone does not respond to press of any button, not even power button after ending a call. The screen however goes off and does not light up.
I have to either remove the battery, replace it and restart or I have to make a call to my phone from another phone. When I give a missed call, the phone gets activated. But when I press Menu button, it brings up the keyboard instead of Menu.
This problem has been persisting whichever version of CM Rom I have been using.
The problem aggravates when I use Go Launcher as my default launcher by using Launcher Switcher. When I use ADW as default lanucher but have Go Launcher also on my phone, sometimes the defaults are cleared and I am asked to choose the launcher to finish the task of closing phone app.
Initially, I thought this was the problem of default phone app. So I tried dialer one from play store, but to no avail.
Is there a way to delete the ADW launcher that comes with the custom ROM?
View 8 Replies
View Related
Nov 24, 2010
It would be nice if StackOverflow had a section where we could post tutorials like mine so that I can answer literally hundreds of questions that have been asked here with a single blow. See... every day I read questions about how to pass complex objects between activities, how to save state so that your app can resume after orientation change, how to update listviews when the data changes, etc, etc. Here is the second part of a tutorial series I posted on my blog... I hope that you actually read it... because I haven't seen any examples like it anywhere... and it has changed how I think about developing for Android across the board. The question is... is there a downside or negative affect of developing like this?
Beyond Smart Lists - How Observable Singletons change the game. Please read through both of these tutorials carefully... I will answer any questions about it here that I can... I really want to know what you think about this and if it might solve issues for you. NOTE TO MODERATORS: there are no advertisements of any kind on my blog.. so don't just close this because you think I am spamming somehow... I am not going to duplicate my post here.
View 1 Replies
View Related
Sep 25, 2010
My phone started doing some weird force closes and just not acting right, so I am trying to do a nand restore. I have done these in the past with no problem, but it is currently restoring and has made about 25 lines of dots in the restore.Normally it will only do 5 or 6 lines of dots before the restore is complete; is this still normal.The screen is getting close to 2/3s covered in dots at this point and it's starting to worry me that it will never end.Should I pull the battery or is that not a good idea while its restoring. Thanks for any advice you may have I'm really stumped on this one.
View 2 Replies
View Related
Oct 3, 2010
So my beloved Incredible has met it's maker thanks to a 10'+ fall from a ladder when I went to answer a call (stupid move, I know). Click image below for larger view.I went in to VZW, made a claim to Asurion and used one of my available upgrades on another line to get a Samsung Fascinate. I must say, the SAMOLED screen doesn't disappoint. The 4" screen size is the sweet spot for sure. The Incredible is better out of the box with Sense, but the Fascinate is better after a few add ons like Launcher Pro, Beautiful widgets and Handcent (which can all be used on the inc, I know).I'll decide if I'm going to keep the Fascinate or the the Inc in a few weeks I guess. (I'll sell the other)
View 24 Replies
View Related
Jun 8, 2010
After I end a call and press home a white screen with htc in green letters pops up and then a grey "loading" box for about 10-15 seconds.
View 6 Replies
View Related
Jul 16, 2010
i noticed that ever since i rooted and using froyo 2.2 ( BB) i am unable to end certain apps, to be specific apps market and internet explorer. i used advance task killer manager, and other task killing apps and they just wont end. i mean its not a big deal, but it gets annoying that everytime i open the browser it brings me back to the page i was last on and not my homepage, or when i launch the market place, im left at the last app i was looking at instead of the main page. was froyo designed like this? cause i know it wasnt like this before i was rooted.
View 3 Replies
View Related
Oct 23, 2010
I just recently bought a windshield mount for my Vibrant.It is hooked up landscape style with my car charger and a AUX cable connected to it. When I try to make a call, it stays on the calling screen for like 2 seconds then ends the call. This keeps happening no matter how many bars I have.
View 2 Replies
View Related