Android :: Using OnCreate DrawableState

Nov 16, 2010

Leaving aside the lamentable wording of the documentation for this method, it's not really acting as I hoped for an ImageView. I call toggle() from the onClick method of the view but the view system does not redraw my drawable with the checked state. However, if I initialize CHECKED_STATE_SET with android.R.attr.state_checked then the view is draw with the checked state.

So apparently my call to setImageState is not updating the state of the ImageView. The documentation for setImageState is totally blank in the case of an ImageView. What does this mean?

Here's my code:................................

Android :: Using onCreate DrawableState


Android :: OnCreate - Cant Modify

Aug 21, 2009

My prob is the following: My android application has the class TestActivity (entrypoint) -my app uses "library.jar" wich contains J2ME classes, used as library -library.jar also includes "UIActivity" [can spawn several dialogs] wich is called by a (j2me) class of library.jar -I only have the .class files of the j2me-lib stuff, so I cant modify them, but I can do so on Android-classes

so... the short form:

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

finally I get the error:

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

Do I have to use Services instead of Activities? But afaik I have to give a reference of an activity to spawn dialogs.

View 3 Replies View Related

Android :: Can You Explain OnCreate And Bundles?

May 22, 2010

I have been looking it up and I just cant seem to wrap myself around the onCreate and Bundles. I understand that the onCreate is called when the program starts but its how the Bundles get passed around and how they are pertinent. Can anyone try to put this into plain english because I cant seem to find it well described.

View 1 Replies View Related

Android :: OnCreate And Orientation Change

Apr 28, 2010

I have an activity that checks stuffs online when it's created (is the GPS on and if not it asks if the user wants to turn it on).

The problem I'm having is that it is also doing it everytime I change the orientation of the screen.

I've read some comments on onConfigurationChanged() but is there a better way to be sure I'm checking the GPS only when the activity is first created?

View 4 Replies View Related

Android :: Can't Put ProgressDialog In OnClick() Other Than OnCreate()?

Jul 30, 2010

I try to call inside onCreate() it is ok but not onClick(). How to make it work?

View 3 Replies View Related

Android :: OutOfMemory Exception In OnCreate

Oct 2, 2010

I'm having a hard time resolving a crash report. It's an OutOfMemory exception that occurs during the setContentView in the onCreate of my main activity.

I just want to be sure I understood Android LifeCycle well :

1) The onCreate of my main activity is called once and only once during the life time of my application ? Is that correct ?

2) Just like for the big bang, before the oncreate of my activity, nothing exists for that activity, so memory consumption is zero, no objects exists right ?

So what can cause that sometimes, with random framework and devices, I get an OOM exception ? I mean if say my background image is causing this, it should blow up everytime, on every device, shouldn't it ? I mean the result should be reliable.

The background image is a standard jpg : 360*480 weighing 37kb, nothing fancy really :s

The crash report below :

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

View 8 Replies View Related

Android :: Closing An Activity On OnCreate

Nov 11, 2010

I'm opening an Activity using this:

startActivity(new Intent(Parent.this, Child.class)); And on the child, I have this code on the onCreate function (the if contains more than just true, of course): public void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState); if (true) { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setPositiveButton("OK", null); builder.setTitle("Error"); builder.setMessage("Connection error, please try later.") .show(); finishActivity(0); return;}}

Why is the activity not closing? I get the alert box, but then I have to tap the "back" button to go back.

View 2 Replies View Related

Android :: Launching Youtube In OnCreate?

Nov 6, 2009

CODE:.......

Phone was an HTC My Touch. I got the prompt to choose what activity, browser or youtube, chose youtube.

View 2 Replies View Related

Android :: Activity Constructor Vs OnCreate

Jul 21, 2010

I understand that Android Activities have specific lifecycles and that onCreate should be overridden and used for initialization, but what exactly happens in the constructor? Are there any cases when you could/should override the Activity constructor as well, or should you never touch it?

I'm assuming that the constructor should never be used because references to Activities aren't cleaned up entirely (thus hampering the garbage collector) and that onDestroy is there for that purpose. Is this correct?

View 2 Replies View Related

Android :: Callback URL Calling Oncreate

Jul 30, 2010

I am making twitter application in which i open browser for user authentication and i pass call_back URL when launching authentication browser.

Problem is after authenticating it is calling again oncreate of TWitterShare class instead calling onNewIntent method, why is that ? my another class working fine i am unable to find difference any idea by looking at the following ocde why it is calling oncreate again ?

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

View 2 Replies View Related

Android :: Nothing Past OnCreate Is Happening

Aug 23, 2010

I got this class, and nothing inside the onCreate is happening? Does it not automatically get called upon initialization?

Code is below.

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

