August 13, 2021

How to append or write data into text file in android?

Here is demo for creating text file and append text to that file in JAVA. For this in Android you have to ask for WRITE_EXTERNAL_STORAGE permission. you can check this : if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { if (ContextCompat.checkSelfPermission(getBaseContext(), Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) { requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, WRITE_STORAGE_INT); return; } } Please handle this request in onRequestPermissionsResult.   Finally actual code to write text file in java is :  try{ […]

August 13, 2021

Best practices for Memory management so reduce OutOfMemory crash

Android provides such a huge range of devices with different different configuration. For developer it is necessary to keep in mind that if device with 8GB ram available, then also device with 512MB ram available. To create a good app developer should take care of this. Here you can find general tips for memory optimization which will help you reduce your memory usage : Avoid […]