문제

생성이 가능한가요? Dialog 그건 Tab에스?

가능하다면 다음 중 하나를 선택하여 Tabs 나 전화해야 해 Activity, 값을 통해 값을 전달할 수 있습니까? Bundle?

도움이 되었습니까?

해결책

해당 목적으로 Android의 tabhost 클래스를 사용할 수 있습니다. "NoFollow"> http://developer.android.com/reference/android/widget/tabhost.html.

목록의 OnItemClick에서 고객 이름을 검색하고이를 의도에 넣고 다음과 같은 tabactivity를 소비하는 클래스를 호출하십시오.

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

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

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);
.

이제 탭의 의도와 함께 고객 이름을 전달하고 활동을 추출하고 고객 이름을 사용하여 고객 이름을 사용하여 고객 이름을 검색 할 수 있습니다. 나는 그것을 할 수있는 더 효과적인 방법이 있는지 모르겠다.이것은 방금 내 마음에 먼저 일어났습니다. 나는 그것이 도움이되기를 바랍니다.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top