Android :: Why OnKeyListener() Not Called
Sep 12, 2010
I defined an EditText-field and I want to be informed when the user edits that fields.
So I thought: simple - I add an OnKeyListener and so I did. But even though the text field gets edited (and even displays the entered/modified text) I don't get any callback, i.e. the LOG-output doesn't show up.
CODE:......
why that callback is never called?
Android is really full of oddities! It seems that almost nothing I touched so far worked immediatly as one would expect. And - believe it or not - I have LOTS of experience with GUIs, esp. in Java (AWT, Swing, SWT, you name it...) But Android is a really tough beast!
View 2 Replies
Dec 28, 2009
I am using onKeyListener to get the onKey events. It works fine with the normal keyboard. But it does not work with soft keyboard. I am only able to get onKey events for numerics and not alphabets. Is there any workaround to solve this?
View 2 Replies
View Related
Jun 9, 2010
Why I can't implement OnKeyListener with parameter View such as on example where parameters are (View v, int keyCode, KeyEvent event) I'm forced to use parameters (DialogInterface dialog, int keyCode, KeyEvent event) but not the View as I want.
View 1 Replies
View Related
May 16, 2009
The green plane is shown on the golden-brown surface but when I press a key nothing happens. I want eventually be able to move the plane pressing 4 different keys + another one for shooting but that's easy if I can just get the thing moving in the first place. When I press a key in the emulator, nothing happens at all.
CODE:............................
View 2 Replies
View Related
Oct 26, 2010
I am running into an issue with the way my asynctasks are executed. Here's the problem code:
firstTask = new background().new FirstTask(context);
if(firstTask.execute().get().toString().equals("1"))
secondTask = new background().new SecondTask(context);
What I'm doing here is creating a new asynctask object, assigning it to firstTask and then executing it. I then want to fire off a separate asynctask when the first one is done and making sure it returns a success value (1 in this case). This works perfectly on Android 2.0 and up. However, I am testing with Android 1.5 and problems start popping up. The code above will run the first asynctask but doInBackground() is never called despite onPreExecute() being called. If I am to execute the first task without the get() method, doInBackground() is called and everything works as expected. Except now I do not have a way to determine if the first task completed successfully so that I can tell the second task to execute. Is it safe to assume that this is a bug with asynctask on Android 1.5? Especially since the API says that the get method has been implemented since API 3. Is there any way to fix this? Or another way to determine that the first task has finished?
View 2 Replies
View Related
Jun 4, 2010
I was reading through app suggestions and someone mentioned an app called mp3 Download that basically functions like limewire, letting you search and download mp3's to your phone. Does anyone know anything about this app and whether it is good or not? Or have suggestions for a similiar app? It had mixed reviews at appbrain and when I searched here it came up with a bunch of other threads.
View 4 Replies
View Related
Sep 22, 2010
I was told by a few friends that the iphone has an app that allows you to hold your phone up to a song that you dont know and it tells you the name.Does android have anything like that?
View 6 Replies
View Related
Oct 20, 2009
I've created a simple android game, based on the Lunar Lander sample, and I'm having a problem with handling key events.When the activity starts, the only keys that onKeyDown or onKeyUp get called for are the dpad up/down/left/right keys.Neither the menu, back, or dpad_center keys trigger onKey methods. However, once I've pushed one of the dpad up/down/left/right buttons, pressing the menu, back, or dpad_center keys do trigger these methods. I'm not getting any errors, or any indication of what's going wrong.It's possible that the focus is set wrong - the activity is started from a button on screen, so it could be in touchscreen mode. If that's the case, shouldn't touching the back button get me in to the right focus mode so that I can catch the event?I'm using the emulator from SDK-1.5r3.I have not been able to try this on a real phone yet.
View 4 Replies
View Related
Aug 27, 2010
I saw it on the market but forgot to install it. It displays the number of remaining minutes, texts and data left for the month if your on a monthly mobile phone plan.
View 2 Replies
View Related
Apr 6, 2010
I'm working on an application which allocates lot of memory and hence I'm bound to get OutOfMemory. I want a way to get notified when system is running short of memory so that I can stop processing further, notify user and release as much memory as possible.
According to official Android documentation there is a callback onLowMemory from the system. I have a class which extends android.app.Application and I have overridden onLowMemory() method. This class has entry in the in the application tag of AndroidManifest. However it never gets called in my case. Do I need to register for this event using AndroidManifest or any other means?
View 9 Replies
View Related
Jan 1, 2010
In one of my applications I programmatically open the context menu when something is clicked in my MapActivity overlay. This works perfectly under 1.x as well as on my 2.0 Milestone. I've used showContextMenuForChild() historically, but openContextMenu() does that same thing.
As expected onCreateContextMenu() is called to build the menu and then onContextItemSelected() is called when something is selected. So far all is well.
The odd thing is that under 1.x the onContextMenuClosed() method is called when I press the back key, but not so under 2.0. This confuses states for my app since I need to know whether menu is shown or not - or maybe there is a way to know this that I have not (yet) figured out...
Is this a deliberate change or should I file it as a bug? Googling comes up pretty dry (stuff that is over a year old).
Anyone with a 2.0.1 Droid that would care to test whether this has already been fixed? (The ETA for Milestone 2.0.1 seems hazy still, but it appears that at least one of my reported bugs has been fixed in 2.0.1 event though it isn't flagged as such.)
View 4 Replies
View Related
Oct 27, 2010
Is there a way to make sure onSurfaceCreated is called only once during startup.
Currently in my app it gets called once with say 800x480 then it gets called a second time with 480x800. I guess this is probably due to a call to setRequestedOrientation in onCreate. Is there any way to make sure the app starts in a particular orientation, to prevent orientation changes, and to have onSurfaceCreated get called only once during start up?
View 3 Replies
View Related
Mar 3, 2009
I have over-loaded the onFocusChanged() in my classes which inherits from LinearLayout.
CODE:...........................
View 4 Replies
View Related
Apr 16, 2010
i use a ScheduledThreadPoolExecutor combined with a ThreadFactory, their all combined should cause an unchaught Exception to be logged so that i can see what happening if any thread is dying in the ThreadPool:
threadPool = new ScheduledThreadPoolExecutor(poolSize, new ThreadFactory());
My ThreadFactory, also sets a UncaughtExceptionHandler :
public Thread newThread(final Runnable r) { final Thread thread = new Thread(r); thread.setUncaughtExceptionHandler(new ThreadLogger()); final int counter = count.getAndIncrement(); final String name = threadName + counter; thread.setName(threadName + counter); if (Logging.isLoggingEnabled()) { Log.d(LOG_TAG, "Thread created :" + name); } return thread; }
The ThreadLogger :................
View 2 Replies
View Related
Mar 7, 2009
I have been struggling to get onLocationChanged called, but I'm not sure it does not. Here're my code
criteria = new Criteria(); criteria.setAccuracy(Criteria.ACCURACY_FINE); criteria.setPowerRequirement(Criteria.POWER_LOW); criteria.setAltitudeRequired(false); criteria.setBearingRequired(false); criteria.setSpeedRequired(false); criteria.setCostAllowed(true);
String locationContext = Context.LOCATION_SERVICE; locationManager = (LocationManager)context.getSystemService (locationContext);
String provider = locationManager.getBestProvider(criteria, true);.................
View 2 Replies
View Related
Jul 5, 2009
Am I right to assume that onSaveInstanceState() is not normally called (which my logging indicates) - but only when the system is forced to kill an Activity. If so, since onPause() does not receive a bundle, what is the best way to save state that should be restored the next time the Activity is created?
View 8 Replies
View Related
Jul 6, 2010
I have a problem with the method "onActivityResult".
I create a new Activity from my main activity:
CODE:.........
The new Activity is ended like this:
CODE:.............
But the Method onActivityResult seem to be not called
CODE:................
View 1 Replies
View Related
Aug 4, 2010
I'm trying to start activity by sweeping across the screen, it works fine for all the other screens, just this screen that doesn't fire the onTouch at all? Would you mind helping me? I've tried debugging it and still have no idea at all. Below are the codes, sorry for not putting snippets only as I thought I might did something wrong elsewhere
I'm also looking for advice on implementing sweeping to change screen. I've read about ViewFlipper and I know it will work very well, but I've around 8 screens with different backend coding needed.
CODE:.....................
View 1 Replies
View Related
Sep 20, 2010
I want to know the context in which getContentResolver() is called ?
I have a scenario like this : I have an activity A that calls a method myFunc() of class B whcih is not an activity. So, in class B I have to use getContentResolver(). I directly called getContentResolver(). It was showing error. Then I called myFunc(Acitivy act) from the activity and called act.getContentResolver() which solved my problem. My question is is this the only way to call getContentResolver(), which means it can be used in context with activity or can be used alone.
View 1 Replies
View Related
Jan 11, 2010
i've tried displaying a simple list in ListActivity, it is working fine but the problem i got is with the listener.. when i click on any of the list item using the mouse onListItemClick() is not being called, strangely it is working fine with the key-up&key-down keys...................
View 2 Replies
View Related
Jul 16, 2010
I have a ListActivty and I overload the onListItemClick(ListView listView, View view, int position, long id) in my List Activity. My question is why onListItemClick() not getting called back (i have breakpoint in my debugger) when I have an ImageButton in my list item view (the one view created by my list adaptor from cursor)?
View 1 Replies
View Related
Dec 3, 2009
I need be able to tell if Activity.onStop() was called because my application is moving to a new activity, or if it was closed because the user pressed the "Home" key or hit the back button from the bottom of the activity stack.The reason is because I need to know when it is appropriate to shut off music that is playing in my application (A game). There is nothing more annoying than hitting home and having something playing music in the background.However, Activity.OnStop() is called for each activity change, and I don't want to suspend music when moving between multiple activities in my app. I just can't find a way to differentiate between going home and going to a internal activity.Am I perhaps hooking into the wrong events?
View 3 Replies
View Related
Jun 20, 2010
I am trying to override the behavior of a TabActivity that has other Activities as children. I have made all of the children activities return false in onKeyDown so that the key will propagate through to the parent.However, this is not the case.The only key that is being recognized is the search key.Back, menu, and home are not being overridden.
View 6 Replies
View Related
Sep 22, 2010
I'm getting this error ( in the end of this post) which I guess I understand it's because I'm calling something after releasing it.. but I can't find a wy to work it around.I've tried all combinations.. I've tried: mCamera.setPreviewCallback(null); This class, where the surfaceview is implemented can be accessed by 2 different classes one that doesnt implement surfaceview and other that does the error just shows me when I go from the activity that uses the camera to the activity that also uses camera.I don't know what else to do.
View 4 Replies
View Related
Jul 2, 2010
Is the onUpgrade method of SQLiteOpenHelper ever called? If so, when is it called and by what? Or if it is not called by developers, then why is it there? What should be done in the method I have seen examples where it drops all the tables, but then a comment says that dropping all the tables is NOT what you should do.
View 1 Replies
View Related
Sep 1, 2010
I am new to Android development and have been following the tutorials available on the Android website. I am currently on the section of tutorials for Views, specifically the one for Grid Views: Hello, Grid View Tutorial.I am having trouble understanding how views are made through an adapter. I understand that you must override the getView() method in your adapter class and in this method is where you define how your Views are set up. What I don't understand is where does getView() actually get called? Perhaps I've got the wrong kind of mentality here, but in the code below (the Grid View tutorial) I don't see any calls to getView() (or any other things used in the adapter class such as getCount()).
View 1 Replies
View Related
Jun 2, 2010
I read around and I saw that people do not like it when "uneducated" people call their android powered device a droid.
View 14 Replies
View Related
Dec 31, 2009
Could someone please shed the light as to where onItemClick() function gets called as callback when I click on the item of a ListView?
In core/java/android/widget/AdapterView.java:
onItemClick() belongs to the interface OnItemClickListener of AdapterView.
The listener is set through setOnItemClickListener() of AdapterView.
The listener is only invoked in performItemClick() of AdapterView.
The listener is also invoked indirectly in performItemClick() of ListView.
But, I still don't know where exactly onItemClick() of the listener will get called when I click on the item of a ListView. Logically it should be like:
device -> kernel driver -> dalvik VM -> my app.
Could someone please tell me the exact code that calls onItemClick() when I click on the item through the device?
In this digital era, where computing technology is pervasive, your freedom depends on the software controlling those computing devices.
Join free software movement today! It is free as in freedom, not as in free beer!
Join: http://www.fsf.org/jf?referrer=4445
View 5 Replies
View Related
Jun 11, 2010
The documentation describes the class as a helper object to create, open, and/or manage a database. Having that in mind wouldn't you say that the name is a little misleading?
View 2 Replies
View Related
Oct 16, 2010
In my Android application, I overload the Application class, and I updated the tag in my manifest. This application also creates an Android Service. I have put some logs in the onCreate of my Application class, and I see it being called twice. The first time is when my application gets launched (this is expected) and then, it's usually right after the Service is being created. the log also shows that a second instance of the Application is being created. (I print the "this" value and they are different). I thought the Application would be created as a singleton. Is that happening because I create a Service?
View 3 Replies
View Related