Skip to content

Commit

Permalink
Merge pull request #23 from XanthusL/patch-1
Browse files Browse the repository at this point in the history
context  ===>  context.getApplicationContext()
  • Loading branch information
cymcsg authored May 18, 2017
2 parents 6019203 + 0bda2f4 commit 678afdd
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class ToastUtil {
*/
public static void showShort(Context context, CharSequence message) {
if (null == toast) {
toast = Toast.makeText(context, message, Toast.LENGTH_SHORT);
toast = Toast.makeText(context.getApplicationContext(), message, Toast.LENGTH_SHORT);
// toast.setGravity(Gravity.CENTER, 0, 0);
} else {
toast.setText(message);
Expand All @@ -37,7 +37,7 @@ public static void showShort(Context context, CharSequence message) {
*/
public static void showShort(Context context, int message) {
if (null == toast) {
toast = Toast.makeText(context, message, Toast.LENGTH_SHORT);
toast = Toast.makeText(context.getApplicationContext(), message, Toast.LENGTH_SHORT);
// toast.setGravity(Gravity.CENTER, 0, 0);
} else {
toast.setText(message);
Expand All @@ -53,7 +53,7 @@ public static void showShort(Context context, int message) {
*/
public static void showLong(Context context, CharSequence message) {
if (null == toast) {
toast = Toast.makeText(context, message, Toast.LENGTH_LONG);
toast = Toast.makeText(context.getApplicationContext(), message, Toast.LENGTH_LONG);
// toast.setGravity(Gravity.CENTER, 0, 0);
} else {
toast.setText(message);
Expand All @@ -69,7 +69,7 @@ public static void showLong(Context context, CharSequence message) {
*/
public static void showLong(Context context, int message) {
if (null == toast) {
toast = Toast.makeText(context, message, Toast.LENGTH_LONG);
toast = Toast.makeText(context.getApplicationContext(), message, Toast.LENGTH_LONG);
// toast.setGravity(Gravity.CENTER, 0, 0);
} else {
toast.setText(message);
Expand All @@ -86,7 +86,7 @@ public static void showLong(Context context, int message) {
*/
public static void show(Context context, CharSequence message, int duration) {
if (null == toast) {
toast = Toast.makeText(context, message, duration);
toast = Toast.makeText(context.getApplicationContext(), message, duration);
// toast.setGravity(Gravity.CENTER, 0, 0);
} else {
toast.setText(message);
Expand All @@ -108,7 +108,7 @@ public static void show(Context context, CharSequence message) {
*/
public static void show(Context context, int message, int duration) {
if (null == toast) {
toast = Toast.makeText(context, message, duration);
toast = Toast.makeText(context.getApplicationContext(), message, duration);
// toast.setGravity(Gravity.CENTER, 0, 0);
} else {
toast.setText(message);
Expand Down

0 comments on commit 678afdd

Please sign in to comment.