Reputation: 22493
Can any one tell me how to pass the value from one screen to its previous screen. Consider the case.i m having two screen first screen with one Textview and button and the second activity have one edittext and button.
If i click the first button then it has to move to second activity and here user has to type something in the textbox. If he press the button from the second screen then the values from the textbox should move to the first activity and that should be displayed in the first activity textview.
This is passing Values from one activity to another
i want to pass the text with same FontStyle, Color and Size of the font.
Upvotes: 0
Views: 3228
Reputation: 109237
Use the same style,color and size for first activity TextView and second Activity's EditTextView.
If you are done it with programming, then just pass the other parameters also with the intents, and set it in the first activity's TextView.
Like,
intent.putExtra("fontStyle","American Dream");
intent.putExtra("color","value");
intent.putExtra("size","value");
Use this in first activity to set TextView's properties.
String fontStyle = getIntent().getExtras().getString("fontStyle");
String fontColor = getIntent().getExtras().getString("color");
String fontSize = getIntent().getExtras().getString("size");
Typeface font2 = Typeface.createFromAsset(getApplicationContext().getAssets(),"fonts/"+fontStyle+".ttf");
// here fontStyle is string which you passed from the second Activity
textView.setTypeface(font2);
Upvotes: 2
Reputation: 6270
Also, you can do this onClick
SecondButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
TextView text= (TextView) findViewById(R.id.textview);
text.settext(Edittext.getText());
Intent intent= new Intent(form2.this, form1.class);
startActivity(intent);
}
});
Upvotes: 0