Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
Improve this question
In my Activity, I use imageView.setImageResource(R.drawable.image_name); about 8 times for different views.
I kept opening and closing the activity repeatedly and I notice the app is getting laggy. I am wondering if this is related to memory leak? Is it because of that piece of code?
You should recycle() all your bitmaps when done using them. If you want to destroy them when activity is finish()ed, you can override onDestroy to destroy all bitmaps
Related
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 5 years ago.
Improve this question
I made a simple profile in my android app and after uploading image to firebase storage my app is lagging in speed, the image uploaded is in KBs size and in my profile I am using a Navigation Drawer whose sliding animation is also hanging. I am unable to figure out whats going wrong.
Maybe your are using the Main thread for doing all the job. This is one reason for UI thread to hang(i.e) the app didn't hang but it waits for the main UI thread to complete its work.
Generally, the app hangs for this reason. As suggested by Commonsware track methods. Also, try using background threads instead of main thread.
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 6 years ago.
Improve this question
I have dynamically created a qml page.
I used a JS file to create it.
Then I have tried to destroy the created object.
But I have observed that the amount of memory always increases instead of decreasing after the destroy call.
First of all, Qt doesn't guarantee that Item will be removed instantly. You should expect real deletion later.
How did you observe it? Did you look at virtual memory or physical memory? Do you understand this? And can you provide example?
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
I am using Sugar ORM in my application.
There are insertion and deletion in almost every server call of each activity.
I am getting IllegalStateException when I switch the activities or fragments.
The reason behind this exception is: I am performing multiple save() or read() operations at the same time.
I am working to avoid multiple accesses at same time to avoid this issue, but not getting any success.
Please suggest me a good approach to avoid this issue.
Try using the 1.3 beta version. That fixed it for me.
https://github.com/satyan/sugar/tree/master/dist
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 9 years ago.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Questions must demonstrate a minimal understanding of the problem being solved. Tell us what you've tried to do, why it didn't work, and how it should work. See also: Stack Overflow question checklist
Improve this question
I am using a separate class as adapter for my list view that extends Base adapter.My question is how can I release the memory used by objects like arraylist in the adapter. Please help me.
The garbage collector should take care of freeing memory you are no longer using.
OnDestroy is meant for Activities, it's not something you need to manually call. Rather, it's something that is automatically called when an Activity is about to be destroyed
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I am now trying to improve my programming skills and specially I would like to now how you debug those situations where the app lags a bit. I tried to move most of the critical parts to threads but still I get some ANR. I guess my app is leaking memory somewhere.
So, how to debug this?
I think you should spend some time reading this http://developer.android.com/reference/android/os/StrictMode.html
From Strict Mode reference page:
StrictMode is most commonly used to
catch accidental disk or network
access on the application's main
thread, where UI operations are
received and animations take place.
Keeping disk and network operations
off the main thread makes for much
smoother, more responsive
applications. By keeping your
application's main thread responsive,
you also prevent ANR dialogs from
being shown to users.
Take a look at Traceview
It's now even included in the eclipse android dev tools plugin.