android.view.InflateException Binary XML file line #26 Error inflating class EditText












0















I am getting tired fixing this problem. the app does not execute it always show me this error Binary XML file line #26: Error inflating class EditText. I don't understand how to fix this problem.
This is my activity_members.xml



<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
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"
android:orientation="vertical">

<android.support.constraint.ConstraintLayout
android:id="@+id/newMeetScreen"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="visible"
tools:layout_editor_absoluteX="384dp">

<ImageView
android:id="@+id/imageView3"
android:layout_width="0dp"
android:layout_height="54dp"
android:src="@drawable/gradient"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<EditText
android:id="@+id/edit_search"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginStart="11dp"
android:layout_marginTop="7dp"
android:layout_marginEnd="13dp"
android:layout_marginBottom="7dp"
android:background="@drawable/radius_edit_text"
android:drawableLeft="@drawable/ic_search"
android:drawablePadding="3dp"
android:hint="Поиск"
android:imeOptions="actionGo"
android:inputType="text"
android:textColor="@color/colorPrimaryDark"
android:textColorHint="#9b9a9a"
android:textSize="20sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/btnDone"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<ImageButton
android:id="@+id/btnDone"
android:layout_width="52dp"
android:layout_height="50dp"
android:background="@android:drawable/list_selector_background"
android:src="@drawable/ic_done"
android:textColor="@color/colorProjectTextWhite"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/edit_search"
app:layout_constraintTop_toTopOf="parent" />
</android.support.constraint.ConstraintLayout>

<android.support.v7.widget.RecyclerView
android:background="@color/colorBackgroundLight"
android:id="@+id/membersList"
android:scrollbars="vertical"
android:layout_marginTop="0dp"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
</LinearLayout>


And this is my MembersActivity.java class.



public class MembersActivity extends AppCompatActivity {
private static final int REQUEST_CODE_READ_CONTACTS = 1;
private static boolean READ_CONTACTS_GRANTED = false;
RecyclerView members;
ArrayList<String> contacts = new ArrayList<String>();
ArrayList<String> tell = new ArrayList<String>();
UserAdapter adapter;
User user;
ArrayList<User> users = new ArrayList<>();
ImageButton btnDone;
StringBuilder stringBuilder = null;
EditText editSearch;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_members);
members = findViewById(R.id.membersList);
btnDone = findViewById(R.id.btnDone);
editSearch = findViewById(R.id.edit_search);
int hasReadContactPermission = ContextCompat.checkSelfPermission(Objects.requireNonNull(this), Manifest.permission.READ_CONTACTS);
if (hasReadContactPermission == PackageManager.PERMISSION_GRANTED) {
READ_CONTACTS_GRANTED = true;

} else {

ActivityCompat.requestPermissions(Objects.requireNonNull(this), new
String{Manifest.permission.READ_CONTACTS}, REQUEST_CODE_READ_CONTACTS);

}
if (READ_CONTACTS_GRANTED) {
getContacts();
}

btnDone.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
stringBuilder = new StringBuilder();
int i=0;
char ch = ',';
do{
User user = adapter.checkedUsers.get(i);
if(i == adapter.checkedUsers.size()-1) ch = '.';
stringBuilder.append(user.getName() + ch);
if(i != adapter.checkedUsers.size() -1) {
stringBuilder.append("n");
}
i++;

} while (i < adapter.checkedUsers.size());
if(adapter.checkedUsers.size() > 0) {
Intent intent = new Intent();
intent.putExtra("names", stringBuilder.toString());
setResult(RESULT_OK, intent);
finish();


} else {
Toast.makeText(MembersActivity.this, "Пожалуйста, выберите друзей", Toast.LENGTH_LONG).show();

}
}
});
editSearch.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {

}

@Override
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
adapter.getFilter().filter(charSequence);
return;

}

@Override
public void afterTextChanged(Editable editable) {

}
});

}

public void onRequestPermissionsResult(int requestCode, String permissions, int grantResults) {
switch (requestCode) {
case REQUEST_CODE_READ_CONTACTS:
if (grantResults.length > 0 && grantResults[0] ==
PackageManager.PERMISSION_GRANTED) {
READ_CONTACTS_GRANTED = true;

}
}
if (READ_CONTACTS_GRANTED) {
getContacts();
}
else {
Toast.makeText(this, "Требуется установить разрешения", Toast.LENGTH_LONG).show();
}
}

