title: Error message: java.lang.IllegalArgumentException
body: <p>I'm new at coding so I might be not very good at explaining. I'm trying to build chat app with Firebase. </p>
  
  <p>Here is my code for Main activity:</p>
  
  <pre><code>Mpackage com.example.otto.myfirstapplication;
  
  import android.content.Intent;
  import android.os.Bundle;
  import android.support.annotation.NonNull;
  import android.support.design.widget.FloatingActionButton;
  import android.support.design.widget.Snackbar;
  import android.support.v7.app.AppCompatActivity;
  import android.view.Menu;
  import android.view.MenuItem;
  import android.view.View;
  import android.widget.EditText;
  import android.widget.ListView;
  import android.widget.RelativeLayout;
  import android.widget.TextView;
  import android.text.format.DateFormat;
  
  import com.firebase.ui.auth.AuthUI;
  import com.firebase.ui.database.FirebaseListAdapter;
  import com.google.android.gms.tasks.OnCompleteListener;
  import com.google.android.gms.tasks.Task;
  import com.google.firebase.auth.FirebaseAuth;
  import com.google.firebase.database.FirebaseDatabase;
  
  
  public class MainActivity extends AppCompatActivity {
  
  private static int SIGN_IN_REQUEST_CODE = 1;
  private FirebaseListAdapter&lt;ChatClass&gt; adapter;
  RelativeLayout activity_main;
  FloatingActionButton fab;
  
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
      if(item.getItemId() == R.id.menu_sign_out)
      {
           AuthUI.getInstance().signOut(this).addOnCompleteListener(new         OnCompleteListener&lt;Void&gt;() {
               @Override
               public void onComplete(@NonNull Task&lt;Void&gt; task) {
                   Snackbar.make(activity_main,"You have been signed out.", Snackbar.LENGTH_SHORT).show();
                   finish();
               }
           });
      }
      return true;
  }
  
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
      getMenuInflater().inflate(R.menu.main_menu,menu);
      return true;
  }
  
  @Override
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
      super.onActivityResult(requestCode, resultCode, data);
      if(requestCode == SIGN_IN_REQUEST_CODE)
      {
          if(resultCode == RESULT_OK)
          {
  
              Snackbar.make(activity_main,"Successfully sighned in.Welcome!", Snackbar.LENGTH_SHORT).show();
              displayChatMessage();
  
          }
          else{
              Snackbar.make(activity_main,"Error 1", Snackbar.LENGTH_SHORT).show();
              finish();
          }
  
      }
  }
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
  
  
  
      fab = (FloatingActionButton)findViewById(R.id.fab);
      fab.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View view) {
              EditText input = (EditText)findViewById(R.id.input);
              FirebaseDatabase.getInstance().getReference().push().setValue(new ChatClass(input.getText().toString(),FirebaseAuth.getInstance().getCurrentUser().getEmail()));
              input.setText("");
  
          }
      });
      if(FirebaseAuth.getInstance().getCurrentUser() == null)
      {
          startActivityForResult(AuthUI.getInstance().createSignInIntentBuilder().build(),SIGN_IN_REQUEST_CODE);
      }
      else
      {
          Snackbar.make(activity_main,"Welcome " +FirebaseAuth.getInstance().getCurrentUser().getEmail(),Snackbar.LENGTH_SHORT).show();
      }
      displayChatMessage();
  }
  
  private void displayChatMessage() {
      ListView listOfMessage = (ListView)findViewById(R.id.list_of_message);
      adapter = new FirebaseListAdapter&lt;ChatClass&gt;(this,ChatClass.class,R.layout.list_item,FirebaseDatabase.getInstance().getReference()) {
  
  
  
          @Override
          protected void populateView(View v, ChatClass model, int position) {
              TextView messageText,messageUser,messageTime;
              messageText = (TextView)findViewById(R.id.message_text);
              messageUser = (TextView)findViewById(R.id.message_user);
              messageTime = (TextView)findViewById(R.id.message_time);
  
              messageText.setText(model.getMessageText());
              messageUser.setText(model.getMessageUser());
              messageTime.setText(DateFormat.format("dd-mm-yy (HH:mm:ss)",model.getMessageTime()));
          }
      };
      listOfMessage.setAdapter(adapter);
  }
  }
  </code></pre>
  
  <p>And code for acitivty_main.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:app="http://schemas.android.com/apk/res-auto"
  xmlns:tools="http://schemas.android.com/tools"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  tools:context=".MainActivity"&gt;
  
  
  &lt;android.support.design.widget.FloatingActionButton
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:clickable="true"
      android:src="@drawable/c_send"
      android:id="@+id/fab"
      android:tint="@android:color/white"
      android:layout_alignParentBottom="true"
      android:layout_alignParentLeft="true"
      app:fabSize="mini"
      /&gt;
  &lt;android.support.design.widget.TextInputLayout
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_toLeftOf="@+id/fab"
      android:layout_alignParentBottom="true"
      android:layout_alignParentStart="true"
  
      &gt;
      &lt;EditText
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:hint="Message..."
      android:id="@+id/input"
          /&gt;
  &lt;/android.support.design.widget.TextInputLayout&gt;
  &lt;ListView
      android:id="@+id/list_of_message"
      android:layout_alignParentTop="true"
      android:layout_alignParentStart="true"
      android:layout_above="@+id/fab"
      android:dividerHeight="16dp"
      android:divider="@android:color/transparent"
      android:layout_marginBottom="16dp"
      android:layout_width="match_parent"
      android:layout_height="match_parent"&gt;
  
  &lt;/ListView&gt;
  </code></pre>
  
  <p></p>
  
  <p>Error code from the logcat while app says that it keeps stopping tells me that problem is in the snackbar:</p>
  
  <pre><code> Caused by: java.lang.IllegalArgumentException: No suitable parent found from the given view. Please provide a valid view.
      at android.support.design.widget.Snackbar.make(Snackbar.java:181)
      at com.example.otto.myfirstapplication.MainActivity.onCreate(MainActivity.java:97)
      at android.app.Activity.performCreate(Activity.java:7009)
      at android.app.Activity.performCreate(Activity.java:7000)
      at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214)
  </code></pre>
  
  <p>I updated all dependencies to the latest versions. I was thinking maybe I have to downgrade to solve a problem but I'm not sure. </p>
  
  <p>Anyway I'm super stuck and hope you can help me. Thanks in advance.</p>