how to start of new activity on click of item in page indicator
<p>I have page Indicator with three layouts, I need to start a new activity on item click in page indicator and <code>setOnItemClick</code> listener is not working. Control is not coming to <code>setOnItemClick</code> listener of <code>viewFlow</code>. Any help would be really helpful!</p>

<p>Below is the code :</p>

<pre><code> @Override
        protected void onCreate(Bundle savedInstanceState) {

            super.onCreate(savedInstanceState);
            setContentView(R.layout.item);


            viewFlow = (ViewFlow) findViewById(R.id.viewflow);
            viewFlow.setAdapter(new TextAdapter(this),3);

            CircleFlowIndicator indic = (CircleFlowIndicator) findViewById(R.id.viewflowindic);
            viewFlow.setFlowIndicator(indic);

            viewFlow.setOnItemClickListener(new OnItemClickListener() {

                @Override
                public void onItemClick(AdapterView&lt;?&gt; arg0, View arg1, int position,
                        long arg3) {
                    // TODO Auto-generated method stub
                    Toast.makeText(DesignShape.this, "clicked is "+position, Toast.LENGTH_LONG).show();
                             //start of new activity code 

                }

            });
    }
</code></pre>

<p>TextAdapter file :</p>

<pre><code>public class TextAdapter extends BaseAdapter{

    private LayoutInflater mInflater;

    public TextAdapter(Context context) {
        mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    }

    @Override
    public int getCount() {
        // TODO Auto-generated method stub
        return 3;
    }

    @Override
    public Object getItem(int arg0) {
        // TODO Auto-generated method stub
        return arg0;
    }

    @Override
    public long getItemId(int arg0) {
        // TODO Auto-generated method stub
        return arg0;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        if (convertView == null) {
            convertView = mInflater.inflate(R.layout.uppages, null);
        }
        convertView.setId(position);
        TextView text=(TextView)convertView.findViewById(R.id.text);
        text.setText("aaaa"+position);

        ((ImageView) convertView.findViewById(R.id.image)).setImageResource(R.drawable.ballaya);
        return convertView;
    }
}
</code></pre>

<p>Control is not coming to <code>viewFlow.setOnItemClickListener</code>.</p>

<p>cell_shape.xml</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle" &gt;
    &lt;solid android:color="#000" /&gt;
    &lt;stroke
        android:width="0.1dp"
        android:color="#fff" /&gt;
&lt;/shape&gt;
</code></pre>

<p>table.xml</p>

<pre><code>     &lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:background="@drawable/shape_5"
    android:layout_height="fill_parent" &gt;


    &lt;LinearLayout
        android:id="@+id/mainTable"
        android:layout_width="265dp"
        android:layout_height="wrap_content"
        android:layout_marginTop="10dp"
        android:paddingTop="5dp"
        android:paddingBottom="2dp"
        android:layout_marginLeft="20dp"
        android:background="@drawable/cell_shape"
        android:orientation="vertical" &gt;
    &lt;/LinearLayout&gt;


    &lt;LinearLayout
        android:id="@+id/tl"
        android:layout_width="265dp"
        android:layout_height="wrap_content"
        android:layout_below="@+id/mainTable"
        android:layout_marginTop="10dp"
        android:paddingTop="5dp"
        android:paddingBottom="2dp"
        android:layout_marginLeft="20dp"
        android:background="@drawable/cell_shape"
        android:orientation="vertical" &gt;
    &lt;/LinearLayout&gt;

    &lt;LinearLayout
        android:id="@+id/ll"
        android:layout_width="273dp"
        android:layout_below="@+id/tl"
        android:layout_height="wrap_content"
        android:layout_marginTop="10dp"
        android:paddingTop="5dp"
        android:paddingBottom="2dp"
        android:layout_marginLeft="20dp"
        android:background="@drawable/cell_shape"
        android:orientation="vertical" &gt;
    &lt;/LinearLayout&gt;

&lt;/RelativeLayout&gt;
</code></pre>

<p>Avail.java </p>