public void getContacts() {
Uri CONTENT_URI = ContactsContract.Contacts.CONTENT_URI;
String _ID = ContactsContract.Contacts._ID;
String DISPLAY_NAME = ContactsContract.Contacts.DISPLAY_NAME;
String HAS_PHONE_NUMBER = ContactsContract.Contacts.HAS_PHONE_NUMBER;

Uri PhoneCONTENT_URI =
ContactsContract.CommonDataKinds.Phone.CONTENT_URI;
String Phone_CONTACT_ID =
ContactsContract.CommonDataKinds.Phone.CONTACT_ID;
String NUMBER = ContactsContract.CommonDataKinds.Phone.NUMBER;

StringBuffer output = new StringBuffer();
ContentResolver contentResolver = Objects.requireNonNull(this).getContentResolver();
Cursor cursor = contentResolver.query(CONTENT_URI, null, null, null, null);

if (cursor.getCount() > 0) {

while (cursor.moveToNext()) {
String contact_id = cursor.getString(cursor.getColumnIndex(_ID));
String name = cursor.getString(cursor.getColumnIndex(DISPLAY_NAME));
int hasPhoneNumber = Integer.parseInt(cursor.getString(cursor.getColumnIndex(HAS_PHONE_NUMBER)));

if (hasPhoneNumber > 0) {
contacts.add(name);

Cursor phoneCursor =
contentResolver.query(PhoneCONTENT_URI, null,
Phone_CONTACT_ID + " = ?", new String{contact_id}, null);
while (phoneCursor.moveToNext()) {
String phoneNumber = phoneCursor.getString(phoneCursor.getColumnIndex(NUMBER));
tell.add(phoneNumber);
}
}
}
}

if(tell.size() > contacts.size()) {
for(int i=0; i <contacts.size(); i++) {
user = new User(tell.get(i), contacts.get(i));
users.add(user);
}
} else {
for(int i=0; i < tell.size(); i++) {
user = new User(tell.get(i), contacts.get(i));
users.add(user);
}
}

RecyclerView.LayoutManager mLayoutManager = new LinearLayoutManager(getApplicationContext());
adapter = new UserAdapter(users, this);
members.setLayoutManager(mLayoutManager);
members.setItemAnimator(new DefaultItemAnimator());
members.addItemDecoration(new DividerItemDecoration(this, LinearLayoutManager.VERTICAL));
members.setAdapter(adapter);
}

@Override
protected void onDestroy() {
super.onDestroy();
}

@Override
public void onBackPressed() {
super.onBackPressed();
}


}


Please, help me fix this problem.










share|improve this question

























  • please post the full stack trace of the exception, it usually contains a "caused by" prior exception showing the reason for the inflate to fail

    – marmor
    Nov 26 '18 at 8:04











  • also, are radius_edit_text and ic_search regular png drawables, or are they xml files?

    – marmor
    Nov 26 '18 at 8:05
















0















I am getting tired fixing this problem. the app does not execute it always show me this error Binary XML file line #26: Error inflating class EditText. I don't understand how to fix this problem.
This is my activity_members.xml



<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
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"
android:orientation="vertical">

<android.support.constraint.ConstraintLayout
android:id="@+id/newMeetScreen"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="visible"
tools:layout_editor_absoluteX="384dp">

<ImageView
android:id="@+id/imageView3"
android:layout_width="0dp"
android:layout_height="54dp"
android:src="@drawable/gradient"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<EditText
android:id="@+id/edit_search"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginStart="11dp"
android:layout_marginTop="7dp"
android:layout_marginEnd="13dp"
android:layout_marginBottom="7dp"
android:background="@drawable/radius_edit_text"
android:drawableLeft="@drawable/ic_search"
android:drawablePadding="3dp"
android:hint="Поиск"
android:imeOptions="actionGo"
android:inputType="text"
android:textColor="@color/colorPrimaryDark"
android:textColorHint="#9b9a9a"
android:textSize="20sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/btnDone"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<ImageButton
android:id="@+id/btnDone"
android:layout_width="52dp"
android:layout_height="50dp"
android:background="@android:drawable/list_selector_background"
android:src="@drawable/ic_done"
android:textColor="@color/colorProjectTextWhite"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/edit_search"
app:layout_constraintTop_toTopOf="parent" />
</android.support.constraint.ConstraintLayout>

