I\'m inheriting from BaseActivity
for all the other activities.
public class BaseActivity extends AppCompatActivity {
public static Coordinator
Make a public
method in a Util class
and dont make the cordinatorLayout
as public static
. Keep the weakReference
of your Activity's
instance and through that you can show the SnackBar
.
Method given below.
public void showSnackBar(Activity activity, String message){
View rootView = activity.getWindow().getDecorView().findViewById(android.R.id.content);
Snackbar.make(rootView, message, duration).show();
}