<pre><code>public class Avail extends Activity{

    ArrayList&lt;String&gt; date,selectedClass,altrClass;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);
        setContentView(R.layout.table);

        selectedClass= new ArrayList&lt;String&gt;();
        altrClass= new ArrayList&lt;String&gt;();
        date= new ArrayList&lt;String&gt;();
        date.add("Date");

        fetchData();

        LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);

        RelativeLayout rel=null;
        LinearLayout ll=(LinearLayout)findViewById(R.id.ll);
        for(int i=0;i&lt;selectedClass.size();i++){
            rel=new RelativeLayout(this);
            RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(
                    LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
            rel= (RelativeLayout) inflater.inflate(R.layout.availreuse,null);
            int id=i+1;
            rel.setId(id);
            //params.setMargins(0, 140, 0, 0);

             TextView dateHolder= (TextView) rel.findViewById(R.id.date_holder);
             dateHolder.setText(date.get(i));

             TextView selectClass= (TextView) rel.findViewById(R.id.select_class);
             selectClass.setText(selectedClass.get(i));

             TextView altClass= (TextView) rel.findViewById(R.id.altr_class);
             altClass.setText(altrClass.get(i));

             ll.addView(rel);
        }
    }

    public void fetchData() {

        try {
            AssetManager assets = getAssets();

            InputStream is = assets.open("avail.html");

            // File input = new File(getAssets().open("film.html").toString());

            String input = DesignShape.convertStreamToString(is);

            Document doc = Jsoup.parse(input, "UTF-8");

            Elements header = doc.select("tr[class=heading_table_top]");

            if (null != header) {
                Element headerInfo = header.get(1);
                Elements fetchClassMain=headerInfo.select("th:eq(2)");
                Elements fetchClassAltr=headerInfo.select("th:eq(3)");
                altrClass.add(fetchClassAltr.text().toString());
                selectedClass.add(fetchClassMain.text().toString());
                //System.out.println(fetchClassMain.text()+" ---- "+fetchClassAltr.text());
            }

            Elements mainData = doc.select("td[align=CENTER] [class=table_border_both]");
            System.out.println(mainData.size());
            Pattern pat= Pattern.compile("[0-9]");
            Matcher matcher=null;
            for(int idx=0;idx&lt;mainData.size();idx++){
                matcher=pat.matcher(mainData.get(idx).text());
                if(matcher.matches()){
                    int fetchIndex=idx;
                    date.add(mainData.get(fetchIndex+1).text());
                    //System.out.println(mainData.get(fetchIndex+1).text());
                    selectedClass.add(mainData.get(fetchIndex+2).text());
                    //System.out.println(mainData.get(fetchIndex+2).text());
                    altrClass.add(mainData.get(fetchIndex+3).text());
                    //System.out.println(mainData.get(fetchIndex+3).text());
                }
            }
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

    }
}
</code></pre>

<p>availReuse.xml</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:orientation="vertical" &gt;

    &lt;TextView
        android:id="@+id/date_holder"
        android:layout_width="75dp"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:layout_marginLeft="5dp"
        android:background="@drawable/cell_shape"
        android:paddingLeft="5dp"
        android:paddingRight="15dp"
        android:textStyle="bold"
        android:textSize="11sp"
        android:typeface="serif" /&gt;

    &lt;TextView
        android:id="@+id/select_class"
        android:layout_width="90dp"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_toRightOf="@+id/date_holder"
         android:paddingLeft="5dp"
        android:layout_marginLeft="3dp"
        android:paddingRight="5dp"
        android:textSize="11sp"
        android:background="@drawable/cell_shape"
        android:textStyle="bold"
        android:typeface="serif" /&gt;

      &lt;TextView
        android:id="@+id/altr_class"
        android:layout_width="90dp"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_toRightOf="@+id/select_class"
         android:paddingLeft="5dp"
        android:layout_marginLeft="3dp"
        android:paddingRight="5dp"
        android:textSize="11sp"
        android:background="@drawable/cell_shape"
        android:textStyle="bold"
        android:typeface="serif" /&gt;

    &lt;View
        android:id="@+id/seperator"
        android:layout_width="fill_parent"
        android:layout_height="0dp"
        android:layout_below="@+id/altr_class"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="5dp"
        android:background="#FFFFFF" /&gt;
&lt;/RelativeLayout&gt;
</code></pre>

<p>custom.xml </p>

<pre><code>public class Custom extends Activity {
      List&lt;String&gt; list;

      /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.mai);
        Spinner mySpinner = (Spinner)findViewById(R.id.spinner);
         list = new ArrayList&lt;String&gt;();
        list.add("BANGALORE (SBC)");
        list.add("CHENNAI CENTRAL (MAS)");
        list.add("KATPADI (AJJ)");
        mySpinner.setAdapter(new MyAdapter(this, R.layout.spinner, list));

        mySpinner.setOnItemSelectedListener(new OnItemSelectedListener() {

            @Override
            public void onItemSelected(AdapterView&lt;?&gt; parent, View arg1,
                    int pos, long arg3) {
                // TODO Auto-generated method stub
                Toast.makeText(parent.getContext(), 
                        "OnItemSelectedListener : " + parent.getItemAtPosition(pos).toString(),
                        Toast.LENGTH_SHORT).show();
            }

            @Override
            public void onNothingSelected(AdapterView&lt;?&gt; arg0) {
                // TODO Auto-generated method stub

            }
        });
    }


    class MyAdapter extends ArrayAdapter&lt;List&gt; {

        public MyAdapter(Context context, int textViewResourceId,
                List objects) {
            super(context, textViewResourceId, objects);
            // TODO Auto-generated constructor stub
        }

        @Override
        public View getDropDownView(int position, View convertView,
                ViewGroup parent) {
            return getCustomView(position, convertView, parent);
        }

        @Override
        public View getView(int position, View convertView, ViewGroup parent) {
            return getCustomView(position, convertView, parent);
        }

        public View getCustomView(int position, View convertView,
                ViewGroup parent) {

            LayoutInflater inflater = getLayoutInflater();
            View row = inflater.inflate(R.layout.spinner, parent, false);
            TextView label = (TextView) row.findViewById(R.id.company);
            label.setText(list.get(position));

            ImageView icon = (ImageView) row.findViewById(R.id.image);
            icon.setImageResource(R.drawable.ic_launcher);

            return row;
        }
    }
}
</code></pre>