<android.support.v7.widget.RecyclerView
android:background="@color/colorBackgroundLight"
android:id="@+id/membersList"
android:scrollbars="vertical"
android:layout_marginTop="0dp"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
</LinearLayout>


And this is my MembersActivity.java class.



public class MembersActivity extends AppCompatActivity {
private static final int REQUEST_CODE_READ_CONTACTS = 1;
private static boolean READ_CONTACTS_GRANTED = false;
RecyclerView members;
ArrayList<String> contacts = new ArrayList<String>();
ArrayList<String> tell = new ArrayList<String>();
UserAdapter adapter;
User user;
ArrayList<User> users = new ArrayList<>();
ImageButton btnDone;
StringBuilder stringBuilder = null;
EditText editSearch;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_members);
members = findViewById(R.id.membersList);
btnDone = findViewById(R.id.btnDone);
editSearch = findViewById(R.id.edit_search);
int hasReadContactPermission = ContextCompat.checkSelfPermission(Objects.requireNonNull(this), Manifest.permission.READ_CONTACTS);
if (hasReadContactPermission == PackageManager.PERMISSION_GRANTED) {
READ_CONTACTS_GRANTED = true;

} else {

ActivityCompat.requestPermissions(Objects.requireNonNull(this), new
String{Manifest.permission.READ_CONTACTS}, REQUEST_CODE_READ_CONTACTS);

}
if (READ_CONTACTS_GRANTED) {
getContacts();
}

btnDone.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
stringBuilder = new StringBuilder();
int i=0;
char ch = ',';
do{
User user = adapter.checkedUsers.get(i);
if(i == adapter.checkedUsers.size()-1) ch = '.';
stringBuilder.append(user.getName() + ch);
if(i != adapter.checkedUsers.size() -1) {
stringBuilder.append("n");
}
i++;

} while (i < adapter.checkedUsers.size());
if(adapter.checkedUsers.size() > 0) {
Intent intent = new Intent();
intent.putExtra("names", stringBuilder.toString());
setResult(RESULT_OK, intent);
finish();


} else {
Toast.makeText(MembersActivity.this, "Пожалуйста, выберите друзей", Toast.LENGTH_LONG).show();

}
}
});
editSearch.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {

}

@Override
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
adapter.getFilter().filter(charSequence);
return;

}

@Override
public void afterTextChanged(Editable editable) {

}
});

}

public void onRequestPermissionsResult(int requestCode, String permissions, int grantResults) {
switch (requestCode) {
case REQUEST_CODE_READ_CONTACTS:
if (grantResults.length > 0 && grantResults[0] ==
PackageManager.PERMISSION_GRANTED) {
READ_CONTACTS_GRANTED = true;

}
}
if (READ_CONTACTS_GRANTED) {
getContacts();
}
else {
Toast.makeText(this, "Требуется установить разрешения", Toast.LENGTH_LONG).show();
}
}

public void getContacts() {
Uri CONTENT_URI = ContactsContract.Contacts.CONTENT_URI;
String _ID = ContactsContract.Contacts._ID;
String DISPLAY_NAME = ContactsContract.Contacts.DISPLAY_NAME;
String HAS_PHONE_NUMBER = ContactsContract.Contacts.HAS_PHONE_NUMBER;

Uri PhoneCONTENT_URI =
ContactsContract.CommonDataKinds.Phone.CONTENT_URI;
String Phone_CONTACT_ID =
ContactsContract.CommonDataKinds.Phone.CONTACT_ID;
String NUMBER = ContactsContract.CommonDataKinds.Phone.NUMBER;

StringBuffer output = new StringBuffer();
ContentResolver contentResolver = Objects.requireNonNull(this).getContentResolver();
Cursor cursor = contentResolver.query(CONTENT_URI, null, null, null, null);

if (cursor.getCount() > 0) {

while (cursor.moveToNext()) {
String contact_id = cursor.getString(cursor.getColumnIndex(_ID));
String name = cursor.getString(cursor.getColumnIndex(DISPLAY_NAME));
int hasPhoneNumber = Integer.parseInt(cursor.getString(cursor.getColumnIndex(HAS_PHONE_NUMBER)));

if (hasPhoneNumber > 0) {
contacts.add(name);

Cursor phoneCursor =
contentResolver.query(PhoneCONTENT_URI, null,
Phone_CONTACT_ID + " = ?", new String{contact_id}, null);
while (phoneCursor.moveToNext()) {
String phoneNumber = phoneCursor.getString(phoneCursor.getColumnIndex(NUMBER));
tell.add(phoneNumber);
}
}
}
}

if(tell.size() > contacts.size()) {
for(int i=0; i <contacts.size(); i++) {
user = new User(tell.get(i), contacts.get(i));
users.add(user);
}
} else {
for(int i=0; i < tell.size(); i++) {
user = new User(tell.get(i), contacts.get(i));
users.add(user);
}
}

RecyclerView.LayoutManager mLayoutManager = new LinearLayoutManager(getApplicationContext());
adapter = new UserAdapter(users, this);
members.setLayoutManager(mLayoutManager);
members.setItemAnimator(new DefaultItemAnimator());
members.addItemDecoration(new DividerItemDecoration(this, LinearLayoutManager.VERTICAL));
members.setAdapter(adapter);
}

@Override
protected void onDestroy() {
super.onDestroy();
}

@Override
public void onBackPressed() {
super.onBackPressed();
}


}


Please, help me fix this problem.










share|improve this question

























  • please post the full stack trace of the exception, it usually contains a "caused by" prior exception showing the reason for the inflate to fail

    – marmor
    Nov 26 '18 at 8:04











  • also, are radius_edit_text and ic_search regular png drawables, or are they xml files?

    – marmor
    Nov 26 '18 at 8:05














0












0








0








I am getting tired fixing this problem. the app does not execute it always show me this error Binary XML file line #26: Error inflating class EditText. I don't understand how to fix this problem.
This is my activity_members.xml



<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
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"
android:orientation="vertical">

<android.support.constraint.ConstraintLayout
android:id="@+id/newMeetScreen"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="visible"
tools:layout_editor_absoluteX="384dp">

<ImageView
android:id="@+id/imageView3"
android:layout_width="0dp"
android:layout_height="54dp"
android:src="@drawable/gradient"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<EditText
android:id="@+id/edit_search"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginStart="11dp"
android:layout_marginTop="7dp"
android:layout_marginEnd="13dp"
android:layout_marginBottom="7dp"
android:background="@drawable/radius_edit_text"
android:drawableLeft="@drawable/ic_search"
android:drawablePadding="3dp"
android:hint="Поиск"
android:imeOptions="actionGo"
android:inputType="text"
android:textColor="@color/colorPrimaryDark"
android:textColorHint="#9b9a9a"
android:textSize="20sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/btnDone"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<ImageButton
android:id="@+id/btnDone"
android:layout_width="52dp"
android:layout_height="50dp"
android:background="@android:drawable/list_selector_background"
android:src="@drawable/ic_done"
android:textColor="@color/colorProjectTextWhite"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/edit_search"
app:layout_constraintTop_toTopOf="parent" />
</android.support.constraint.ConstraintLayout>

<android.support.v7.widget.RecyclerView
android:background="@color/colorBackgroundLight"
android:id="@+id/membersList"
android:scrollbars="vertical"
android:layout_marginTop="0dp"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
</LinearLayout>


And this is my MembersActivity.java class.



public class MembersActivity extends AppCompatActivity {
private static final int REQUEST_CODE_READ_CONTACTS = 1;
private static boolean READ_CONTACTS_GRANTED = false;
RecyclerView members;
ArrayList<String> contacts = new ArrayList<String>();
ArrayList<String> tell = new ArrayList<String>();
UserAdapter adapter;
User user;
ArrayList<User> users = new ArrayList<>();
ImageButton btnDone;
StringBuilder stringBuilder = null;
EditText editSearch;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_members);
members = findViewById(R.id.membersList);
btnDone = findViewById(R.id.btnDone);
editSearch = findViewById(R.id.edit_search);
int hasReadContactPermission = ContextCompat.checkSelfPermission(Objects.requireNonNull(this), Manifest.permission.READ_CONTACTS);
if (hasReadContactPermission == PackageManager.PERMISSION_GRANTED) {
READ_CONTACTS_GRANTED = true;

} else {

ActivityCompat.requestPermissions(Objects.requireNonNull(this), new
String{Manifest.permission.READ_CONTACTS}, REQUEST_CODE_READ_CONTACTS);

}
if (READ_CONTACTS_GRANTED) {
getContacts();
}

