title: BaseAdapter class not working - Android
body: <p>I have a Asynctask that gathers comments through a JSON method. It then places the comments into a String[] which is placed into a listView, the problem is the class that extends BaseAdapter gives me an error and wont let me use it? Number is suppose to be a string! Not an int. Here is my current code,</p>
  
  <pre><code>    class loadComments extends AsyncTask&lt;JSONObject, String, JSONObject&gt; {
               private ArrayAdapter&lt;String&gt; mAdapter = null;
  
              @Override
              protected void onPreExecute() {
                  super.onPreExecute();
  
  
              } 
  
              @Override
              protected void onProgressUpdate(String... values) {
                  super.onProgressUpdate(values);
  
              } 
  
              protected JSONObject doInBackground(JSONObject... params) {
  
  
                  JSONObject json2 = CollectComments.collectComments(usernameforcomments, offsetNumber);
  
  
                      return json2;
  
  
  
              }
  
              @Override
              protected void onPostExecute(JSONObject json2) {
                  try {  
                      if (json2.getString(KEY_SUCCESS) != null) { 
                          registerErrorMsg.setText("");
                          String res2 = json2.getString(KEY_SUCCESS);
                          if(Integer.parseInt(res2) == 1){ 
                               l1=(ListView)findViewById(R.id.list);
  
  
                              JSONArray commentArray = json2.getJSONArray(KEY_COMMENT);
                              final String comments[] = new String[commentArray.length()];
                              for ( int i=0; i&lt;commentArray.length(); i++ ) {
                                  comments[i] = commentArray.getString(i);
                              }
                              JSONArray numberArray = json2.getJSONArray(KEY_NUMBER);
                              String numbers[] = new String[numberArray.length()];
                              for ( int i=0; i&lt;numberArray.length(); i++ ) {
                                  numbers[i] = numberArray.getString(i);
                              }
                              JSONArray usernameArray = json2.getJSONArray(KEY_USERNAME);
                              String usernames[] = new String[usernameArray.length()];
                              for ( int i=0; i&lt;usernameArray.length(); i++ ) {
                                  usernames[i] = usernameArray.getString(i);
                              }
  
  
                              l1.setAdapter(new dataListAdapter(comments,numbers,usernames));
  
  
                              class dataListAdapter extends BaseAdapter {
                                  String[] Comment, Username, number ;
  
  
                                  dataListAdapter() {
                                      Comment = null;
                                      Username = null;
                                      number = null;
                                  }
  
                                  public dataListAdapter(String[] text, String[] text1,String[] text3) {
                                      Comment = text;
                                      Username = text1;
                                      number = text3;
  
                                  }
  
                                  public int getCount() {
                                      // TODO Auto-generated method stub
                                      return Comment.length;
                                  }
  
                                  public Object getItem(int arg0) {
                                      // TODO Auto-generated method stub
                                      return null;
                                  }
  
                                  public long getItemId(int position) {
                                      // TODO Auto-generated method stub
                                      return position;
                                  }
  
                                  public View getView(int position, View convertView, ViewGroup parent) {
  
                                      LayoutInflater inflater = getLayoutInflater();
                                      View row;
                                      row = inflater.inflate(R.layout.list_item, parent, false);
                                      TextView listComment, listnumber, listUsername;
  
                                      listComment = (TextView) row.findViewById(R.id.listComment);
                                      listnumber = (TextView) row.findViewById(R.id.listNumber);
                                      listUsername=(TextView)row.findViewById(R.id.listPostedBy);
                                      listComment.setText(Comment[position]);
                                      listnumber.setText(number[position]);
                                      listUsername.setText(Username[position]);
  
                                      return (row);
                                  }
                              }
  
  
  
  
  
  
  
  
  
                              }//end if key is == 1
                          else{
                              // Error in registration
                              registerErrorMsg.setText(json2.getString(KEY_ERROR_MSG));
                          }//end else
                      }//end if
                  } //end try
  
                  catch (JSONException e) { 
                      e.printStackTrace();
                  }//end catch    
              }
          }
  
  
          new loadComments().execute();
  </code></pre>
  
  <p>I get the error </p>
  
  <pre><code>    The type dataListAdapter must implement the inherited abstract method Adapter.getView(int, View, ViewGroup)
  </code></pre>