开发者

text of the textview sending

开发者 https://www.devze.com 2023-01-19 12:04 出处:网络
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 开发者

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

精彩评论

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