Я посылаю намерение, когда установлен какой-либо флаг в моей программе, и затем получаю это намерение в BroadcastReceiver. Я не знаю, как обновить фрагмент вкладки здесь. Любые предложения или примеры?Как обновить вкладку фрагмента из BroadcastReceiver?
Я получаю этот журнал, когда флаг установлен, но я не KNW как оттуда:
public class MyReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
Toast.makeText(context, "hello :)", Toast.LENGTH_LONG).show();
}
}
Спасибо за помощь!
Фрагмент:
public class FragmentInfo extends Fragment {
private TextView textView1;
private TextView textView3;
private TextView textView5;
private TextView textView7;
private TextView textView8;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View myFragmentView = inflater.inflate(R.layout.fragment_info, container, false);
connectButton = (Button) myFragmentView.findViewById(R.id.button1);
changeSettingsButton = (Button) myFragmentView.findViewById(R.id.button2);
erraseFlightsButton = (Button) myFragmentView.findViewById(R.id.button3);
//TextView for status of connected device..
textView1 = (TextView)myFragmentView.findViewById(R.id.TextView1);
//TextView for Device name
textView3 = (TextView)myFragmentView.findViewById(R.id.TextView3);
//TextView for Serial number
textView5 = (TextView)myFragmentView.findViewById(R.id.TextView5);
//TextView for Software version
textView7 = (TextView)myFragmentView.findViewById(R.id.TextView7);
//TextView for Connected Device version
textView8 = (TextView)myFragmentView.findViewById(R.id.TextView8);
return myFragmentView;
}
}
добавьте код, который у вас есть для фрагмента вкладки –
Я добавил базовый код фрагмента. – anze87