当前位置: 动力学知识库 > 问答 > 编程问答 >

android - How to display database contents in a new activity at onclick of a button?

问题描述:

thing is, if i click a button GETDATA - then a new activity starts new.java and i want it to display the contents of my database.

in this new.java i have strings name and id. and i have lined database and this class, such that name and id have the corresponding details that i want to display.

now the ques is, how to display them ?

if i have a

EditText ta;

ta=findViewBy(R.id.edittext1);

ta.setText(name);

should this work ?

it isnt working. also, i dont want user to change the contents and want to make this filed un-editable.

should i use

TextView tf;

ta=findViewBy(R.id.textview1);

tf.setText(name);

?

even this isnt happening.

what is the procedure for this ?

网友答案:

it is done by using append. TextView ta; ta=(TextEdit)findViewById(Ri.id.textView1); String a=getData(1); // goto database, id is 1 ta.append(a);

分享给朋友:
您可能感兴趣的文章:
随机阅读: