How to solve showStatusIcon on inactive InputConnection [duplicate] - android

This question already has an answer here:
Android input connection error
(1 answer)
Closed 7 years ago.
When I close my app I get this message on LogCat
showStatusIcon on inactive InputConnection
I read somewhere, but I'm not sure, that it means that I didn't release something, something related to the memory usage.
How can I solve this problem?

Such problems occur when the input connection in the previous page(or class) has not been closed. Check whether you've closed the input connection in the previous class (by giving connection.close()).
from
Android input connection error

from the documentation
The InputConnection interface is the communication channel from an InputMethod back to the application that is receiving its input. It is used to perform such things as reading text around the cursor, committing text to the text box, and sending raw key events to the application.
In addition, further reading shows
getExtractedText(): This method may fail either if the input connection has become invalid (such as its process crashing) or the client is taking too long to respond with the text (it is given a couple seconds to return). In either case, a null is returned.
It appears to also monitor changes to such text, and alert changes.
To hunt the issue down you'll have to explore any queries you are making, perhaps around listViews or lists in a layout.
If you don't have any views, for example it's happening randomly in the background, then i would suggest that its not a UI element issue, so ignore textfields and such. It could be a background service that's storing information in a cursor or requesting a cursor.
Also, does the issue arise from your app? or perhaps someone else's that you've installed recently. List the full logCat trace. Someone might recognise the issue.
I would hazard a guess that if you haven't written something specific around this that its someone elses log message, or perhaps that of a library your using?

Related

Form submitting missed field value (sometimes!) Android

I started to analyze my form which works fine for the last 3 years and found out that I loose 1% of my form submitions every day. It happens that the forms which submitted on Android(smartphone with resolution 320-450) doesn't pass any hidden or unhidden field values.
I searched the internet. No chances. It happens very rarely and only on smartphones. It was even hard to detect the case. The problem was discovered when I started to log serialized $_REQUEST. When form fails I get empty serialized array.
More info: I can see from my special software (video tracker) that user do fills the form and hits the button "submit".
Any idea or hint will be hightly appreciated.
SOLVED. I changed form "POST" method to "GET" method. Maybe there are some cheap not orginal mobile phones which don't allow/have restriction with post data. Sending data as "GET" solved the problem.
But still, the situation is weird.

Can we explicitly start a system service in Android?

In my android project we are facing an issue -
'When an Edit Text box is focused and appropriate action is taken', the keyboard does not appear up.
This issue occurs like once in 50 times.
We analyzed the issue and found that -
Input Method Service is not running when this issue occurs. (We checked logs) Input Methods Service is used to get instance of Input Manager, which is further used for other things.
I have to do more analysis
So I have two questions -
Could it be a problem related to memory management ? I mean is it possible that the system is killing the service when certain memory situation occurs ?
If the service is killed and not running, can we explicitly start this service through our code in application?
Please Help.

Detect when application is closed

I want to know when the app is closed, because I need to erase a Database when the user shutdown the app, just in the moment when the user close the app is the right moment to erase the SQLite Database, how can I detect this?
This is a flawed design idea, which reflects a misunderstanding of the system - when the process overall dies, it's dead, meaning your code is no longer running.
You can do some tracking and have the last onDestory()'d activity do the cleanup as a courtesy, but don't assume that it will always actually happen (the method is not always called). If having a stale copy is a problem, clean it up on the next run.
That said, you can try using the ndk to provide a handler for process termination signals, but still I wouldn't count on it working in all cases. The limited potential to gain any sound functionality from this would probably not justify the effort unless you are already familiar with the concepts involved.
And do not for a minute mistake cleaning up for a security mechanism, as the file is there while your app is running, and would remain if your app terminated in an unexpected way.
Supposing you don't finish() your main activity, clearing your database inside the onDestroy() method of that activity might be the closest of what you want to accomplish. As has been pointed in the comments, refer to http://developer.android.com/reference/android/app/Activity.html#ActivityLifecycle.

ANR keyDispatchingTimedOut in onPause

I have an app that allows users to input a lot of data while on one particular Activity screen. If the user navigates away from this screen suddenly for any reason, I save their data to the app's SQLite database. This app has been out for nearly 2 years and has never encountered the ANR timeout, but within the last month I've received 2 reports in the market.
In one case the problem occurred when trying to close the database. In the other case, the problem occurred when trying to open the database. I can't reproduce the problem at all, but I see the exact sequence of steps that are executing, but my problem is I don't know what I could possibly change. Both also revolved around securing a mutex for the database I don't create the mutex myself, this is a system thing.
Basically, onPause gets called, the database gets opened, I write the data to the file, and I close the database. As far as I understand it, this is the proper way to do things if your data isn't able to just be stored in SharedPreferences (which my data can not be).
I don't understand why an open or close of a database would take so long, so what are my options here? My only assumption is that these problems are arising from users who have had the app for a very long time, and thus their database files have grown extremely large, and perhaps it makes the system take longer to lock down the database file (I'm just guessing here).
I thought of maybe starting an AsyncTask from onPause, but that seems wrong. Any suggestions?

Why would an android user report "Force quits every time I load"?

I'm trying to guess why a user would report "Force quits every time I load"
The problem does not occur for all users, especially not me.
The system constructs a database when it first loads. I suspect that user's phone does not have enough memory.
Questions:
How can I verify that the system has enough memory to store a small database?
What else might cause a user's particular system to force quit on startup?
Wrong answers or things I've tried thus far:
The user's hardware is probably different than mine
The user's software and available memory is likely different as well
The data is already loading in its own thread, with a progress dialog showing
Add some smarts to your app to send you stack traces when the app crashes in the field. That'll narrow down the specific problem and can help you tailor your efforts to clear it up.
Sounds quite odd, does a freshly booted phone give the same error?
Also ask the user to check available storage, might be out if space.
If the UI thread gets frozen for a period of time, then it will show that dialog. Try running the task in the background using an AsyncTask.
Edit: I'm assuming it's this error message.

Categories

Resources