4

I don't 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 imports:

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;

First time I was had error after add onTextChanged method to AutoCompleteTextView in getView() of my ArrayAdapter. I try to restart Eclipse, but it's not help me.

3
  • -1 for not including the actual error message. Commented Dec 1, 2013 at 15:20
  • @HotLicks He does say error in rmName = st_list.get(position).toString(); Commented Dec 1, 2013 at 15:22
  • @greg-449 -- Which is not the actual error message. Commented Dec 1, 2013 at 15:28

1 Answer 1

8

The

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

should read

public static class RoomsArrayAdapter extends ArrayAdapter<String>{

Your current code creates a generic type parameter called String, which you don't need and whose name clashes with java.lang.String.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.