btnDone.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
stringBuilder = new StringBuilder();
int i=0;
char ch = ',';
do{
User user = adapter.checkedUsers.get(i);
if(i == adapter.checkedUsers.size()-1) ch = '.';
stringBuilder.append(user.getName() + ch);
if(i != adapter.checkedUsers.size() -1) {
stringBuilder.append("n");
}
i++;

} while (i < adapter.checkedUsers.size());
if(adapter.checkedUsers.size() > 0) {
Intent intent = new Intent();
intent.putExtra("names", stringBuilder.toString());
setResult(RESULT_OK, intent);
finish();


} else {
Toast.makeText(MembersActivity.this, "Пожалуйста, выберите друзей", Toast.LENGTH_LONG).show();

}
}
});
editSearch.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {

}

@Override
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
adapter.getFilter().filter(charSequence);
return;

}

@Override
public void afterTextChanged(Editable editable) {

}
});

}

public void onRequestPermissionsResult(int requestCode, String permissions, int grantResults) {
switch (requestCode) {
case REQUEST_CODE_READ_CONTACTS:
if (grantResults.length > 0 && grantResults[0] ==
PackageManager.PERMISSION_GRANTED) {
READ_CONTACTS_GRANTED = true;

}
}
if (READ_CONTACTS_GRANTED) {
getContacts();
}
else {
Toast.makeText(this, "Требуется установить разрешения", Toast.LENGTH_LONG).show();
}
}

public void getContacts() {
Uri CONTENT_URI = ContactsContract.Contacts.CONTENT_URI;
String _ID = ContactsContract.Contacts._ID;
String DISPLAY_NAME = ContactsContract.Contacts.DISPLAY_NAME;
String HAS_PHONE_NUMBER = ContactsContract.Contacts.HAS_PHONE_NUMBER;

Uri PhoneCONTENT_URI =
ContactsContract.CommonDataKinds.Phone.CONTENT_URI;
String Phone_CONTACT_ID =
ContactsContract.CommonDataKinds.Phone.CONTACT_ID;
String NUMBER = ContactsContract.CommonDataKinds.Phone.NUMBER;

StringBuffer output = new StringBuffer();
ContentResolver contentResolver = Objects.requireNonNull(this).getContentResolver();
Cursor cursor = contentResolver.query(CONTENT_URI, null, null, null, null);

if (cursor.getCount() > 0) {

while (cursor.moveToNext()) {
String contact_id = cursor.getString(cursor.getColumnIndex(_ID));
String name = cursor.getString(cursor.getColumnIndex(DISPLAY_NAME));
int hasPhoneNumber = Integer.parseInt(cursor.getString(cursor.getColumnIndex(HAS_PHONE_NUMBER)));

if (hasPhoneNumber > 0) {
contacts.add(name);

Cursor phoneCursor =
contentResolver.query(PhoneCONTENT_URI, null,
Phone_CONTACT_ID + " = ?", new String{contact_id}, null);
while (phoneCursor.moveToNext()) {
String phoneNumber = phoneCursor.getString(phoneCursor.getColumnIndex(NUMBER));
tell.add(phoneNumber);
}
}
}
}

if(tell.size() > contacts.size()) {
for(int i=0; i <contacts.size(); i++) {
user = new User(tell.get(i), contacts.get(i));
users.add(user);
}
} else {
for(int i=0; i < tell.size(); i++) {
user = new User(tell.get(i), contacts.get(i));
users.add(user);
}
}

RecyclerView.LayoutManager mLayoutManager = new LinearLayoutManager(getApplicationContext());
adapter = new UserAdapter(users, this);
members.setLayoutManager(mLayoutManager);
members.setItemAnimator(new DefaultItemAnimator());
members.addItemDecoration(new DividerItemDecoration(this, LinearLayoutManager.VERTICAL));
members.setAdapter(adapter);
}

@Override
protected void onDestroy() {
super.onDestroy();
}

@Override
public void onBackPressed() {
super.onBackPressed();
}


}


Please, help me fix this problem.










