Saturday, 15 February 2014

java - Creating a button dynamically with a user inputted title from different activity -


I'm trying to learn something about Android programming on the shore, but I'm still starting, so Any help is actually being appreciated, I am sure it is not very difficult for anyone with anybody's experience.

What I want to do is be able to load an activity, which basically just add a "Add button" button.

When the add button is clicked on the page link of 3 user input strings (say, strone, straw2, strauss). I want to be able to click on a button on this second activity and want to return the link of the screen to the original activity, in which a new button "str1 str2 str3" and the "Add button" button is shown below that new one is.

I have managed to run first and I have prepared all the fields and buttons on other activity, but I do not know how to move the button back to the first activity dynamically and with the desired string .

Thank you all!

Add a button to your layout

  & lt; Android: id = "@ + ID / button" Android: layout_width = "wrap_content" Android: layout_height = "wrap_content" Android: text = "..." />  

And try it in your java:

  button mButton = (button) findViewById (R.id.button); MButton.setTextSize (str1 + str2 + str3);  

For more button click events:

  mButton.setOnClickListener (New View.OnClickListener () {@Override Click Public Zero (see View) {// what you want here}}};  

No comments:

Post a Comment