Doing this results in a "application has stopped unexpectedly. Please try again". If I initialize the string to some set of characters instead of null, it'll just stay that way. Should it not do what is inside the onCreate() and make that change?

View 1 Replies View Related

Android :: Database Activity OnCreate()c

Nov 19, 2010

I know that network activity and expensive operations should not be done on the ui thread, but what about database activity?

I have an activity that, when started, I query an sqlite database and dynamically populate rows in a tablelayout with an inflator. I do this all in the oncreate() method. Should this be done in a separate thread?

View 2 Replies View Related

Android : What Is The Lifetime Of A ContentProvider - After OnCreate

Aug 17, 2010

What is the lifetime of a ContentProvider in Android? After onCreate() is invoked, will the ContentProvider persist unconditionally for the lifetime of the process?

My ContentProvider manages a list of records, but only 1 is designated "active" and will be accessed by different applications a lot. I was wondering if it's safe to cache the index of this active record in memory as a member of my ContentProvider to speed up lookup.

View 1 Replies View Related

Android :: Can't Start MPlayer From OnCreate / Why Is So?

Jul 14, 2010

Why if I start the MPlayer from the onCreate it doesn't start?
I tried also from onStart(), but the only working way was from onTouch or on key press.

Any idea how to start it without any additional user input needed?

View 1 Replies View Related

Android :: Should StartActivity Always Run Started Activities OnCreate?

Aug 10, 2010

I have a main activity and a sub activity.The main activity starts the sub activity using startActivity, and passes an object in the intent.The sub activity reads the object out of the intent in its onCreate action.The sub activity updates the object, then returns to the main activity using startActivity, again passing the updated object back.However, the main activities onCreate function is not called, so the code it contains to read the passed object does not run.Further investigation indicated that the main activity onPause event is firing, i.e. it is only paused when the sub activity runs, so when the sub activity starts the main activity again, it just on Resumes.Does anyone know if there would be any disadvantages if I moved my data restore/store activities to the onResume and onPause events?I'm not using the onCreate saved Instance State, should I be?

View 4 Replies View Related

Android :: Content Provider OnCreate OnDestroy

Jun 30, 2010

when writing a ContentProvider I have to implement the onCreate()-method, in which I establish my database connection. But to write the changes I made to the database I have to close the database on some point. Does something like a onDestroy()-method exist for ContentProviders or is there some intent I have to listen to, which is fired before killing my process?

View 5 Replies View Related

Android :: Oncreate - Intent Launches My Activity

Sep 30, 2010

Android will call onCreate() of my activity whenever it is launched.

In the onCreate() of my activity can I tell what intent launches my activity?

View 1 Replies View Related

Android :: OnResume Is Always Called On TabActivity So OnCreate Is Not Necessary?

Sep 15, 2010

I have a TabActivity with 3 tabs, each tab started an activity and I realise when a tab is clicked onResume is call. If I have onCreate, when app start it will launch onCreate and then onResume immediately.So, I can just get ride of onCreate in this case?

View 2 Replies View Related

Android :: Way To Intent From OnCreate Method In Phone?

May 12, 2010

Maybe my question might seem a bit weird, but I have an activity in which, in one case , I have to move to another activity before it finishes loading the screen. My condition is in the onCreate method, which means when I encounter it, i get a "startActivity called from outside an activity context" error and the app just crashes. But then, is there an easy way like a flag for the intent to make it work without having the activity context resolved?

View 1 Replies View Related

Android :: User-set Locale Always Get Reset After OnCreate

Sep 14, 2010

I want to have a configurable language settings in my app. So, in onCreate of my activity, I call Resources.updateConfiguration with the new locale. However, after onCreate (at some time, I can't find it when), the locale is set back to the default locale.

On the code example below, the strings shown in the main layout (as inflated by setContentView) shows the "in" language version, BUT when I press the menu button, on which onCreateMenu is called, the strings is taken from the "en" (default) locale.

The log shows this:

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

Between "oncreate" and "onmenu", the locale magically changes.

Code snippet:

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

View 3 Replies View Related

Android :: Way To Test OnCreate With Saved Bundle?

Jun 10, 2010

My app launches the camera to allow the user to capture a picture. Sometimes this causes the OS will kill my App to free up memory for the camera. Once the picture is taken, my app starts back up where it left off using the Bundle I saved in onSaveInstanceState(). My app had a bug where in the code that restores the state. Is there anyway that I can simulate or test this case to make sure I am restoring correctly now? It seems I am having trouble making this happen when I want to test it.

View 4 Replies View Related

Android :: How To Do A WebView / ListView In Same Activity OnCreate?

Feb 10, 2010

As you can see, I first create a webview. Then, I want it to immediately disappear. Then, I want the Listview to come up. But the problem is, I can't do Listview if I don't do ListActivity but then I can't do Activity. Code...

View 2 Replies View Related

Android :: Parent And Child Activity OnCreate?

Jul 2, 2010

I have a parent activity, and a child activity that extends the parent activity. When the parent starts the child activity,

Which onCreate gets executed first? The child's or parent's?

There is a particular variable I am setting in the Child activity's onCreate method, and right now, it looks like it takes a while to get to the Child activity's onCreate, and so the methods in the Parent are reporting an empty variable. Whereas when I make the Parent sleep for a while, it reports the correct variable.

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

So, basically, even after the Parent starts the Child, it still returns "Parent Value", but when I have the thread sleep, it return "Child Value".

View 1 Replies View Related

Android :: Start A Service From The ContentProvider.onCreate()?

Feb 7, 2010

My application after an update needs to fill its ContentProvider with some data found on the server.
I found that starting a service from the ContentProvider.onCreate() method works but I'm not sure if it is a good idea or if it works randomly.

I don't know the initialization of an application in android. Are the services always already available before the content provider is created?

View 2 Replies View Related

Android :: Why Is OnCreate Called Twice When Is Device Booting

Jan 18, 2010

I make 'hello world' app :-) and wrote a Log code in onCreate. and then give "android.intent.category.DEFAULT" and "android.intent.category.HOME"

