Diffinitive rules for using Android's getBaseContext, getApplicationContext or using an Activity's "this" -
I did a lot of this question and found several different recommendations when using getBaseContext , getApplicationContext , or an activity of its own this . Three rules that come many times and make a lot of sense - > I have seen so many examples, / p> - Which is the correct and recommended method and why? GetBaseContext () is the method of reference text. And the referendum is, "Implementing the implementation of the context that passes all the calls in only one reference. The subclass can be modified to modify behavior without changing the original context." (According to Jawadox) Therefore it is used to hire calls in any other context.
intent = new intent (getBaseContext (), myClass.class); Contrary to
intention intent = new intent (this, myClass.class);
Comments
Post a Comment