I want to add the following two objects within a Fragment so they can be used by the elements of the layaout of that fragment.
These are the objects I want to add:
public void copiarEstatico (View view){
ClipboardManager myClipboard = myClipboard = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
ClipData myClip;
String text = textView3.getText().toString();
myClip = ClipData.newPlainText("text", text);
myClipboard.setPrimaryClip(myClip);
Toast.makeText(FragLay.this,"Codigo copiado en el portapapeles :))",Toast.LENGTH_SHORT).show();
}
public void copiarDinamico (View view){
ClipboardManager myClipboard = myClipboard = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
ClipData myClip;
String text = textView5.getText().toString();
myClip = ClipData.newPlainText("text", text);
myClipboard.setPrimaryClip(myClip);
Toast.makeText(FragLay.this,"Codigo copiado en el portapapeles :))",Toast.LENGTH_SHORT).show();
}
And this is the class of the fragment together with the two defined elements to which I want to assign the object.
public class fraglay extends Fragment {
TextView textView3;
TextView textView5;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fraglay,container,false);
textView3=(TextView)view.findViewById(R.id.textView3);
textView5=(TextView)view.findViewById(R.id.textView5);
return view;
}
}
How could I add them so that later on the onClick property of those two elements let me add them?