[Solved] Change EditText with Button click


In your MainActivity.java:

public void onClicknews(View v) {

   String titel1 = "Trumps brutales Kalkül";

   EditText article = (EditText) findViewById(R.id.articlename);
   String s = article.getText().toString();
   Intent intent = new Intent(getApplicationContext(), NewsActivity.class);
   intent.putExtra("articalName",s);
   startActivity(intent);
}

In your NewsActivity.java:

EditText news = (EditText) findViewById(R.id.news);

String newsName = getIntent().getStringExtra("articalName");

news.setText(newsName );

0

solved Change EditText with Button click