title: how to get data from Intent Activity and button activated in ListView
body: <p>Hi thanks for reading this! Please help me.</p>
  
  <p>I am trying to create a restaurant app which the display 3 buttons in the menu then click the food button which display the list of food, then customer can choose the food they want to order then send back the order back to first page. I read a lot of the article and some say use the listview.setItemsCanFocus(true) but I having problem to understand it to implement it. and some say the button listener inside the getView but when I implement my program just hang. Please help me. Thank you.</p>
  
  <p>my menu : </p>
  
  <p><img src="https://i.stack.imgur.com/Od3in.png" alt="enter image description here"></p>
  
  <p>here is my food(second) page </p>
  
  <p><img src="https://i.stack.imgur.com/xYFkI.png" alt="enter image description here"></p>
  
  <p>I am having problems:</p>
  
  <ol>
  <li><p>To transfer the array of selected data(food order) back from the food.class back to my main class which is restaurant.class</p></li>
  <li><p>After I add the button in the list the food is not clickable(the whole row of food).</p></li>
  <li><p>click on the image to enlarge and other places(besides image to dismiss it)</p></li>
  </ol>
  
  <p>my main class(restaurant)</p>
  
  <pre><code>public class SesameRestaurant extends Activity  {
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.main);
  
  }
  
  
  public void foodMenu(View v){
      startActivity(new Intent(SesameRestaurant.this,Food.class));
  
      //setContentView(R.layout.foods);
  }
  
  public void drinkMenu(View v){startActivity(new Intent(SesameRestaurant.this,Drink.class));}
  public void billMenu(View v){}
  </code></pre>
  
  <p>}</p>
  
  <p>my second class (food.class)</p>
  
  <pre><code>package com.restaurant.sesame;
  
   public class Food extends ListActivity {
  private LayoutInflater mInflater;
  private Vector&lt;RowData&gt; data;
  RowData rd; 
  
  
  static final String[] title = new String[] {
              "Cow Rib steak", 
              "Thai Prawn Fried Rice",    
              "Christmas Sensation Delight",
              "Salmon Steak"      };
  
  static final String[] detail = new String[] {
                  "1h 37m Shipping: $10.00",
                  "1h 39m Shipping: Free",
                  "58m 6s Shipping: $10.00",
                  "59m 30s Shipping: $10.95"  };
  
  private Integer [] imgid = { R.drawable.food1, R.drawable.food2, R.drawable.food3, R.drawable.food4 };
  
  
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.foods);
  
      mInflater = (LayoutInflater) getSystemService(
              Activity.LAYOUT_INFLATER_SERVICE);
              data = new Vector&lt;RowData&gt;();
              for(int i=0;i&lt;title.length;i++){
              try {
                  rd = new RowData(i,title[i],detail[i]);
                  } catch (ParseException e) {
                      e.printStackTrace();
                 }
                 data.add(rd);
              }
                 CustomAdapter adapter = new CustomAdapter(this, R.layout.list, R.id.title, data);
                 setListAdapter(adapter);
                 getListView().setTextFilterEnabled(true);
  
  }
  
   public void onListItemClick(ListView parent, View v, int position, long id) {          
       Log.w("my app", "Click list Item!!!"); 
       Toast.makeText(getApplicationContext(), "You have selected "+(position+1)+"th item",  Toast.LENGTH_SHORT).show();
   }
  
   public void orderClick(View v){
  
  
   }
  
   private class RowData {
          protected int mId;
          protected String mTitle;
          protected String mDetail;
  
       RowData(int id,String title,String detail)
       {
                  mId=id;
                  mTitle = title;
                  mDetail=detail;
       }
  
       @Override
       public String toString() {
           return mId+" "+mTitle+" "+mDetail;
       }
   }
  
   private class CustomAdapter extends ArrayAdapter&lt;RowData&gt; {
       public CustomAdapter(Context context, int resource, int textViewResourceId, List&lt;RowData&gt; objects) {               
           super(context, resource, textViewResourceId, objects);
       }
  
       @Override
       public View getView(int position, View convertView, ViewGroup parent) {   
           ViewHolder holder = null;
           TextView title = null;
           TextView detail = null;
           ImageView i11=null;
           RowData rowData= getItem(position);
           if(null == convertView){
                  convertView = mInflater.inflate(R.layout.list, null);
                  holder = new ViewHolder(convertView);
                  convertView.setTag(holder);
           }
           holder = (ViewHolder) convertView.getTag();
           title = holder.gettitle();
           title.setText(rowData.mTitle);
           detail = holder.getdetail();
           detail.setText(rowData.mDetail);                                                     
           i11=holder.getImage();
           i11.setImageResource(imgid[rowData.mId]);
  
  
           return convertView;
       }
  
       private class ViewHolder {
           private View mRow;
           private TextView title = null;
           private TextView detail = null;
           private ImageView i11=null; 
           public ViewHolder(View row) {
               mRow = row;
           }
  
           public TextView gettitle() {
               if(null == title){
                   title = (TextView) mRow.findViewById(R.id.title);
               }
               return title;
           }     
  
           public TextView getdetail() {
               if(null == detail){
                   detail = (TextView) mRow.findViewById(R.id.detail);
               }
               return detail;
           }
           public ImageView getImage() {
               if(null == i11){
                   i11 = (ImageView) mRow.findViewById(R.id.img);
               }
               return i11;
           }
       }
   }
  
  
   public void backClick(View v){
      finish(); 
   }
  </code></pre>
  
  <p>}</p>
  
  <p>my food menu interface foods.xml</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="fill_parent"
      android:layout_height="fill_parent"
  &gt;
  &lt;ListView
      android:id="@android:id/list"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
  /&gt;
  
  &lt;Button  
          android:layout_height="wrap_content"  
          android:text="Back"  
          android:onClick="backClick"  
          android:layout_width="fill_parent"&gt;  
  &lt;/Button&gt; 
  </code></pre>
  
  <p></p>
  
  <p>my list.xml</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="horizontal"
              android:layout_width="fill_parent"
              android:layout_height="wrap_content"&gt;
      &lt;ImageView  android:id="@+id/img"
                  android:scaleType="centerCrop"
                  android:layout_width="100dp"
                  android:layout_height="100dp"/&gt;
      &lt;LinearLayout   xmlns:android="http://schemas.android.com/apk/res/android"
                      android:orientation="vertical"
                      android:paddingLeft="10dp"
                      android:layout_width="fill_parent"
                      android:layout_height="wrap_content"&gt;
          &lt;TextView
              android:layout_width="fill_parent"
              android:id="@+id/title"
              android:layout_height="wrap_content"
              android:textStyle="bold"
              android:textColor="#ffffff"
              android:textSize="16sp" /&gt;
          &lt;TextView
              android:layout_width="fill_parent"
              android:id="@+id/detail"
              android:textColor="#ffffff"
              android:layout_height="wrap_content"/&gt;
  
          &lt;RelativeLayout
              android:layout_width="fill_parent"
              android:layout_height="wrap_content"
              android:orientation="horizontal" &gt;
  
              &lt;TextView
                  android:id="@+id/quantity"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:text="Quantity :"
                  android:textColor="#ffffff" /&gt;
  
              &lt;EditText
                  android:id="@+id/quantityInput"
                  android:layout_width="wrap_content"
                  android:layout_height="35dp"
                  android:layout_toRightOf="@id/quantity"
                  android:hint="1-10"
                  android:paddingLeft="10dp"
                  android:textSize="12dp" /&gt;
  
              &lt;Button
                  android:id="@+id/order"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:layout_marginLeft="120dp"
                  android:layout_toRightOf="@id/quantity"
                  android:onClick="orderClick"
                  android:text="Order"
                  android:textSize="12dp" /&gt;
  
          &lt;/RelativeLayout&gt;
      &lt;/LinearLayout&gt;
  </code></pre>
  
  <p></p>