Mismatch type: cannot convert from java.lang.String to String

I do not understand why I got this error!

public static class RoomsArrayAdapter<String> extends ArrayAdapter<String>{
****
private String rmName;
    private ArrayList<String> st_list = new ArrayList<String>();

public View getView(int position, View convertView, ViewGroup parent){                      
        View rowView = convertView; 
        LayoutInflater inflater = (LayoutInflater) raaContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        rowView = inflater.inflate(R.layout.room_layout, parent, false);
        rmName = st_list.get(position).toString();

error in rmName = st_list.get (position) .toString ();

There is my import:

import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.app.AlertDialog;
import android.content.ComponentName;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.DialogInterface.OnClickListener;
import android.content.pm.PackageManager;
import android.graphics.Color;
import android.provider.Settings;
import android.util.Log;
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.inputmethod.CompletionInfo;
import android.widget.ArrayAdapter;
import android.widget.AutoCompleteTextView;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import android.R.color;

For the first time, I had an error after adding the onTextChanged method to AutoCompleteTextView in the getView () of my ArrayAdapter. I am trying to restart Eclipse, but that does not help me.

+4
source share
1 answer

public static class RoomsArrayAdapter<String> extends ArrayAdapter<String>{

must read

public static class RoomsArrayAdapter extends ArrayAdapter<String>{

Your current code creates a generic type type Stringthat you do not need and whose name it encounters java.lang.String.

+8
source

All Articles