Android :: Saving An Object For Use Later
Jun 12, 2010
As part of my widget, I use an instance of the Camera object.
This is what I want to do. The user will click on my widget, I get an instance of the Camera(if it's not already stored), use it, then store it. If they click the widget again, I want to use that same instance that I used previously.
I can't release the Camera(android.hardware.Camera) until the user clicks on the widget the second time. So the user clicks on the widget the first time, I get the camera and hold on to it until they click the widget again.
The problem I am running into is on the second click, I am trying to get the Camera again, which I can't because I currently have it in use.
View 2 Replies
Sep 9, 2009
I want to do some automated testcase with Instrumentation . Suggest that my AUT has 2 Activity. After clicking the button in ther first Activity, the second one will be shown with new content base on what we enter in the first Activity.) Instrumentation provides us the function called startActivitySync() and return the Activity object for processing. My question is how we can get the pointer of the second Activity after the it is shown by clicking the button on the first activity.?
View 2 Replies
View Related
Jun 8, 2009
I would like to convert a Picture object to Bitmap object in memory, without writing data to disk.
View 2 Replies
View Related
Sep 21, 2009
I have an Activity that running on system. I can get the Intent that is used to start the activity. But i don't know how to get the Activity object from the Intent object or something else. Can anyone tell me how to do this??? Note that, I don't use Instrumentation object.
View 11 Replies
View Related
Feb 18, 2009
I am trying to get a FileInputStream object on an image that the user selects from the picture gallery.
This is the android URI returned by android.provider.MediaStore.Images.Media.INTERNAL_CONTENT_URI content://media/external/images/media/3
When I try to construct a java URI object from this object, I get an IllegalArgumentException with the exception description Expected file scheme in URI: content://media/external/images/media/3 whereas the android URI shows the scheme as content
Never found a solution for the original question. But if you want the byte stream of an image in the pictures gallery, this piece of code will do that.
CODE:...................
View 4 Replies
View Related
Jun 16, 2009
I have a Cursor points to a Contact. How can I get an url built from that Cursor?
I need to know that because from here: http://developer.android.com/guide/topics/providers/content-providers.html
I need to have an url so that I can build a phone uri, like this: phoneUri = Uri.withAppendedPath(uri, People.Phones.CONTENT_DIRECTORY);
and I can query all the phone numbers for that contact.
View 1 Replies
View Related
Jul 19, 2010
I'm confused about the concept of the Context class. I see that it's a base class of Activity, but the Android docs also mentions the Context storing global information about the app environment. So in my app which has 3 activities, does that mean I have 3 distinct Context objects, or do they actually refer to 1 entity? Also, what is the lifetime of a Context object- does it live until the last component of this activity's process is garbage collected?
View 1 Replies
View Related
Feb 5, 2009
I want to get drag event(s) when user holds finger on screen and drags it in any direction. The event need to repeatedly provide new touch position until finger is released in the form of callbacks. This is not related to dragging objects.I could see this drag feature working on home screen of the phone to move the home screen left and right. But couldn't figure out how it works. Please provide information on which class and methods to be referred for this.
View 2 Replies
View Related
May 19, 2010
I want to get the object from the webview how to do it ?
View 3 Replies
View Related
Aug 12, 2010
I have a custom class, which represents my data-structure. This custom class is in a normal Java-library, which is included in both projects. I have one Project with a ContentProvider which provides this data to Activities of other Projects. And an other Project with an Activity, where I want to handle this data in objects of this custom class.
How can I get this data to the Activity? The Cursor [1] only supports primitive Types.
[1] http://developer.android.com/reference/android/database/Cursor.html
View 5 Replies
View Related
Nov 24, 2010
I have a Weather app with four Activities. The main/launcher activity is 'invisible' using...
android:theme="@android:style/Theme.Translucent.NoTitleBar"`
Aand is simply used to do a few checks (whether this is a new install, whether a network connection is available etc) before firing off one of the other Activities. The other Activities are UI-oriented - two simply display weather data pulled from a website and the third to provide a location 'picker' so the user can choose which area to show the weather for.
However, all four activities make use of a WeatherHelper object which basically does everything from checking for available SD card storage to maintaining preferences and pulling/formatting website pages.
So, my question(s)...what is the best way to have one instance of WeatherHelper which can be used by multiple activities and where/how are best to create it in my case?
I've been an OO programmer for a lot of years but I'm very new to Android and the design concepts - I've read a lot on the Android Developers site over the past weeks but I've stalled trying to decide on this.
View 2 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
Jul 19, 2010
What is the lifetime of an app's global android.content.Context object? Does it last until the last component of the app is terminated by the Android runtime?
View 2 Replies
View Related
Jul 1, 2009
I have to get the height of the text for i have specified the text size. is this possible? i need to get the width using the Paint object and without.
View 2 Replies
View Related
Apr 26, 2009
When start the activity i will set the activity object to the Application, and i will registry it in the Appication app = MyApplication.getApplication(this);
1. Start Activity A store A id 0x12345678
2. Activity A -> Activity B
3. Store B id 0x87654321
4. Finish B activity
5. but the Activity B object not null in the Application
View 7 Replies
View Related
Aug 8, 2010
I have an application that queries a server (not under my control). The server returns a serialized object. I have the model for the class - however the problem is that the class is in "default package"... something not recognizable by Android ClassLoader. How can I resolve this issue?
View 1 Replies
View Related
Sep 2, 2010
Does someone know how to save and restore an object to a file on android ?
View 2 Replies
View Related
Aug 3, 2010
All the examples I have found assume that Spinner is given an array of String. I have a Spinner whose Adapter contains an Object more complex than a String. I want the capacity to display some parts of this object. a) during drop down b) when the item is selected. Nothing fancy, just some straight text, but I need ot whole object. If I override Adapter#getView, the View that super#getView returns is a TextView, so I could set that to be some relevant text value, but it feels kind of undocumented. I did try inflating a layout containing 2 TextViews and populating them, but UI became a bit screwed up. I'm not really sure what's ok to change here and what's not. Likewise, the above presumably applies to the drop down view, but I am also not sure how to render the selected item.
View 4 Replies
View Related
Apr 1, 2009
I have created a MemoryFile object in my client application, and how can I get it in my server application? The object is large enough that I can't tranfer it by Intent or aidl interface.
View 2 Replies
View Related
Nov 3, 2010
Object getThisObjName= new Object();
I'd like to get the name of an object reference.
Is this possible via reflection in Android?
View 10 Replies
View Related
Oct 15, 2009
There are several custom-made graphic objects (.png files) included in the project inside res/drawable map.
All elements are normally loaded and displayed in the user interface except two icons and so far haven't figured out what causes the problem.
The code which doesn't affect the user interface as it should is...
In both cases there is only ic_volume_small displayed on the screen and the Variables window in the IDE displays the following:
R.drawable.ic_volume_small = Class not
loaded : net.client.android.R$drawable
R.drawable.ic_volume_of_small = Class
not loaded :
net.client.android.R$drawable
The method (member of IconImage class) which should change the icon image is the following code...
Does anyone know what could cause the described problem?
View 2 Replies
View Related
Oct 11, 2009
I want a application level object in Android.Here is the scenario... Suppose I want to pass a object from Activity A to Activity B then to Activity C D......... Then I will have to pass that object from Activity A to B then to C then to D....... Passing the Parcel Through the Bundle. Is there a Object in Android which can be accessed by all the Activities and its lifetime is same as the lifetime of the application.
View 2 Replies
View Related
Jan 23, 2009
I tried to use AlaramManager . First i used <receiver> in the manifest file but it is not working well. now i want to use registerReceiver (). But can some one please ell me how can i use it. It requires the paramiter IntentFilter and BroadcastReceiver. Can some one please tell me how can i create the object of IntentFilter. I am so much depressed. If i will not get the solution of this then i will have to do susite.
View 3 Replies
View Related
May 21, 2010
Is it possible to create a ColorDrawable object without using xml? I would like to be able to change the backgroundColor of a view programmatically, using setBackgroundColor() or setBackgroundDrawable() or setBackgroundResource(), but I want to be able to specify the RGB values in code, not XML. Is this possible?
View 1 Replies
View Related
Feb 23, 2010
I am trying to get a reference to the android internal class PhoneWindow (android.policy.PhoneWindow) object from an application. I would like to call a method on it (specifically I would like to call getDecorView on PhoneWindow). How do I do this?
View 2 Replies
View Related
Apr 2, 2010
I have a Timer in my application, and would like to allow the user to set the timer, and maybe cancel it in another execution of the application. To do that, I need to have a reference to the Timer created in the first execution. How can I obtain that? Is there a way of storing/retrieving memory addressed?
View 3 Replies
View Related
May 4, 2009
I create a application and the main activity reference by the main.xml. The main.xml has a LinearLayout element. So my code is setContentView (R.layout.main) to show the main window.I need add other element such as Button or EditView, but I don't want add the XML line to the main.xml.I hope use the layout.addView(...) to add the elements to my Activity. So I need get the current LinearLayout object and can invoke the addView function. So How can I get the default layout?
View 3 Replies
View Related
May 25, 2009
Is there someone could tell me how to get the KeguardScreenCallback object in my own Activity(For Example,the class of LockScreen,it has a parameter called "callback" in it's constructor,I want to get the "callback" in my activtity).so I can call the goToUnlcokScreen method to remove the screen lock.Or there maybe other way to do this?(I know KeyguardManager,so except this way first.
View 2 Replies
View Related
Aug 28, 2009
I have an activity which implements an OnItemClickListener.code...
However, I need to pass some objects from MyActivity1 to MyActivity2 --
I see there is an Intent.putExtra() for all the basic types, and I even see a Bundle which is a collection of basic types, but how can I pass a generic "Object" to MyActivity2 ?
View 3 Replies
View Related
May 25, 2010
I need to be able to use one object in multiple activities within my app, and it needs to be the SAME object. What is the best way to do this?
I have tried making the object "public static" so it can be accessed by other activities but for some reason this just isn't cutting it. Are there any other ways of doing this?
View 6 Replies
View Related