 <p>Just point to any <code>View</code> inside the <code>Activity's</code> XML. You can give an id to the root viewGroup, for example, and use:</p> <pre><code>@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main_activity); View parentLayout = findViewById(R.id.root_view); Snackbar.make(parentLayout, "This is main activity", Snackbar.LENGTH_LONG) .setAction("CLOSE", new View.OnClickListener() { @Override public void onClick(View view) { } }) .setActionTextColor(getResources().getColor(android.R.color.holo_red_light )) .show(); //Other stuff in OnCreate(); } </code></pre>