title: How to debug "expected android.widget.TextView but found java.lang.string" in Android?
body: <p>Can someone please take a look at my code? I am trying to build this app for a personal school project. I am new to android studio. I have put together a simple app where you display the spaces available in a parking lot.</p>
  
  <p>But now I am trying to open a second activity screen when I click on one of the lots in the listView screen. I got this error and have no way of solving it.</p>
  
  <pre><code>**MainActivity.java**
  
  &lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout         
  xmlns:tools="http://schemas.android.com/tools"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent" &gt;
  
  &lt;TextView
      android:id="@+id/lotName"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content" /&gt;
  
  &lt;TextView
      android:id="@+id/lotSpaces"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_below="@+id/lotName"/&gt;
  
  &lt;/RelativeLayout&gt;
  
  **SingleLotView.java**
  
  package com.example.sahan.smartpark;
  
  /**
  * Created by Sahan on 2015-10-14.
  */
  import android.app.Activity;
  import android.content.Intent;
  import android.os.Bundle;
  import android.widget.TextView;
  
  public class SingleLotView extends Activity{
  
  //declare variables
  TextView lotName;
  TextView lotSpaces;
  
  String[] lot_name;
  String[] lot_spaces;
  int position;
  
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.singlelotview);
      // Retrieve data from MainActivity on listview item click
      Intent i = getIntent();
      // Get the listview item click position
      position = i.getExtras().getInt("position");
      // Get the list of rank
     lotName = i.getStringArrayExtra("lotName");
      // Get the list of country
     lotSpaces = i.getStringArrayExtra("lotSpaces");
      // Get the list of population
  
      // Locate the TextViews in singleitemview.xml
      lotName = (TextView) findViewById(R.id.move_title);
      lotSpaces = (TextView) findViewById(R.id.move_title);
  
      // Load the text into the TextViews followed by the position
      lotName.setText(lot_name[position]);
      lotSpaces.setText(lot_spaces[position]);
  
  }
  }
  
  **MoveAdapter.java**
  
  package com.example.sahan.smartpark;
  
  import android.content.Context;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.view.ViewGroup;
  import android.widget.ArrayAdapter;
  import android.widget.ImageView;
  import android.widget.TextView;
  
  import java.util.ArrayList;
  import java.util.List;
  
  /**
  * Created by Sahan on 2015-10-12.
  */
  public class MoveAdapter extends ArrayAdapter{
  List list=new ArrayList();
  
  public MoveAdapter(Context context, int resource) {
      super(context, resource);
  }
  
  
  static class DataHandler
  {
      ImageView poster;
      TextView name;
      TextView spaces;
  }
  public void add(Object object){
      super.add(object);
      list.add(object);
  }
  public int getCount(){
      return this.list.size();
  }
  
  @Override
  public Object getItem(int position) {
      return this.list.get(position);
  }
  
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
      View row;
      row=convertView;
      DataHandler handler;
  
      if(convertView==null)
      {
          row=inflater.inflate(R.layout.second_layout,parent,false);
          handler=new DataHandler();
          handler.poster=(ImageView)row.findViewById(R.id.move_poster);
          handler.name=(TextView)row.findViewById(R.id.move_title);
          handler.spaces=(TextView)row.findViewById(R.id.move_rating);
          row.setTag(handler);
      }
      else {
  
          handler=(DataHandler)row.getTag();
      }
      MoveDataProvider dataProvider;
  
      dataProvider=(MoveDataProvider)this.getItem(position);
      handler.poster.setImageResource
           (dataProvider.getMove_poster_resource());
      handler.name.setText(dataProvider.getLot_name());
      handler.spaces.setText(dataProvider.getLot_spaces());
      return row;
  
  
  
  
  }
  }
  
  **SingleToView.xml**
  package com.example.sahan.smartpark;
  
  import android.content.Context;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.view.ViewGroup; 
  import android.widget.ArrayAdapter;
  import android.widget.ImageView;
  import android.widget.TextView;
  
  import java.util.ArrayList;
  import java.util.List;
  
  /**
  * Created by Sahan on 2015-10-12.
  */
  public class MoveAdapter extends ArrayAdapter{
  List list=new ArrayList();
  
  public MoveAdapter(Context context, int resource) {
      super(context, resource);
  }
  
  
  static class DataHandler
  {
      ImageView poster;
      TextView name;
      TextView spaces;
  }
  public void add(Object object){
      super.add(object);
      list.add(object);
  }
  public int getCount(){
      return this.list.size();
  }
  
  @Override
  public Object getItem(int position) {
      return this.list.get(position);
  }
  
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
      View row;
      row=convertView;
      DataHandler handler;
  
      if(convertView==null)
      {
  
          row=inflater.inflate(R.layout.second_layout,parent,false);
          handler=new DataHandler();
          handler.poster=(ImageView)row.findViewById(R.id.move_poster);
          handler.name=(TextView)row.findViewById(R.id.move_title);
          handler.spaces=(TextView)row.findViewById(R.id.move_rating);
          row.setTag(handler);
      }
      else {
  
          handler=(DataHandler)row.getTag();
      }
      MoveDataProvider dataProvider;
  
      dataProvider=(MoveDataProvider)this.getItem(position);
  
      handler.poster.setImageResource
      (dataProvider.getMove_poster_resource());
  
      handler.name.setText(dataProvider.getLot_name());
      handler.spaces.setText(dataProvider.getLot_spaces());
      return row;
  
  }
  }
  
  **strings.xml**
  
  &lt;resources&gt;
  &lt;string name="app_name"&gt;SmartPark&lt;/string&gt;
  
  &lt;string name="action_settings"&gt;Settings&lt;/string&gt;
  &lt;string-array name="lot_name"&gt;
      &lt;item&gt;  Parking Lot A&lt;/item&gt;
      &lt;item&gt;  Parking Lot B&lt;/item&gt;
  
  &lt;/string-array&gt;
  
  &lt;string-array name="lot_spaces"&gt;
      &lt;item&gt;Available:  225&lt;/item&gt;
      &lt;item&gt;Available:  107&lt;/item&gt;
  
  &lt;/string-array&gt;
  
  &lt;/resources&gt;
  </code></pre>
  
  <p>The error I get is on my SingleLotView.java code: </p>
  
  <blockquote>
    <p>Incompatible types - expected android.widget.TextView  but found java.lang.string</p>
  </blockquote>