tab1과 tab3도 클래스가 있으며 tab1에서 단추를 클릭하고 tab3에서 textview를 변경하려고하지만 어쨌든 찾을 수 없습니다. 이 내 TAB1 클래스입니다하나의 탭에서 단추를 클릭하고 anoter 탭의 텍스트 뷰를 변경하십시오.
public class tab1Contacts extends Fragment{
TextView tv;
EditText et;
TextView tv3;
personInfo pı;
public personInfo returnpı(){
return pı;
}
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.tab1contents, container, false);
Button btn_jog = (Button) rootView.findViewById(R.id.jogging_button);
tv = (TextView) rootView.findViewById(R.id.newRecordText);
et = (EditText) rootView.findViewById(R.id.durationtext) ;
pı = new personInfo();
pı.eyesPower = 100;
pı.brainPower = 100;
pı.armsPower = 100;
pı.legsPower = 100;
pı.hearthPower = 100;
pı.energyLevel = 100;
pı.calorie = 2000;
pı.condition = 0;
btn_jog.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View v)
{
int duration = Integer.parseInt(et.getText().toString());
pı.jogging(duration);
//I want to change here textview in the tab3.
}
});
return rootView;
}
}
이 또한 내 tab3에 클래스 : tab3에이에서 이벤트를 수신하는
public class Tab3Contacts extends Fragment {
TextView tv3;
double newBrainpower;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.tab3contents, container, false);
tv3 = (TextView) rootView.findViewById(R.id.list_text) ;
return rootView;
}
}
getTabHost 메서드를 해결할 수 없습니다. –
사용자가 단추를 클릭하면 탭을 변경하고 싶지 않습니다. 나는 anoter 탭에서 textview를 변경하고 싶다. –