如果TextViews(我认为Car No, TimeInetc 都是TextViews, 对吗?) 并且打印Button被 a 包裹,TableRow那么获取数据非常简单:
printBtn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
TableRow tr = (TableRow) v.getParent();
TextView carNumber = (TextView) tr.findViewById(R.id.the_id_ofTheCarNumberTextView);
String carNumberText = carNumber.getText().toString();
TextView timeIn = (TextView) tr.findViewById(R.id.the_id_ofTheTimeInTextView);
String timeInText = carNumber.getText().toString();
TextView timeOut = (TextView) tr.findViewById(R.id.the_id_ofTheTimeOutTextView);
String timeOutText = carNumber.getText().toString();
// etc get the rest of the fields
// put the data in the intent and start send it to the new
// activity
}
});
根据行数,您可能需要查看ListView小部件。