title: A custom ListView with a custom adapter in Android Studio
body: <p>Will I don't what is the problem. There are no errors nothing, and the program
  working perfectly. However, when I click on an item on list View it does not do anything. In other word the "Toast" won't pass </p>
  
  <p>This My main class:</p>
  
  <pre><code>public class ViewListAct extends ActionBarActivity {
  
  
  private ListView list;
  private final String[] names_1 = {"McDonald's", "Subway", "Pizza Hut", "Burger King"};
  private final String[] img_1   = {"mcd", "mcd", "mcd", "mcd"};
  private Activity context;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.view_list);
      list = (ListView) findViewById(R.id.listview);
  
      AdapterView adapter = new AdapterView(this, img_1, names_1);
      list.setAdapter(adapter);
  
  
        list.setOnItemClickListener(new android.widget.AdapterView.OnItemClickListener() {
          @Override
          public void onItemClick(android.widget.AdapterView&lt;?&gt; parent, View view, int position, long id) {
             Toast.makeText(getApplicationContext(), names_1[position], Toast.LENGTH_LONG).show();
  
  
          }
      });
  
  }
  </code></pre>
  
  <p>This my Custom Adapter Class:</p>
  
  <pre><code>public class AdapterView extends ArrayAdapter&lt;String&gt; {
  
      private Activity context_1;
      private String[] names_1;
      private String[] img_1;
  
  public AdapterView(Activity context, String[] img, String[] names) {
      super(context, R.layout.pic_letf_tv_right, names);
  
      context_1 = context;
      this.names_1 = names;
      this.img_1 = img;
  }
  
  public View getView(int position, View view, ViewGroup parent){
      LayoutInflater l_i_f = context_1.getLayoutInflater();
      View rv = l_i_f.inflate(R.layout.pic_letf_tv_right, null); 
  
      TextView tv_l = (TextView) rv.findViewById(R.id.tv_view);
      tv_l.setText(names_1[position]);
  
      ImageView imageView = (ImageView) rv.findViewById(R.id.log_img);
      int id = context_1.getResources().getIdentifier(img_1[position], "drawable", context_1.getPackageName());
      imageView.setImageResource(id);
  
      return rv;
  }
  </code></pre>
  
  <p>}</p>
  
  <p>This my Custom Row xml file:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
     &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent" android:layout_height="match_parent"
     android:clickable="true"
     android:orientation="horizontal"
      &gt;
  
      &lt;ImageView
      android:layout_width="500px"
      android:layout_height="500px"
      android:id="@+id/log_img"
      /&gt;
  
      &lt;TextView
      android:id="@+id/tv_view"
      android:layout_gravity="center"
      android:gravity="center"
      android:layout_width="match_parent"
      android:layout_height="500px"
      android:textColor="#FFFFFF"
      android:textSize="18dp"/&gt;
      &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>This my ListView xml file:</p>
  
  <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:tools="http://schemas.android.com/tools"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:overScrollMode="always"
  tools:context=".ViewList"&gt;
  
  
  
  &lt;ListView
      android:id="@+id/listview"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:scrollingCache="false"
      android:smoothScrollbar="true"
      android:layout_alignParentTop="true"
      android:layout_alignParentLeft="true"
      android:layout_alignParentStart="true"
      android:background="#000000" /&gt;
  </code></pre>
  
  <p></p>
  
  <p>Could anyone tell me what am I doing wrong.</p>