title: Android - Binary XML file line #10: Error inflating class <unknown>
body: <p>I am trying to go to another activity but the app crashes with these errors.
  I have 2 activity:</p>
  <ol>
  <li>Acivity Chat</li>
  <li>FriendProfileViewActivity</li>
  </ol>
  <blockquote>
  <p>java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mycompany.newchatapp/com.mycompany.newchatapp.Activities.FriendProfileViewActivity}: android.view.InflateException: Binary XML file line #10: Binary XML file line #10: Error inflating class <br />
  Caused by: android.view.InflateException: Binary XML file line #10: Binary XML file line #10: Error inflating class <br />
  Caused by: android.view.InflateException: Binary XML file line #10: Error inflating class <br />
  Caused by: java.lang.reflect.InvocationTargetException</p>
  </blockquote>
  <p><strong>Here is the XML Code of ChatActivity.</strong></p>
  <pre><code> &lt;com.google.android.material.appbar.AppBarLayout
      android:id=&quot;@+id/appbarlayout&quot;
      android:layout_width=&quot;match_parent&quot;
      android:layout_height=&quot;wrap_content&quot;
      android:layout_marginStart=&quot;-10dp&quot;
      android:layout_marginTop=&quot;-10dp&quot;
      android:layout_marginEnd=&quot;-10dp&quot;
      android:layout_marginBottom=&quot;-10dp&quot;
      android:padding=&quot;5dp&quot;&gt;
  
  
      &lt;androidx.appcompat.widget.Toolbar
          android:id=&quot;@+id/toolbar&quot;
          android:layout_width=&quot;match_parent&quot;
          android:layout_height=&quot;wrap_content&quot;&gt;
  
          &lt;ImageButton
              android:layout_width=&quot;40dp&quot;
              android:layout_height=&quot;50dp&quot;
              android:layout_marginEnd=&quot;10dp&quot;
              android:background=&quot;@android:color/transparent&quot;
              android:src=&quot;@drawable/ic_back&quot;
              android:scaleType=&quot;centerCrop&quot;/&gt;
  
          &lt;RelativeLayout
              android:id=&quot;@+id/viewProfile&quot;
              android:layout_width=&quot;wrap_content&quot;
              android:layout_height=&quot;wrap_content&quot;
              android:gravity=&quot;center_vertical&quot;&gt;
  
              &lt;de.hdodenhof.circleimageview.CircleImageView
                  android:id=&quot;@+id/friendpic&quot;
                  android:layout_width=&quot;70dp&quot;
                  android:layout_height=&quot;70dp&quot;
                  android:layout_alignParentStart=&quot;true&quot;
                  android:layout_marginStart=&quot;-5dp&quot;
                  android:layout_marginEnd=&quot;20dp&quot;
                  android:src=&quot;@drawable/ic_user&quot; /&gt;
  
              &lt;TextView
                  android:id=&quot;@+id/friendname&quot;
                  android:layout_width=&quot;wrap_content&quot;
                  android:layout_height=&quot;wrap_content&quot;
                  android:layout_toEndOf=&quot;@+id/friendpic&quot;
                  android:fontFamily=&quot;@font/alegreya_sc_italic&quot;
                  android:text=&quot;Username&quot;
                  android:textSize=&quot;24sp&quot; /&gt;
  
              &lt;TextView
                  android:id=&quot;@+id/status&quot;
                  android:layout_width=&quot;wrap_content&quot;
                  android:layout_height=&quot;wrap_content&quot;
                  android:layout_below=&quot;@+id/friendname&quot;
                  android:layout_toEndOf=&quot;@+id/friendpic&quot;
                  android:text=&quot;offline&quot;
                  android:textSize=&quot;20sp&quot; /&gt;
          &lt;/RelativeLayout&gt;
      &lt;/androidx.appcompat.widget.Toolbar&gt;
  &lt;/com.google.android.material.appbar.AppBarLayout&gt;
  </code></pre>
  <p><strong>JAVA CODE for Chat</strong></p>
  <pre><code>RelativeLayout relativeLayout;
  relativeLayout = findViewById(R.id.viewProfile);
  relativeLayout.setOnClickListener(v -&gt; {
      Intent intent1 = new Intent(ChatActivity.this, FriendProfileViewActivity.class);
      intent1.putExtra(&quot;friendId&quot;, friendId);
      startActivity(intent1);
      });
  </code></pre>
  <p><strong>XML code for FriendProfileViewActivity XML</strong></p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  &lt;RelativeLayout xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
      xmlns:tools=&quot;http://schemas.android.com/tools&quot;
      android:layout_width=&quot;match_parent&quot;
      android:layout_height=&quot;match_parent&quot;
      android:clipToPadding=&quot;false&quot;
      android:padding=&quot;10dp&quot;
      tools:context=&quot;.Activities.FriendProfileViewActivity&quot;&gt;
  &lt;de.hdodenhof.circleimageview.CircleImageView
      android:id=&quot;@+id/friendProfilePic&quot;
      android:layout_width=&quot;match_parent&quot;
      android:layout_height=&quot;300dp&quot;
      android:layout_marginBottom=&quot;30dp&quot;
      android:scaleType=&quot;fitCenter&quot; /&gt;
  
  &lt;TextView
      android:id=&quot;@+id/friendProfileName&quot;
      android:layout_width=&quot;match_parent&quot;
      android:layout_height=&quot;wrap_content&quot;
      android:layout_below=&quot;@+id/friendProfilePic&quot;
      android:layout_marginBottom=&quot;10dp&quot;
      android:gravity=&quot;center&quot;
      android:text=&quot;Friend Name&quot;
      android:textSize=&quot;28sp&quot;
      android:textStyle=&quot;bold|italic&quot; /&gt;
  
  &lt;View
      android:layout_width=&quot;match_parent&quot;
      android:layout_height=&quot;1dp&quot;
      android:layout_below=&quot;@+id/friendProfileName&quot;
      android:layout_marginStart=&quot;-10dp&quot;
      android:layout_marginEnd=&quot;-10dp&quot;
      android:background=&quot;@android:color/black&quot; /&gt;
  
  &lt;TextView
      android:id=&quot;@+id/about&quot;
      android:layout_width=&quot;wrap_content&quot;
      android:layout_height=&quot;wrap_content&quot;
      android:layout_below=&quot;@+id/friendProfileName&quot;
      android:layout_marginTop=&quot;10dp&quot;
      android:text=&quot;About Me: &quot;
      android:textSize=&quot;24sp&quot;
      android:textStyle=&quot;bold|italic&quot; /&gt;
  
  &lt;TextView
      android:id=&quot;@+id/friendAboutMe&quot;
      android:layout_width=&quot;match_parent&quot;
      android:layout_height=&quot;wrap_content&quot;
      android:layout_below=&quot;@+id/friendProfileName&quot;
      android:layout_marginTop=&quot;10dp&quot;
      android:layout_marginBottom=&quot;10dp&quot;
      android:layout_toEndOf=&quot;@+id/about&quot;
      android:text=&quot;@string/status&quot;
      android:textSize=&quot;26sp&quot;
      android:textStyle=&quot;italic&quot; /&gt;
  
  &lt;View
      android:layout_width=&quot;match_parent&quot;
      android:layout_height=&quot;1dp&quot;
      android:layout_below=&quot;@+id/friendAboutMe&quot;
      android:layout_marginStart=&quot;-10dp&quot;
      android:layout_marginEnd=&quot;-10dp&quot;
      android:background=&quot;@android:color/black&quot; /&gt;
  
  &lt;TextView
      android:id=&quot;@+id/phoneNumber&quot;
      android:layout_width=&quot;wrap_content&quot;
      android:layout_height=&quot;wrap_content&quot;
      android:layout_below=&quot;@+id/friendAboutMe&quot;
      android:layout_marginTop=&quot;10dp&quot;
      android:text=&quot;Phone Number: &quot;
      android:textSize=&quot;24sp&quot;
      android:textStyle=&quot;bold|italic&quot; /&gt;
  
  &lt;TextView
      android:id=&quot;@+id/friendPhoneNumber&quot;
      android:layout_width=&quot;match_parent&quot;
      android:layout_height=&quot;wrap_content&quot;
      android:layout_below=&quot;@+id/friendAboutMe&quot;
      android:layout_marginTop=&quot;10dp&quot;
      android:layout_toEndOf=&quot;@+id/phoneNumber&quot;
      android:text=&quot;@string/fakeNumber&quot;
      android:textSize=&quot;26sp&quot;
      android:textStyle=&quot;italic&quot; /&gt;
  
  &lt;View
      android:layout_width=&quot;match_parent&quot;
      android:layout_height=&quot;1dp&quot;
      android:layout_below=&quot;@+id/friendPhoneNumber&quot;
      android:layout_marginStart=&quot;-10dp&quot;
      android:layout_marginTop=&quot;10dp&quot;
      android:layout_marginEnd=&quot;-10dp&quot;
      android:background=&quot;@android:color/black&quot; /&gt;
  
  &lt;Button
      android:id=&quot;@+id/blockUser&quot;
      android:layout_width=&quot;wrap_content&quot;
      android:layout_height=&quot;wrap_content&quot;
      android:layout_alignParentBottom=&quot;true&quot;
      android:layout_centerHorizontal=&quot;true&quot;
      android:background=&quot;@drawable/button&quot;
      android:text=&quot;Block User&quot;
      android:textColor=&quot;@android:color/white&quot;
      android:textSize=&quot;24sp&quot;
      android:textStyle=&quot;italic&quot; /&gt;
  </code></pre>
  
  <p><strong>JAVA CODE FriendProfileViewActivity</strong></p>
  <pre><code>public class FriendProfileViewActivity extends AppCompatActivity {
  
      TextView name, about, phoneNumber;
      Button blockUser;
      CircleImageView profilepic;
      DatabaseReference databaseReference;
      FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();
      String friendId, friendPhoneNumber;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_friend_profile_view);
  
          profilepic = findViewById(R.id.friendProfilePic);
          name = findViewById(R.id.friendProfileName);
          about = findViewById(R.id.friendAboutMe);
          phoneNumber = findViewById(R.id.friendPhoneNumber);
          blockUser = findViewById(R.id.blockUser);
  
          Intent intent = getIntent();
          friendId = intent.getStringExtra(&quot;friendId&quot;);
  
          databaseReference = FirebaseDatabase.getInstance().getReference(&quot;Users&quot;).child(friendId);
          databaseReference.addValueEventListener(new ValueEventListener() {
              @Override
              public void onDataChange(@NonNull DataSnapshot snapshot) {
                  if (snapshot.exists()) {
                      Users users = snapshot.getValue(Users.class);
                      name.setText(users.getUsername());
                      about.setText(users.getAboutMe());
                      phoneNumber.setText(users.getFullPhoneNumber());
                     // Glide.with(FriendProfileViewActivity.this).load(users.getProfilephotoURL())
                         //     .fitCenter().placeholder(R.drawable.ic_user).into(profilepic);
                      friendPhoneNumber = users.getFullPhoneNumber();
                  }
              }
  
              @Override
              public void onCancelled(@NonNull DatabaseError error) {
  
              }
          });
          blockUser.setOnClickListener(v -&gt; {
              AlertDialog.Builder builder = new AlertDialog.Builder(this);
              builder.setTitle(&quot;Block User&quot;);
              builder.setIcon(R.drawable.ic_block);
              builder.setCancelable(false);
              builder.setMessage(&quot;Do you wan to block User?&quot;);
              builder.setPositiveButton(&quot;Yes&quot;, (dialog, which) -&gt; {
  
                  BlockList blockList = new BlockList(friendPhoneNumber);
                  DatabaseReference blockUser = FirebaseDatabase.getInstance().
                          getReference(&quot;BlockList&quot;).child(user.getUid());
                  blockUser.child(friendId).setValue(blockList);
  
                  BlockList blockList1 = new BlockList(user.getPhoneNumber());
                  blockUser = FirebaseDatabase.getInstance().
                          getReference(&quot;BlockList&quot;).child(friendId);
                  blockUser.child(user.getUid()).setValue(blockList1);
  
                  databaseReference = FirebaseDatabase.getInstance().getReference().child(&quot;ChatsList&quot;)
                          .child(user.getUid());
                  databaseReference.child(friendId).removeValue();
                  DatabaseReference friendChatList = FirebaseDatabase.getInstance().getReference().child(&quot;ChatsList&quot;)
                          .child(friendId);
                  friendChatList.child(user.getUid()).removeValue();
                  Intent intent1 = new Intent(FriendProfileViewActivity.this, MainScreen.class);
                  startActivity(intent1);
  
              });
              builder.setNegativeButton(&quot;Cancel&quot;, (dialog, which) -&gt; dialog.dismiss());
              AlertDialog alertDialog = builder.create();
              alertDialog.show();
          });
      }
  }
  </code></pre>