'Android Studio: W/OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED

I am trying to make a movie list, but it only shows a white screen with the app name. Apparently, I have a very similar program to this and it runs perfectly fine. This is what I get when I run the program.

W/OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...

I found someone saying that this error happens if there is an error in xml codes, but I will still put my java codes as well.

public class MainActivity extends AppCompatActivity {

private ListView mListView;
private Context mContext;
ArrayList<Movie> movieList;
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    mContext = this;
    final ArrayList<Movie> movieList = Movie.getMoviesFromFile("movies.json", this);
    MovieAdapter adapter = new MovieAdapter(this, movieList);

    mListView = findViewById(R.id.movie_list_view);
    mListView.setAdapter(adapter);

    mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
            Movie selectedMovie = movieList.get(i);

            Intent detailIntent = new Intent(mContext, MovieDetailActivity.class);
            detailIntent.putExtra("title", selectedMovie.title);
            detailIntent.putExtra("description", selectedMovie.description);
            detailIntent.putExtra("poster", selectedMovie.poster);

            startActivity(detailIntent);
        }
    });
}

The following is my adapter.

public class MovieAdapter extends BaseAdapter{
private Context mContext;
private ArrayList<Movie> mMovieList;
private LayoutInflater mInflater;

public MovieAdapter(Context mContext, ArrayList<Movie> mMovieList){
    this.mContext = mContext;
    this.mMovieList = mMovieList;
    mInflater = (LayoutInflater)mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}

@Override
public int getCount(){return mMovieList.size();}
@Override
public Object getItem(int pos){return mMovieList.get(pos);}
@Override
public long getItemId(int pos){return pos;}
@Override
public View getView(int pos, View convertView, ViewGroup parent){
    ViewHolder holder;

    if(convertView == null){
        convertView = mInflater.inflate(R.layout.list_item_movie, parent, false);
        holder = new ViewHolder();
        holder.titleTextView = convertView.findViewById(R.id.title);
        holder.charactersTextView = convertView.findViewById(R.id.main_characters);
        holder.descriptionTextView = convertView.findViewById(R.id.description);
        holder.thumbnailImageView = convertView.findViewById(R.id.poster);

        convertView.setTag(holder);
    } else{
        holder = (ViewHolder)convertView.getTag();
    }

    TextView titleTextView = holder.titleTextView;
    TextView descriptionTextView = holder.descriptionTextView;
    TextView charactersTextView = holder.charactersTextView;
    ImageView thumbnailImageView = holder.thumbnailImageView;
    Movie movie = (Movie)getItem(pos);

    titleTextView.setText(movie.title);
    titleTextView.setTextSize(20);

    charactersTextView.setText(movie.main_characters);
    charactersTextView.setTextSize(13);

    descriptionTextView.setText(movie.description);
    descriptionTextView.setTextSize(9);

    Picasso.with(mContext).load(movie.poster).into(thumbnailImageView);
    return convertView;
}

private static class ViewHolder{
    public TextView titleTextView;
    public TextView descriptionTextView;
    public ImageView thumbnailImageView;
    public TextView charactersTextView;
}

}

And the followings are the xml codes.

activity_main.xml

<?xml version="1.0" encoding="utf-8"?>
<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="com.example.user.junepyolee_miniapp1.MainActivity">

<ListView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/movie_list_view" />

list_item_movie.xml

    <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout   xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

<ImageView
    android:id="@+id/poster"
    android:layout_width="90dp"
    android:layout_height="140dp"
    android:layout_alignParentStart="true"
    android:layout_alignParentTop="true"
    android:layout_marginStart="4dp"
    android:layout_marginTop="6dp"
    android:layout_marginBottom="6dp"
    android:layout_centerVertical="true"
    android:scaleType="fitCenter"
    android:contentDescription="This is a thumbnail"
    app:srcCompat="@mipmap/ic_launcher" />

<RelativeLayout
    android:id="@+id/movie_list_text_layout"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignTop="@+id/poster"
    android:layout_alignParentTop="false"
    android:layout_toRightOf="@+id/poster">

    <TextView
        android:id="@+id/title"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentStart="true"
        android:layout_alignParentTop="true"
        android:layout_marginLeft="10dp"
        android:layout_marginRight="10dp"
        android:layout_marginTop="3dp"
        android:text="Title"
        android:textSize="20sp" />

    <TextView
        android:id="@+id/description"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/title"
        android:layout_marginLeft="10dp"
        android:layout_marginRight="10dp"
        android:layout_marginTop="3dp"
        android:maxLines="3"
        android:text="description"
        android:textSize="9sp" />

    <TextView
        android:id="@+id/main_characters"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignEnd="@+id/description"
        android:layout_below="@+id/description"
        android:layout_marginLeft="10dp"
        android:layout_marginRight="10dp"
        android:layout_marginTop="3dp"
        android:text="characters max 3 people"
        android:textSize="13sp" />

    <TextView
        android:id="@+id/hasSeen"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/main_characters"
        android:layout_marginLeft="10dp"
        android:layout_marginRight="10dp"
        android:layout_marginTop="3dp"
        android:text="has seen?"
        android:textSize="11sp" />

</RelativeLayout>

Does anyone have a solution for this one?



Solution 1:[1]

This is just a warning, and since it retries without the configuration option without (I am assuming from your comments) a followup error, this is not the source of your problem.

It's not a bad guess, since this is for an OpenGL-related class (android/opengl/EGL14), but it's not the source of your problem.

You can read more about EGL at https://www.khronos.org/egl.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Glen