Posts

Showing posts with the label android

Difference in-between getContext, getApplicationContext and getBaseContext. And When to use each of them?

What is Context actually? - context is the blueprint of activities and application, it can be used to get information regarding activity and application.  [ more on stackoverflow ] getContext - returns the context view of current or acive Activity. getApplicationContext - returns the context view of all the activities from the entire application. getBaseContext - returns the context view of an Activity to another Activity. to separate or specify those two context in an Activity BaseContext is used. When to use them: getContext - if your method only needs the context of current activity then we use get context. getApplicationContext - if your method if outside of an OnCreateMethod and you want to keep alive the context longer than getContext then you should go for getApplicationContext. getBaseContext - suppose you want to show a alert dialogue in your current activity. but the alert dialogue contain its own context so what to do? then you should go for getBaseContext otherwis...

Does running apps from android studio causes harm to device?

In one word the answer is NO . But it could be if your device ROM is not an official release. Many of us use local phones from different local company, most of them use unofficial release of android OS and their OS structure is not stable. thats why some of us face issues like Wi-Fi not working , Bluetooth not working , Heat issue , Cache memory issue , Auto recovery mode etc. Simply using device to check error logs and verbose loggers to optimize or edit your apps is okay if you don't go for any  OS related modification and voltage modification on your device. Same Question Answer on Stackoverflow Same Qustion Answer on Quora Emon Hossain emondd4@gmail.com