android-memory

Layout Memory leak?

◇◆丶佛笑我妖孽 提交于 2019-12-11 05:55:52
问题 i am a junior android developer. For android UI design, i think most of android developer will use XML for layout design. Today, my senior developer said that he does not use XML for layout design. All UI design use code to generate. The reason he said is that the layout resource is not released by Android automatically.Using JNI release the layout resource . He does not tell you in detail because he think i am very junior. I want to ask whether he is true or not. I have no idea for his point

Android app reason of large RAM usage and how to reduce

眉间皱痕 提交于 2019-12-11 04:38:41
问题 When I launch and exit my app several times its RAM usage increases reaching over 500 mb. When I checked memory dump using adb shell dumpsys meminfo I checked unknown pss value is cause of problem. What is reason of large pss value and how I can reduce pss value. Shared Private Heap Heap Heap Pss Dirty Dirty Size Alloc Free ------ ------ ------ ------ ------ ------ Native 0 0 0 534460 531827 1604 Dalvik 51013 17868 50664 90480 82266 8214 Cursor 0 0 0 Ashmem 0 0 0 Other dev 14292 52 14288 .so

is it bad to use public static fields/variables?

断了今生、忘了曾经 提交于 2019-12-11 01:39:35
问题 I started learning about Android Development, and I read about static variables are bad and may leak memory because they are not garbage collectable. I've used some in certain situations, but I am so concerned it may leak memory. Can someone please look at my code below and see if they leak memory or not? MainActivity.java public class MainActivity extends Activity { public static boolean IS_ACTIVITY_OPEN; public static ImageView image; @Override public void onCreate(Bundle savedInstanceState

Creating movie from files by adding track using com.googlecode.mp4parser with with memory limitations?

不想你离开。 提交于 2019-12-10 13:57:06
问题 I have a audio recording in multiple files. I am creating one continues audio file using com.googlecode.mp4parser:isoparser:1.0.2 library. Below is my code : String mediaKey = isAudio ? "soun" : "vide"; List<Movie> listMovies = new ArrayList<>(); for (String filename : sourceFiles) { listMovies.add(MovieCreator.build(filename)); } List<Track> listTracks = new LinkedList<>(); for (Movie movie : listMovies) { for (Track track : movie.getTracks()) { if (track.getHandler().equals(mediaKey)) {

Can I catch out of memory exception in Android in Bitmap allocation for decoding a picture file?

谁说胖子不能爱 提交于 2019-12-10 13:12:08
问题 I tried to put a catch around the picture file decoding, but it fails to catch the out of memory exception, and the app crashes. I know some tricks in decode a picture file, such as subsampling. But I need to zoom in the picture to see details, so I cannot subsample it too much. For some newer devices, it can succeed to allocate a larger memory to avoid the out of memory exception. For some older devices, it cannot. If I can customize my applicaiton for different devices, that would be greate

WebView and GridView into ScrollView, View too large to fit into drawing cache

余生颓废 提交于 2019-12-10 13:09:46
问题 I have a layout memory issue. When I have a large webview it doesn't shows anything and the logcat shows "View too large to fit into drawing cache". The layout is: <ScrollView android:id="@+id/scrollNoticia" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/ficha_curva" android:layout_below="@+id/linea" android:scrollbars="none" > <RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingBottom=

Fragment's reference to mActivity becomes null after orientation change. Ineffective fragment state maintenance

风流意气都作罢 提交于 2019-12-07 10:05:55
问题 My application consists of several fragments. Up until now I've had references to them stored in a custom Application object, but I am beginning to think that I'm doing something wrong. My problems started when I realized that all my fragment's references to mActivity becomes null after an orientation change. So when I call getActivity() after an orientation change, a NullPointerException is thrown. I have checked that my fragment's onAttach() is called before I make the call to getActivity()

Avoiding out of memory error in loading bitmap in listview

柔情痞子 提交于 2019-12-04 21:06:20
I am having an listview and i am loading bitmaps in it from the web .. but now the problem is i am having 1000 item in the listview so, it is causing me out of memory error.. i have used the image caching also.. I think using any one of the below will solve your problem Lazy List Universal ImageLoader try the following code: public class ListFivePictureNameDetailsPassFail extends ListActivity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setListAdapter(new StudentListAdapter(this)); } private class StudentListAdapter extends BaseAdapter {

Android out memory exception in map

亡梦爱人 提交于 2019-12-04 06:16:56
问题 In my Android application I call server request every 10 seconds and update result in map with marker (creating bitmap, my marker has image & text). I use Android map utils library to create bitmap of my layout, this is working fine but my force close after some time with out of memory issue. Note: My marker has image and text like a layout. its updates with dynamic result by every 10 seconds. I have used two major class from the library 1.BubbleDrawable 2.IconGenerator, I have used this two

Android memory leak on textview - LeakCanary (Leak can be ignored)

余生长醉 提交于 2019-12-03 02:59:53
I keep having the following memory leak as displayed by LeakCanary, when I go from my splash screen to the mainactivity. I understand that this is an expected leak due to fault in the Android OS itself, but is there a way I can avoid this (by setting specifics of some TextView somewhere?) D/LeakCanary﹕ * LEAK CAN BE IGNORED. D/LeakCanary﹕ * com.gmspartnersltd.earthmiles.views.ActivitySignUp_ has leaked: D/LeakCanary﹕ * GC ROOT static android.text.TextLine.sCached D/LeakCanary﹕ * references array android.text.TextLine[].[1] D/LeakCanary﹕ * references android.text.TextLine.mCharacterStyleSpanSet