title: CustomListAdapter() in CustomListAdapter cannot be applied
body: <p>Am new to android, am trying to create an app which will display persons according to their status, in apps am using navigation drawer with fragments.</p>
  
  <p>when i am trying to list out the person's of particular categories I got an error. i.e. </p>
  
  <pre><code>Error:(50, 57) error: incompatible types: Past cannot be converted to Activity
  Note: Some input files use or override a deprecated API.
  Note: Recompile with -Xlint:deprecation for details.
  Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
  Error:Execution failed for task ':app:compileDebugJavaWithJavac'.
  </code></pre>
  
  <blockquote>
    <p>Compilation failed; see the compiler error output for details.</p>
  </blockquote>
  
  <p>am getting error "CustomListAdapter() in CustomListAdapter cannot be applied"</p>
  
  <pre><code>   import android.os.Bundle;
     import android.support.v4.app.Fragment;
     import android.view.LayoutInflater;
     import android.view.View;
     import android.view.ViewGroup;
     import android.widget.ListView;
  
  
    public class Past extends Fragment {
  
  ListView list;
  String[] itemname ={
          "John",
          "Mike",
          "Ria",
          "jack",
          "leo",
  
  };
  
  Integer[] imgid={
          R.drawable.pic1,
          R.drawable.pic2,
          R.drawable.pic3,
          R.drawable.pic4,
          R.drawable.pic5,
  };
  
  public Past() {
      // Required empty public constructor
  }
  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container,
                           Bundle savedInstanceState) {
      // Inflate the layout for this fragment
      return inflater.inflate(R.layout.fragment_past, container, false);
  
      CustomListAdapter adapter=new CustomListAdapter(this, itemname, imgid);
          //here am getting  an error
      list=(ListView)getView().findViewById(R.id.list);
      list.setAdapter(adapter);
  
      /*list.setOnItemClickListener(new AdapterView.OnItemClickListener() {
  
          @Override
          public void onItemClick(AdapterView&lt;?&gt; parent, View view,
                                  int position, long id) {
              // TODO Auto-generated method stub
              String Slecteditem= itemname[+position];
              Toast.makeText(getApplicationContext(), Slecteditem, Toast.LENGTH_SHORT).show();
  
          }
      });*/
  }
  
     @Override
      public void onDestroy() {
         super.onDestroy();
     }
   }
  </code></pre>
  
  <p>the CustomListAdapter.java code is given below</p>
  
  <pre><code> import android.app.Activity;
   import android.view.LayoutInflater;
   import android.view.View;
   import android.view.ViewGroup;
   import android.widget.ArrayAdapter;
   import android.widget.ImageView;
   import android.widget.TextView;
  
  
   public class CustomListAdapter extends ArrayAdapter&lt;String&gt; {
  
   private final Activity context;
   private final String[] itemname;
   private final Integer[] imgid;
  
  public CustomListAdapter(Activity context, String[] itemname, Integer[] imgid) {
      super(context, R.layout.mylist, itemname);
      // TODO Auto-generated constructor stub
  
      this.context=context;
      this.itemname=itemname;
      this.imgid=imgid;
  }
  
  public View getView(int position,View view,ViewGroup parent) {
      LayoutInflater inflater=context.getLayoutInflater();
      View rowView=inflater.inflate(R.layout.mylist, null,true);
  
      TextView txtTitle = (TextView) rowView.findViewById(R.id.item);
      ImageView imageView = (ImageView) rowView.findViewById(R.id.icon);
      TextView extratxt = (TextView) rowView.findViewById(R.id.textView1);
  
      txtTitle.setText(itemname[position]);
      imageView.setImageResource(imgid[position]);
      extratxt.setText("Description "+itemname[position]);
      return rowView;
  
     };
   }
  </code></pre>
  
  <p>Fragment called from MainActivity is given below</p>
  
  <pre><code>     else if(i==1){
          switch (j){
  
              case 0:
                  Past past = new Past();
                  fragmentTransaction = fragmentManager.beginTransaction();
                  fragmentTransaction.replace(R.id.frameholde,past);
                  fragmentTransaction.commit();
                  break;
  
              case 1:
                  Current current = new Current();
                  fragmentTransaction = fragmentManager.beginTransaction();
                  fragmentTransaction.replace(R.id.frameholde, current);
                  fragmentTransaction.commit();
                  break;
  
              case 2:
                  Area area = new Area();
                  fragmentTransaction = fragmentManager.beginTransaction();
                  fragmentTransaction.replace(R.id.frameholde, area);
                  fragmentTransaction.commit();
                  break;
  
          }
  </code></pre>