I have a problem with my Table Rows.
The first question is if it is possible to make Table Rows clickable.
I have a application that creates Table Rows dynamically from a SQL
Database.
Now I want to make the rows clickable, like a link so I can get to a
new page and get more information about the text in the Table Row.

Here is my code:
-------
-------
-------
import java.util.List;

import android.app.Activity;
import android.graphics.Color;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.TableLayout;
import android.widget.TableRow;
import android.widget.TextView;
import android.widget.TableRow.LayoutParams;

public class ListCurrent extends Activity implements OnClickListener
{
        public void onCreate(Bundle savedInstanceState) {
                super.onCreate(savedInstanceState);

                setContentView(R.layout.listcurrent);
                addTableRow();
                }
        public void addTableRow(){
                AndroidWebServiceClient awsc = new AndroidWebServiceClient();
                awsc.updateCurrentList();
                List<Container> cons = awsc.getContainer();
                TableLayout tableLayout = (TableLayout)
findViewById(R.id.listcurrentLayout);
                for(int i = 0; i < cons.size(); i++){
                        Container con = cons.get(i);

                        TableRow tr = new TableRow(this);
Here I have tried to    ----->  tr.setClickable(true);
do every new row       ---->    tr.setOnClickListener(this);
     clickable         --------->       tr.setId(i);

                        View thin = new View(this);

                        thin.setBackgroundColor(Color.WHITE);
                        thin.setMinimumHeight(1);

                        TextView titleText = new TextView(this);
                        titleText.setText(con.getCurrentTitle());
                        titleText.setMaxWidth(220);

                                                TextView startsView = new 
TextView(this);
                        startsView.setText(con.getCurrentStartsHour()+ ":" +
                                        con.getCurrentStartsMinute());
                        startsView.setGravity(5);


                        // Create the event row
                        tr.addView(titleText);
                        tr.addView(startsView);
                        tableLayout.addView(tr);
                        tableLayout.addView(thin);
                }
        }
        @Override
        public void onClick(View v) {
                TableLayout tableLayout = (TableLayout)
findViewById(R.id.listcurrentLayout);

                switch (v.getId()){
                case 1:

                        break;
                }

        }
}




-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to