I have a bluetooth reading routine, and it gives me a String that I would like to "print" into a fragment's textview. The string is updated in real time, so it shall not be an onetime event.
Funny is that I can pass a TextView text from the Activity to the fragment's TextView. Then I put the String into the Activity TextView, and then from the Activity TextView to the Fragment Textview.
The Activity Textview is 0dpx0dp so nobody will see it.
How could I pass the String directly from the MainActivity to the Fragment's TextView?
This is in the activity:
textAmanheceMenos.setText(dadosTratadosB);
This is in the fragment:
TextAmanheceMenos = (TextView) getActivity().findViewById(R.id.textAmanheceMenos);
String MSG = TextAmanheceMenos.getText().toString();
TextAmanheceEm.setText(MSG);
Edit: This is working. But I had to create that ghost textview in the activity. The "textAmanheceMenos" textview in the activity must be eliminated. The String "dadosTratadosB" must go directly into the "TextAmanheceEm.setText(dadosTratadosB)". But that doesn't work. It says "cannot resolve symbol"
Even if I create:
DadosTratadosB = getActivity().findViewById(dadosTratadosB);
How could I make it work guys?
Thank you!