title: java.lang.ClassCastException: android.widget.RelativeLayout
body: <p>I developed a simple <code>listview</code> application and it displays the <code>listview</code> but when I'm selecting a single <code>listview</code> I get the following error.</p>
  
  <p>This is my single list item 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:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent"&gt;
  
  &lt;TextView android:id="@+id/product_label"
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:textSize="25dip"
          android:textStyle="bold"
          android:padding="10dip"
          android:textColor="#ffffff"/&gt;   
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>this is my MainActivity.java file</p>
  
  <pre><code>import java.util.List;
  
  import android.app.ListActivity;
  import android.app.ProgressDialog;
  import android.os.Bundle;
  import android.widget.Toast;
  import android.content.Intent;
  import android.view.View;
  import android.widget.AdapterView;
  import android.widget.AdapterView.OnItemClickListener;
  
  import android.widget.ListView;
  import android.widget.TextView;
  
  public class MainActivity extends ListActivity implements FetchDataListener{
  private ProgressDialog dialog;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);        
      setContentView(R.layout.activity_main);        
      initView(); 
  
      ListView lv = getListView();
  
      // listening to single list item on click
      lv.setOnItemClickListener(new OnItemClickListener() {
        public void onItemClick(AdapterView&lt;?&gt; parent, View view,
            int position, long id) {
  
            // selected item
            String product = ((TextView) view).getText().toString();
  
            // Launching new Activity on selecting single List Item
            Intent i = new Intent(getApplicationContext(), SingleListItem.class);
            // sending data to new activity
            i.putExtra("product", product);
            startActivity(i);
  
        }
      });
  
  }
  
  private void initView() {
      // show progress dialog
      dialog = ProgressDialog.show(this, "", "Loading...");
  
      String url = "http://pubbapp.comze.com/pubapp.php";
      FetchDataTask task = new FetchDataTask(this);
      task.execute(url);
  }
  
  @Override
  public void onFetchComplete(List&lt;Application&gt; data) {
      // dismiss the progress dialog
      if(dialog != null)  dialog.dismiss();
      // create new adapter
      ApplicationAdapter adapter = new ApplicationAdapter(this, data);
      // set the adapter to list
      setListAdapter(adapter);        
  }
  
  @Override
  public void onFetchFailure(String msg) {
      // dismiss the progress dialog
      if(dialog != null)  dialog.dismiss();
      // show failure message
      Toast.makeText(this, msg, Toast.LENGTH_LONG).show();        
  }
  }
  </code></pre>
  
  <p>This is my second screen java file,</p>
  
  <pre><code>import android.app.Activity;
  import android.content.Intent;
  import android.os.Bundle;
  import android.widget.TextView;
  
  public class SingleListItem extends Activity{
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      this.setContentView(R.layout.single_list_item_view);
  
      TextView txtProduct = (TextView) findViewById(R.id.product_label);
  
      Intent i = getIntent();
      // getting attached intent data
      String product = i.getStringExtra("product");
      // displaying selected product name
      txtProduct.setText(product);
  
  }
  }
  </code></pre>
  
  <p>I have no idea how to solve this error. Can someone please help me fix this?</p>