我开发了一个android应用程序,其中..输入了一个数据并将其保存在数据库中....当用户单击此数据库时,必须显示详细信息...为此我创建了textview ...但是在单击操作时我不能能够初始化我必须做的事情请帮助..我在这里复制代码请帮助...
tableLayout.addView(tableRow);
for(Integer j=0; j<count; j++)
{
tableRow = new TableRow(getApplicationContext());
textView5 = new TextView(getApplicationContext());
textView5.setText(c.getString(c.getColumnIndex("fname")));
textView6 = new TextView(getApplicationContext());
textView6.setText(c.getString(c.getColumnIndex("mname1")));
textView7 = new TextView(getApplicationContext());
textView7.setText(c.getString(c.getColumnIndex("mname2")));
textView8 = new TextView(getApplicationContext());
textView8.setText(c.getString(c.getColumnIndex("lname")));
textView9 = new TextView(getApplicationContext());
textView9.setText(c.getString(c.getColumnIndex("email")));
textView5.setPadding(10, 10, 10, 10);
textView6.setPadding(10, 10, 10, 10);
textView7.setPadding(10, 10, 10, 10);
textView8.setPadding(10, 10, 10, 10);
textView9.setPadding(10, 10, 10, 10);
tableRow.addView(textView5);
tableRow.addView(textView6);
tableRow.addView(textView7);
tableRow.addView(textView8);
tableRow.addView(textView9);
tableLayout.addView(tableRow);
c.moveToNext();
textView5.setClickable(true);
textView5.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
String ett1 = textView5.getText().toString();/* Error is here*/
String data1 = textView5.getText().toString();/*error is here*/
Intent intent = new Intent(MainActivity.this , savedata.class);
intent.putExtra("ett1", data1 + "");
startActivity(intent);
}
});
}
public class savedata extends Activity
{
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.save_xm);
TextView txt2 = (TextView) findViewById(R.id.textView2);
txt2.setText(getIntent().getStringExtra("ett1"));
}
}