2012-03-12 3 views

답변

1

그 목적으로 안드로이드의 tabHost 클래스를 사용할 수 있습니다. 목록에서 onItemClick에서 http://developer.android.com/reference/android/widget/TabHost.html

, 번들

에서 데이터를 제거 탭 활동에서

Intent intent = new Intent(FirstActivity.this,SecondActivity.class); 
Bundle b = new Bundle(); 
b.putString("name", name); 
intent.putExtras(b); 
startActivity(intent); 
finish(); 

를 고객 이름을 검색하고 의도에 넣어와 같은 tabActivity을 소비하는 클래스를 호출

Resources res = getResources(); // Resource object to get Drawables 
    TabHost tabHost = getTabHost(); // The activity TabHost 
    TabHost.TabSpec spec; // Resusable TabSpec for each tab 
    Intent intent; // Reusable Intent for each tab 

    // Create an Intent to launch an Activity for the tab (to be reused) 
    intent = new Intent().setClass(this, firsttabActivity.class); 
    // Initialize a TabSpec for each tab and add it to the TabHost 
    spec = tabHost.newTabSpec("first").setIndicator("first", res.getDrawable(R.drawable.ic_tab_shuffle)).setContent(intent); 
    tabHost.addTab(spec); 

    // Do the same for the other tabs 
    intent = new Intent().setClass(this, secondtabActivity.class); 
    spec = tabHost.newTabSpec("second").setIndicator("second", res.getDrawable(R.drawable.ic_tab_shuffle)).setContent(intent); 
    tabHost.addTab(spec); 

이제 고객 이름을 탭의 의도와 함께 전달하고 액티비티로 추출한 다음 고유 한 논리를 사용하여 고객 이름을 사용하여 고객 세부 정보를 검색 할 수 있습니다. 더 효과적인 방법이 있다면 나는 모른다. 이 일이 내 마음에 먼저왔다. 도움이되기를 바랍니다.

+0

TabActivity가 아닌 Activity 클래스를 확장하는 클래스가 있습니다. 그러한 대화에서 나는이 대화에 대해 의견을 나누고 싶습니다. 가능합니까? – Sebosin

+0

나는 약간 혼란 스럽다. u는 어떤 데이터와 다른 것들을 보여주는 활동을 가지고 있으며 그 데이터에도 탭을 추가하고 싶습니까? 아니면 탭이있는 활동입니까? –

+0

내 주요 활동에서 고객 목록을 보여줍니다. 하나를 선택하면 다른 탭의 연락처 정보와 다른 탭의 결제 정보 및지도를 표시하는 탭이있는 대화 상자를 열어야합니다. – Sebosin

관련 문제