Skip to content

Instantly share code, notes, and snippets.

@kodamirmo
Created May 7, 2015 21:34
Show Gist options
  • Save kodamirmo/9c16e7256f276a0f18b5 to your computer and use it in GitHub Desktop.
Save kodamirmo/9c16e7256f276a0f18b5 to your computer and use it in GitHub Desktop.
//************************** Esto en el fragment **************************//
//...... codigo
public void setLabelText(String text){
mMyTextView.setText(text);
}
//..... codigo
//************************** Esto en Main Activity **************************//
//...... codigo
Fragment fragmentToUpdate = new FragmentToUpdate();
//Esto solo es para mostrarlo, pero eso depende de como lo hagas tú
FragmentManager fragmentManager = getSupportFragmentManager();
fragmentManager.beginTransaction()
.replace(R.id.content_frame, fragmentToUpdate).commit();
//Aqui es donde se actualiza el Label desde la actividad
fragmentToUpdate.setLabelText("Hola mundo");
//..... codigo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment