0
너무 혼란 스럽습니다.이 탭 호스트로 매개 변수를 전달하는 방법을 알려주십시오. 첫 번째 및 두 번째 탭에서 매개 변수를 전달하고 싶습니다. 여기에 내 코드입니다 :탭을 사용하여 매개 변수를 전달하는 방법은 무엇입니까?
public class TabBarActivity_BalanceInquiry extends TabActivity {
/** Called when the activity is first created. */
public static String varbalMessageType;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main2);
setTabs() ;
varbalMessageType = getIntent().getExtras().getString("mno");
}
private void setTabs(){
addTab("payments", R.drawable.tab_home, AgAppAskPinForTransaction.class);
addTab("My Account", R.drawable.tab_home, AgAppMyAccountScreen.class);
addTab("Spend Analyzer", R.drawable.tab_home, AgAppPaymentScreen.class);
addTab("Notification", R.drawable.tab_home, AgAppPaymentScreen.class);
addTab("Help", R.drawable.tab_home, AgAppPaymentScreen.class);
}
private void addTab(String labelId, int drawableId, Class<?> c)
{
TabHost tabHost = getTabHost();
Intent intent = new Intent(this, c);
TabHost.TabSpec spec = tabHost.newTabSpec("tab" + labelId);
View tabIndicator =
LayoutInflater.from(this).inflate(R.layout.tab_indicator, getTabWidget(), false);
TextView title = (TextView) tabIndicator.findViewById(R.id.title);
title.setText(labelId);
ImageView icon = (ImageView) tabIndicator.findViewById(R.id.icon);
icon.setImageResource(drawableId);
spec.setIndicator(tabIndicator);
spec.setContent(intent);
tabHost.addTab(spec);
}
}
아니요 탭 사이에 없습니다. myactivity1.class와 같은 다른 활동에서 탭 활동 1로 전달하고 싶습니다. 어떻게 이렇게 전달합니까 ?? –
하지만 다른 4 가지 활동에 대해 ur 코드는 1 개의 활동으로 만 불리십니까? 어떻게 부르니? 위의 내 소스 코드는 모든 탭 텍스트 이름과 drawable 자동으로 그래서 내가 어떻게 imact 텍스트 탭을 eact 텍스트 탭을 설정합니까? 그냥 내 코드의 어떤 부분을 수정 말해 줘 ??? 그리고 어떻게 –
나쁜 지름길, 정적 변수를 사용합니까? –