Python

How to get Class attributes order

Before python 3.6 it was difficult to get attributes order from a class. Let’s say, for instance, you want to create a listing class which contains columns to display :

With python 2.7 you will get :

With python 3.5 you will get :

And finally, with python 3.6, there is no problem any more : attributes…

Continue Reading

Python

How to dynamically create a class with some mixins

Let’s say you want to create a class that includes mixins having names that are known at execution time only, you would do some thing like this :

To get mixins_classes, juste use importlib to get mixins classes from names. A function that would create an instance of such a dynamic class would be something like this :

Continue Reading

Android

Android splash screen

There is 2 ways (at least) to create a splash screen : The first is to create a splash activity displaying a layout and then transfert the user to the main activity. Here the SplashActivity.java :

Note : the splash screen is displayed during 2 seconds (2000 ms) before going to the main activity. You can tune the SPLASH_DURATION…

Continue Reading