Category: Java

Let's Get The Job Done!

Do you code DRY!

What is DRY principle, and how to achieve that in your android development journey, let’s discuss. DRY stands for “don’t repeat yourself!“. it simply means that you have to never write any piece of code twice otherwise you are really doing it wrong. because when a logic related to that piece of code changes we…
Read more

memory leaks

Android Memory Leaks

Here i’m gonna discuss the memory leak and some causes of this defect in android apps. So what is the “Memory Leak”? Simply the memory leak means that you have allocated a memory to an object but never have the chance to free up that allocated memory. that causes the garbage collector neglect that part…
Read more

Kotlin Object Keyword

In this post we are gonna find out what is the Object keyword in Kotlin and discuss it’s use-cases. in one definition the Object is another way to declare classes but with some differences, the most important difference is that defining an object makes it act like a singleton object, also by defining an object…
Read more

How to Unit Test live Data?

In this article we are going to discuss how we could unit test the Live Data object from googles architectural components. If you have tried to test live Data Object on Android platform you have certainly encountered the error below. java.lang.RuntimeException: Method getMainLooper in android.os.Looper not mocked. See http://g.co/androidstudio/not-mocked for details. at android.os.Looper.getMainLooper(Looper.java) at android.arch.core.executor.DefaultTaskExecutor.isMainThread(DefaultTaskExecutor.java:58)…
Read more

Android OpenCV : how to pass Mat objects between java & c++

Hello friends , in this article i’m gonna discuss a trick that could save a lot of time and energy and also give OpenCV fans so much flexibility working on the android platform. As you may encounter some of OpenCV parts are not ported into java for example the one that i had encountered is…
Read more

How to apply sepia effect on a bitmap

  In this post i’m gonna show you how to apply sepia effect on your bitmap with just a simple method .     Let’s dive into the code : public static Bitmap applySepiaEffect( Bitmap src , int depth , double red , double green , double blue ){ int width = src.getWidth(); int height…
Read more

Some Useful Android Libraries & Tools

Let me show you some android useful lib’s that i found useful to throw in projects. Let’s Name Some Famous One’s First : RxAndroid , Retrofit , OkHttp ,  Picasso ,  Glide , EventBus , Mushi , Timber (Debugging Utility) , Room (ORM) , Dagger (Dependency Injection)  , ButterKnife . But Now I’m Gonna Introduce…
Read more

How To Draw A Custom Shape Into Bitmap

In This Post I’m Gonna Show You How To Draw A Custom Shape Into A Bitmap , What Ever You Want .   public static Bitmap drawCustomShape(Bitmap src , int color ){ int width = src.getWidth() ; int height = src.getHeight() ; Bitmap out = Bitmap.createBitmap(width , height , src.getConfig()) ; Canvas canvas = new…
Read more