share|improve this question
















I am getting tired fixing this problem. the app does not execute it always show me this error Binary XML file line #26: Error inflating class EditText. I don't understand how to fix this problem.
This is my activity_members.xml



<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
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"
android:orientation="vertical">

<android.support.constraint.ConstraintLayout
android:id="@+id/newMeetScreen"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="visible"
tools:layout_editor_absoluteX="384dp">

<ImageView
android:id="@+id/imageView3"
android:layout_width="0dp"
android:layout_height="54dp"
android:src="@drawable/gradient"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<EditText
android:id="@+id/edit_search"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginStart="11dp"
android:layout_marginTop="7dp"
android:layout_marginEnd="13dp"
android:layout_marginBottom="7dp"
android:background="@drawable/radius_edit_text"
android:drawableLeft="@drawable/ic_search"
android:drawablePadding="3dp"
android:hint="Поиск"
android:imeOptions="actionGo"
android:inputType="text"
android:textColor="@color/colorPrimaryDark"
android:textColorHint="#9b9a9a"
android:textSize="20sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/btnDone"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<ImageButton
android:id="@+id/btnDone"
android:layout_width="52dp"
android:layout_height="50dp"
android:background="@android:drawable/list_selector_background"
android:src="@drawable/ic_done"
android:textColor="@color/colorProjectTextWhite"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/edit_search"
app:layout_constraintTop_toTopOf="parent" />
</android.support.constraint.ConstraintLayout>

<android.support.v7.widget.RecyclerView
android:background="@color/colorBackgroundLight"
android:id="@+id/membersList"
android:scrollbars="vertical"
android:layout_marginTop="0dp"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
</LinearLayout>


And this is my MembersActivity.java class.



public class MembersActivity extends AppCompatActivity {
private static final int REQUEST_CODE_READ_CONTACTS = 1;
private static boolean READ_CONTACTS_GRANTED = false;
RecyclerView members;
ArrayList<String> contacts = new ArrayList<String>();
ArrayList<String> tell = new ArrayList<String>();
UserAdapter adapter;
User user;
ArrayList<User> users = new ArrayList<>();
ImageButton btnDone;
StringBuilder stringBuilder = null;
EditText editSearch;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_members);
members = findViewById(R.id.membersList);
btnDone = findViewById(R.id.btnDone);
editSearch = findViewById(R.id.edit_search);
int hasReadContactPermission = ContextCompat.checkSelfPermission(Objects.requireNonNull(this), Manifest.permission.READ_CONTACTS);
if (hasReadContactPermission == PackageManager.PERMISSION_GRANTED) {
READ_CONTACTS_GRANTED = true;

} else {

ActivityCompat.requestPermissions(Objects.requireNonNull(this), new
String{Manifest.permission.READ_CONTACTS}, REQUEST_CODE_READ_CONTACTS);

}
if (READ_CONTACTS_GRANTED) {
getContacts();
}

btnDone.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
stringBuilder = new StringBuilder();
int i=0;
char ch = ',';
do{
User user = adapter.checkedUsers.get(i);
if(i == adapter.checkedUsers.size()-1) ch = '.';
stringBuilder.append(user.getName() + ch);
if(i != adapter.checkedUsers.size() -1) {
stringBuilder.append("n");
}
i++;

} while (i < adapter.checkedUsers.size());
if(adapter.checkedUsers.size() > 0) {
Intent intent = new Intent();
intent.putExtra("names", stringBuilder.toString());
setResult(RESULT_OK, intent);
finish();


} else {
Toast.makeText(MembersActivity.this, "Пожалуйста, выберите друзей", Toast.LENGTH_LONG).show();

}
}
});
editSearch.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {

}

@Override
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
adapter.getFilter().filter(charSequence);
return;

}

@Override
public void afterTextChanged(Editable editable) {

}
});

}

public void onRequestPermissionsResult(int requestCode, String permissions, int grantResults) {
switch (requestCode) {
case REQUEST_CODE_READ_CONTACTS:
if (grantResults.length > 0 && grantResults[0] ==
PackageManager.PERMISSION_GRANTED) {
READ_CONTACTS_GRANTED = true;

}
}
if (READ_CONTACTS_GRANTED) {
getContacts();
}
else {
Toast.makeText(this, "Требуется установить разрешения", Toast.LENGTH_LONG).show();
}
}

