Skip to content

Instantly share code, notes, and snippets.

@mombrea
Created October 25, 2013 14:23
Show Gist options
  • Save mombrea/7155462 to your computer and use it in GitHub Desktop.
Save mombrea/7155462 to your computer and use it in GitHub Desktop.
Example of copying a textview in android on a button click
public void btnCopyClicked(View view){
LinearLayout container = (LinearLayout)view.findViewById(R.id.container_id);
TextView txt1 = (TextView)view.findViewById(R.id.txtView_id);
TextView txt2 = new TextView(this); //this = context
txt2.setText(txt1.getText());
conatiner.addView(txt2);
}
@pbochan
Copy link

pbochan commented Jun 30, 2020

Your example is so lousy that Line 9 states "conatiner" instead of "container".

@mombrea
Copy link
Author

mombrea commented Jun 30, 2020

@pbochan what would you change aside from the typo? Also, nice website http://pbochan.com/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment