1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
public void methode_f3(int m3) {
Integer i3 = m3;
FragmentTransaction aft32 = afm.beginTransaction();
mFragment2 = (Fragment2) afm.findFragmentByTag("f2");
if (mFragment2 == null) {
mFragment2 = new Fragment2();
aft32.add(R.id.Container_fragment2,mFragment2,"f2");
}
else {
aft32.replace(R.id.Container_fragment2,mFragment2);
}
aft32.addToBackStack(null);
aft32.commit();
FrameLayout fr = (FrameLayout) findViewById(R.id.Container_fragment2);
TextView textDynamic = new TextView(this);
LayoutParams lp = new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
textDynamic.setLayoutParams(lp);
textDynamic.setText("Valeur de i3 : "+ i3.toString());
textDynamic.setTextColor(Color.BLUE);
textDynamic.setTextSize(20);
textDynamic.setPadding(10, 10, 10, 10);
fr.addView(textDynamic);
} |
Partager