public void getContacts() {
Uri CONTENT_URI = ContactsContract.Contacts.CONTENT_URI;
String _ID = ContactsContract.Contacts._ID;
String DISPLAY_NAME = ContactsContract.Contacts.DISPLAY_NAME;
String HAS_PHONE_NUMBER = ContactsContract.Contacts.HAS_PHONE_NUMBER;

Uri PhoneCONTENT_URI =
ContactsContract.CommonDataKinds.Phone.CONTENT_URI;
String Phone_CONTACT_ID =
ContactsContract.CommonDataKinds.Phone.CONTACT_ID;
String NUMBER = ContactsContract.CommonDataKinds.Phone.NUMBER;

StringBuffer output = new StringBuffer();
ContentResolver contentResolver = Objects.requireNonNull(this).getContentResolver();
Cursor cursor = contentResolver.query(CONTENT_URI, null, null, null, null);

if (cursor.getCount() > 0) {

while (cursor.moveToNext()) {
String contact_id = cursor.getString(cursor.getColumnIndex(_ID));
String name = cursor.getString(cursor.getColumnIndex(DISPLAY_NAME));
int hasPhoneNumber = Integer.parseInt(cursor.getString(cursor.getColumnIndex(HAS_PHONE_NUMBER)));

if (hasPhoneNumber > 0) {
contacts.add(name);

Cursor phoneCursor =
contentResolver.query(PhoneCONTENT_URI, null,
Phone_CONTACT_ID + " = ?", new String{contact_id}, null);
while (phoneCursor.moveToNext()) {
String phoneNumber = phoneCursor.getString(phoneCursor.getColumnIndex(NUMBER));
tell.add(phoneNumber);
}
}
}
}

if(tell.size() > contacts.size()) {
for(int i=0; i <contacts.size(); i++) {
user = new User(tell.get(i), contacts.get(i));
users.add(user);
}
} else {
for(int i=0; i < tell.size(); i++) {
user = new User(tell.get(i), contacts.get(i));
users.add(user);
}
}

RecyclerView.LayoutManager mLayoutManager = new LinearLayoutManager(getApplicationContext());
adapter = new UserAdapter(users, this);
members.setLayoutManager(mLayoutManager);
members.setItemAnimator(new DefaultItemAnimator());
members.addItemDecoration(new DividerItemDecoration(this, LinearLayoutManager.VERTICAL));
members.setAdapter(adapter);
}

@Override
protected void onDestroy() {
super.onDestroy();
}

@Override
public void onBackPressed() {
super.onBackPressed();
}


}


Please, help me fix this problem.







java android xml android-studio android-edittext






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 24 '18 at 4:56









Andrew Thompson

153k28162344




153k28162344










asked Nov 24 '18 at 2:01









annaanna

17510




17510













  • please post the full stack trace of the exception, it usually contains a "caused by" prior exception showing the reason for the inflate to fail

    – marmor
    Nov 26 '18 at 8:04











  • also, are radius_edit_text and ic_search regular png drawables, or are they xml files?

    – marmor
    Nov 26 '18 at 8:05



















  • please post the full stack trace of the exception, it usually contains a "caused by" prior exception showing the reason for the inflate to fail

    – marmor
    Nov 26 '18 at 8:04











  • also, are radius_edit_text and ic_search regular png drawables, or are they xml files?

    – marmor
    Nov 26 '18 at 8:05

















please post the full stack trace of the exception, it usually contains a "caused by" prior exception showing the reason for the inflate to fail

– marmor
Nov 26 '18 at 8:04





please post the full stack trace of the exception, it usually contains a "caused by" prior exception showing the reason for the inflate to fail

– marmor
Nov 26 '18 at 8:04













also, are radius_edit_text and ic_search regular png drawables, or are they xml files?

– marmor
Nov 26 '18 at 8:05





also, are radius_edit_text and ic_search regular png drawables, or are they xml files?

– marmor
Nov 26 '18 at 8:05












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53454576%2fandroid-view-inflateexception-binary-xml-file-line-26-error-inflating-class-edi%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53454576%2fandroid-view-inflateexception-binary-xml-file-line-26-error-inflating-class-edi%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Costa Masnaga

Fotorealismo

Sidney Franklin