开发者

text of the textview sending

i have two activities each contain its own textview any one help me that when i click the one textview text the text goes to the another textview of the second activity please any on help me in 开发者_JS百科this problem


In activity A. TextView aTv = findViewById(R.id.aTextView); String aText = aTv.getText().toString(); Intent i = new Intent(bClass.class); // your other activity i.putExtra("myText", aText); startActivity(i);

In the onCreate of Activity B: String aText = this.getIntent().getStringExtra("myText");

TextView bTv = findViewById(R.id.bTextView); bTv.setText(aText);

Is that what you were looking to do? I'm into a few beers so there may be a few typo's but that's the idea. :)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