title: error when listview option is clicked
body: <p>My activity has a listview which is populated with data from my parse.com database, and the list does get populated no problem. It displays a list of names. I want to store the name of the selected item from the list in a variable and pass to another activity. List gets populated but on selecting error crashes the app. Heres my activity `</p>
  
  <pre><code>import java.util.List;
  
  import android.app.ProgressDialog;
  import android.content.Intent;
  import android.os.Bundle;
  import android.support.v7.app.ActionBarActivity;
  import android.view.Menu;
  import android.view.MenuItem;
  import android.view.View;
  import android.widget.AdapterView;
  import android.widget.AdapterView.OnItemClickListener;
  import android.widget.ArrayAdapter;
  import android.widget.ListView;
  
  import com.parse.ParseObject;
  import com.parse.ParseQuery;
  import com.parse.ParseQueryAdapter;
  import com.parse.ParseQueryAdapter.OnQueryLoadListener;
  
  public class ResterauntList extends ActionBarActivity {
      String mValue;
      ArrayAdapter&lt;String&gt; adapter;
      ProgressDialog mProgressDialog;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_resteraunt_list);
  
          Bundle bdl = getIntent().getExtras();
          mValue = bdl.getString("Value");
          setContentView(R.layout.activity_resteraunt_list);
  
          populateList(mValue);
      }
  
      private void populateList(final String Value) {
          ParseQueryAdapter.QueryFactory&lt;ParseObject&gt; factory = new ParseQueryAdapter.QueryFactory&lt;ParseObject&gt;() {
  
              @Override
              @SuppressWarnings({ "unchecked", "rawtypes" })
              public ParseQuery create() {
                  ParseQuery query = new ParseQuery("Restraunt");
                  query.whereEqualTo("Location", Value);
                  return query;
              }
          };
          ParseQueryAdapter&lt;ParseObject&gt; adapter = new ParseQueryAdapter&lt;ParseObject&gt;(
                  this, factory);
          adapter.setTextKey("Name");
          adapter.addOnQueryLoadListener(new OnQueryLoadListener&lt;ParseObject&gt;() {
  
              public void onLoading() {
                  mProgressDialog = new ProgressDialog(ResterauntList.this);
                  mProgressDialog.setTitle(Value + " Restraunts Search");
                  mProgressDialog.setMessage("Loading...");
                  mProgressDialog.setIndeterminate(false);
                  mProgressDialog.show();
              }
  
              public void onLoaded(List&lt;ParseObject&gt; objects, Exception e) {
                  mProgressDialog.dismiss();
              }
          });
  
          final ListView listView = (ListView) findViewById(R.id.restListView);
          listView.setAdapter(adapter);
          listView.setOnItemClickListener(new OnItemClickListener() {
              public void onItemClick(AdapterView&lt;?&gt; parent, View view,
                      int position, long id) {
                  String name = (String) listView.getItemAtPosition(position);
                  Intent i = new Intent(getApplicationContext(),
                          SingleRestraunt.class);
                  i.putExtra("restName", name);
                  startActivity(i);
  
              }
          });
      }
  
      @Override
      public boolean onCreateOptionsMenu(Menu menu) {
          // Inflate the menu; this adds items to the action bar if it is present.
          getMenuInflater().inflate(R.menu.resteraunt_list, menu);
          return true;
      }
  
      @Override
      public boolean onOptionsItemSelected(MenuItem item) {
          // Handle action bar item clicks here. The action bar will
          // automatically handle clicks on the Home/Up button, so long
          // as you specify a parent activity in AndroidManifest.xml.
          int id = item.getItemId();
          if (id == R.id.action_settings) {
              return true;
          }
          return super.onOptionsItemSelected(item);
      }
  }`
  </code></pre>
  
  <p>My xml for this activity is given below</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:paddingBottom="@dimen/activity_vertical_margin"
      android:paddingLeft="@dimen/activity_horizontal_margin"
      android:paddingRight="@dimen/activity_horizontal_margin"
      android:paddingTop="@dimen/activity_vertical_margin"
      tools:context="com.example.gastronomaapp.ResterauntList" &gt;
  
      &lt;ListView
          android:id="@+id/restListView"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:clickable="true" &gt;
      &lt;/ListView&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>I seem to keep getting this error</p>
  
  <pre><code>08-31 03:00:42.490: E/AndroidRuntime(2003): Process: com.example.gastronomaapp, PID: 2003
  08-31 03:00:42.490: E/AndroidRuntime(2003): java.lang.ClassCastException: android.widget.LinearLayout cannot be cast to android.widget.TextView
  </code></pre>
  
  <p>Checked many solutions and tried almost everything i could find online. Absolutely no clue whats wrong. Would appreciate any help
  EDIT - Did a stack trace,tells me the error is on this line. Kinda had that intuition </p>
  
  <pre><code>String name = (String) listView.getItemAtPosition(position);
                  Intent i = new Intent(getApplicationContext(),
                          SingleRestraunt.class);
  </code></pre>