title: The method get(String) is undefined for the type String error in adding the codes to the filter class of adapter in android
body: <p>For Finding the key items fromt he listview i had not used filter in the adapter, but now by following this <a href="https://stackoverflow.com/questions/8678163/list-filter-custom-adapter-dont-give-result/8678198#8678198">link</a> aded the filter but in this line <code>String playerName=songsList.get(i).get("title").toString();</code> I am getting the error</p>
  
  <pre><code> The method get(String) is undefined for the type String
  </code></pre>
  
  <p>and also in <code>searchResults.add(songsList.get(i));</code> as</p>
  
  <pre><code>The method add(HashMap&lt;String,String&gt;) in the type ArrayList&lt;HashMap&lt;String,String&gt;&gt; is not applicable for the arguments (String)
  </code></pre>
  
  <p>Here's is my entire code</p>
  
  <pre><code> public class Home extends ListActivity {
  
  //how many to load on reaching the bottom
      int itemsPerPage = 15;
      boolean loadingMore = false;                        
  
      //For test data :-)
      Calendar d = Calendar.getInstance();
  
  ArrayList&lt;String&gt; songsList;
  ListView list;
      LazyAdapter adapter;
  JSONArray posts;
  
  
  
   //ArrayList thats going to hold the search results
    ArrayList&lt;HashMap&lt;String, String&gt;&gt; searchResults;
    LayoutInflater inflater;
  // All static variables
   static final String URL = "http://india.abc.net/ads/?json=get_recent_posts";
  
  
   static final String KEY_POSTS = "posts";
   static final String KEY_ID = "id";
  static final String KEY_TITLE = "title";
  static final String KEY_DATE = "date";
  static final String KEY_CONTENT = "content";
  static final String KEY_AUTHOR = "author";
  static final String KEY_NAME = "name";
  static final String KEY_ATTACHMENTS = "attachments";
  static final String KEY_SLUG = "slug";
  static final String KEY_THUMB_URL = "thumbnail";
  static final String KEY_IMAGES = "images";
  static final String KEY_URL = "url";
  
  
  
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.main);
  
      final EditText searchBox=(EditText) findViewById(R.id.search);
      final ListView  list=(ListView)findViewById(android.R.id.list);
  
      //get the LayoutInflater for inflating the customomView
       //this will be used in the custom adapter
       inflater=(LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  
  
  
  
  
      final  ArrayList&lt;HashMap&lt;String, String&gt;&gt; songsList = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;();
  
  
          // Creating JSON Parser instance
                  final JSONParser jParser = new JSONParser();
  
                  // getting JSON string from URL
                  JSONObject json = jParser.getJSONFromUrl(URL);
                  try {
                       posts = json.getJSONArray(KEY_POSTS);
  
          // looping through all song nodes &lt;song&gt;
                  for(int i = 0; i &lt; posts.length(); i++){
                      JSONObject c = posts.getJSONObject(i);
                      // Storing each json item in variable
                      String id = c.getString(KEY_ID);
                      String title = c.getString(KEY_TITLE);
                      String date = c.getString(KEY_DATE);
                      String content = c.getString(KEY_CONTENT);
                      // to remove all &lt;P&gt; &lt;/p&gt; and &lt;br /&gt; and replace with ""
                       content = content.replace("&lt;br /&gt;", "");
                       content = content.replace("&lt;p&gt;", "");
                       content = content.replace("&lt;/p&gt;", "");
  
                      //authornumber is agin  JSON Object
                      JSONObject author = c.getJSONObject(KEY_AUTHOR);
                      String name = author.getString(KEY_NAME);
  
                      String url = null;
                      String slug = null;
                      try {
                      JSONArray atta = c.getJSONArray("attachments");
                      for(int j = 0; j &lt; atta.length(); j++){
                          JSONObject d = atta.getJSONObject(j);
  
                          slug = d.getString(KEY_SLUG);
  
                          JSONObject images = d.getJSONObject(KEY_IMAGES);
  
                          JSONObject thumbnail =    images.getJSONObject(KEY_THUMB_URL);
                          url = thumbnail.getString(KEY_URL);
  
                      }
                      } catch (Exception e) {
                          e.printStackTrace();
  
                      }
  
  
  
  
              // creating new HashMap
              HashMap&lt;String, String&gt; map = new HashMap&lt;String, String&gt;();
  
              // adding each child node to HashMap key =&gt; value
              map.put(KEY_ID, id);
              map.put(KEY_TITLE, title);
              map.put(KEY_DATE, date);
              map.put(KEY_NAME, name);
              map.put(KEY_CONTENT, content);
              map.put(KEY_SLUG, slug);
              map.put(KEY_URL, url);
  
  
              // adding HashList to ArrayList
              songsList.add(map);
                  }   
                  }catch (JSONException e) {
                      e.printStackTrace();
  
                      }
  
  
                //searchResults=OriginalValues initially
                  searchResults=new ArrayList&lt;HashMap&lt;String, String&gt;&gt;(songsList);
  
  
           // Getting adapter by passing json data ArrayList
              adapter=new LazyAdapter(this, songsList);    
               list.setAdapter(adapter);
  
               searchBox.addTextChangedListener(new TextWatcher() {
  
                   public void onTextChanged(CharSequence s, int start, int before, int count) {
                       adapter.getFilter().filter(s.toString());
                   }
  
                   public void beforeTextChanged(CharSequence s, int start, int count,
                       int after) {
  
                     }
  
                     public void afterTextChanged(Editable s) {
  
                     }
                    });
  
  
      // Launching new screen on Selecting Single ListItem
      list.setOnItemClickListener(new OnItemClickListener() {
  
          public void onItemClick(AdapterView&lt;?&gt; parent, View view,
                  int position, long id) {
              HashMap&lt;String, String&gt; map = songsList.get(position);
  
              Intent in = new Intent(Home.this, Singlemenuitem.class);
              in.putExtra(KEY_TITLE, map.get(KEY_TITLE));
              in.putExtra(KEY_DATE, map.get(KEY_DATE));                         
              in.putExtra(KEY_NAME, map.get(KEY_NAME));
              in.putExtra(KEY_CONTENT, map.get(KEY_CONTENT));
              in.putExtra(KEY_URL, map.get(KEY_URL));
  
              startActivity(in);
          }                
      });  
  </code></pre>
  
  <p>and the adapter class is </p>
  
  <pre><code>      public class LazyAdapter extends BaseAdapter implements Filterable{
        TextView title;
        private Activity activity;
           // private TextWatcher textWatcher;
          private ArrayList&lt;HashMap&lt;String, String&gt;&gt; data;
          private static LayoutInflater inflater=null;
         public ImageLoader imageLoader; 
         final EditText searchBox=(EditText) findViewById(R.id.search);
         ArrayList&lt;HashMap&lt;String, String&gt;&gt; searchResults;
         ArrayList&lt;String&gt; songsList;
  
  
     public LazyAdapter(Activity a, ArrayList&lt;HashMap&lt;String, String&gt;&gt; d) {
      activity = a;
      data=d;
      inflater = (LayoutInflater)activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
      imageLoader=new ImageLoader(activity.getApplicationContext());
  }
  
  
  private EditText findViewById(int search) {
      // TODO Auto-generated method stub
      return null;
  }
  
  
  public int getCount() {
      return data.size();
  }
  
  public Object getItem(int position) {
      return position;
  }
  
  public long getItemId(int position) {
      return position;
  }
  
  public View getView(int position, View convertView, ViewGroup parent) {
      View vi=convertView;
      if(convertView==null)
          vi = inflater.inflate(R.layout.activity_home, null);
  
      TextView title = (TextView)vi.findViewById(R.id.title); // title
      TextView date = (TextView)vi.findViewById(R.id.date); // artist name
      TextView content = (TextView)vi.findViewById(R.id.content);  // duration
      TextView name = (TextView)vi.findViewById(R.id.name); 
      // duration
      ImageView thumb_image=(ImageView)vi.findViewById(R.id.list_image); // thumb image
  
      HashMap&lt;String, String&gt; song = new HashMap&lt;String, String&gt;();
      song = data.get(position);
  
  
  
      // Setting all values in listview
     title.setText(song.get(Home.KEY_TITLE));
      date.setText(song.get(Home.KEY_DATE));
      content.setText(song.get(Home.KEY_CONTENT));
      name.setText(song.get(Home.KEY_NAME));
  
     imageLoader.DisplayImage(song.get(Home.KEY_URL), thumb_image);
      return vi;
  }
  
  
  public void add(String string) {
      // TODO Auto-generated method stub
  
  }
  
  
  @Override
  
  public Filter getFilter() {
      Filter filter = new Filter() {
          @SuppressWarnings("unchecked")
          @Override
          protected void publishResults(CharSequence data,FilterResults searchResults) {
  
              songsList = (ArrayList&lt;String&gt;) searchResults.values; // has the filtered values
              notifyDataSetChanged();  // notifies the data with new filtered values
          }
  
          @Override
          protected FilterResults performFiltering(CharSequence playerName) {
              // TODO Auto-generated method stub
              return null;
          }
      };
      String searchString=searchBox.getText().toString();
      int textLength=searchString.length();
  
             //clear the initial data set
      searchResults.clear();
  
      for(int i=0;i&lt;songsList.size();i++)
      {
     String playerName=songsList.get(i).get("title").toString();
  
     if(textLength&lt;=playerName.length()){
  
     //compare the String in EditText with Names in the ArrayList
       if(searchString.equalsIgnoreCase(playerName.substring(0,textLength)))
  
       searchResults.add(songsList.get(i));
     }
      }
      return filter;
  
  
  }
  }
  </code></pre>