Note: This is a complementary answer to @ramaral.
The notion of being careful of memory leaks is real and very important. However, after reading the two articles I would say that, at the very least, they are wrong.
What do you mean by that the problem is not in the inner classes but in you referencing activities or other disposable objects in objects that persist .
It makes as much sense to blame internal classes as it does to use threads.
Now, it does not matter if it is an inner class or not, static or not, the temptation to reference activity is great and chances are that the developer will eventually pass the reference to the other class somehow. In other words: any object with a reference to Activity can cause the memory leak. It can even be an inner class within a method in another class that accesses the Activity received in the parameter of that method.
In some examples in the articles cited, it is said that the virtual machine does not clean threads. Correct, but that's true in any case. So even the "good" example of the article still presents a memory leak. It may not leak Activity, but it sure dumps threads, because they are never destroyed. This can be as bad as memory over consumption, since the application will have an increasing number of threads doing the same thing at the same time.
So, rather than worrying about the subtleties of the inner classes, the developer should look to clear the allocated resources or at least check that they are no longer allocated.
Regarding the use of internal classes, as others have said, the biggest question is structural, since they are compiled separately from the main classes into .class
individual files.
However, it is interesting that internal classes can access private methods of the main class is vice versa. This is an advantage if you want to keep the encapsulation of some elements.
Anyway, if you are giving visibility to some method or attribute just so that a particular class can access them, you might want to consider using an inner class or another design option.
In Java in general, the use of internal classes is extensive, from the Java code itself to the encouragement to use lambdas in version 8. Those who adhere to functional programming techniques can not be afraid and have seen many renowned softwares making extensive use of internal classes.
Summary: Do not be afraid of inner classes. Even the best developers can not understand or predict all the subtleties that can cause problems in an application or application. But it is imperative, as did the author of the article, that you learn techniques to monitor and diagnose problems and not just trust that everything will be right because you followed the rules X or Y.