This situation appears emulator(1.5, 2.0, 2.1). but HTC hero(1.5, original htc rom) didn't! it just call one time! Which is normal? and If calling twice is normal, why are they call twice?

View 2 Replies View Related

Android :: Application Lifecycle And OnCreate Method In Sdk

Apr 19, 2010

I slapped together a simple test application that has a button, and makes a noise when the user clicks on it.

Here are it's method:

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

My question is, why is onCreate acting like it's in a while loop? I can click on the button whenever, and it makes the sound. I might think it was just a property of listeners, but the Button object wasn't a member variable. I thought that Android would just go through onCreate onse, and proceed onto the next lifecycle method. Also, I know that my current way of seeing if the sound is playing is crap...I'll get to that later.

View 1 Replies View Related

Android :: OpenOptionsMenu Doesn't Work In OnCreate

May 5, 2010

Is there any other way to call openOptionsMenu after activity is displayed without using something like this:


CODE:.

Reference: http://groups.google.com/group/android beginners/browse_frm/thread/b10a8ea840c07725/1ce48bb147a3ed1a?#1ce48bb147a3ed1a

I would appreciate example like this:

CODE:.......

Now I guess something like Window.Callback.onAttachedToWindow(...) should be done?

View 1 Replies View Related

Android :: Development-cannot Download An Image Outside Of OnCreate

May 18, 2010

I am trying to develop an android application that shows the user the location of atms,hotels etc on a google map....i havent started working on the gps yet.as of now the app works something like this....first of all a map loads on which i intend to show the users current location......on clicking on the menu button there are 3 options.....

-services
-about us
-quit
on selecting services option the following options are available......
-atm
-hospital
-hotel
etc
on selecting the atm option we will be shown a screen displaying some text........
on using the menu for this screen we get the following menu items.....
-sbi
-canara
-hdfc
-icici
etc

My intention is that when the user selects the sbi option a map should load showing the various places where there are sbi atms near where the user is currently............i started out with the google map api but i had to quit because when i select one of the menu options,such as "sbi",the map doesnt load......instead i am getting the error "application failed to load"...basically i was trying to load a map activity from my first map activity......after googling a bit without any results i tried another approach.......i tried to download and view the static map of the location i wanted..it worked.......but when i tried to download
the static map when i select an option like before i get the same error..."application failed to load"...then i tried downloading 2 images from inside onCreate....that worked.......i cannot do the same thing outside the onCreate.....for eg.inside the function for the selected option...

View 1 Replies View Related

Android :: Disappear Keyboard OnCreate Method?

Apr 1, 2010

I have a EditText on simple activity with a button.
when every i move from one activity to this acivity focus is automatically set to EditText and keyboard appears in phone.

i don't want to open keyboard until i click on editText.

can any one guide me what should i do?

View 2 Replies View Related

Android :: Binding To Service In OnCreate() Or In OnResume()

Feb 20, 2010

I want to know what es the best place in an Activity to bind to a service? I saw examples doing it in onResume() and also in onCreate(). I was asking myself if it is not a problem putting it into onCreate(), cause in onPause() i will do a unbind to the service, so i dont get a serviceConnectionLeak, if i leave the activity. Now if i press the Home-Button and then switching to the HomeScreen, the Activity will unbind from the service, when i go back to the Activity from the Taskmanager, then onCreate() will not be called and if the Code is trying to access a function from the service i will get a null-pointer exception. If i bind and unbind only in onResume() and onPause() i dont have this problem.

View 3 Replies View Related







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