0

상술 한 도시 I가 별도로 3 개 단편을 호스팅 할내 두 단편 I는 활동이 다른

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" 
      xmlns:tools="http://schemas.android.com/tools" 
      android:id="@+id/container" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      tools:context="com.example.stopcall.app.activities.dele_MainActivity2_with_Fragment" 
      tools:ignore="MergeRootFrame"/> 

을 (단지 도시 하나 개마다) :

읽기DB 조각에 Item 추가

가 어떻게 설계하고이를 구현하는 것이 좋습니다 것 DB

설정 조각에서? 적절한 방법은 무엇입니까?

+0

당신은 추가 모두 같은 컨테이너에서 조각하는 작업을 수행. 한 번에 하나씩 만 표시해야한다면'replace' 메소드는'add'가 아닙니다. 하지만 동시에 두 가지를 모두 표시해야하는 경우 다른 컨테이너에 추가하십시오. 내 대답 – Rohit5k2

답변

0

동일한 컨테이너에 두 조각을 모두 추가합니다. 한 번에 하나씩 만 표시해야하는 경우이 작업을 수행하십시오.

getSupportFragmentManager().beginTransaction() 
    .add(R.id.container, new SettingsFragment()).commit(); 

getSupportFragmentManager().beginTransaction(
    .replace(R.id.container, new AddReminderFragment()).commit(); 

하지만 함께 모두를 표시해야하는 경우 다음 새 컨테이너를 만듭니다 (예를 들어 R.id.container_two)이

getSupportFragmentManager().beginTransaction() 
    .add(R.id.container, new SettingsFragment()).commit(); 
getSupportFragmentManager().beginTransaction() 
    .add(R.id.container_two, new AddReminderFragment()).commit(); 
+0

을보고 어떻게 하나의 조각에서 두 번째로 이동합니까? 하나의 컨테이너로? –

+0

ahh 나는 교체를 본다. 및 다른 모든 동적 인 방법으로 모든 조각을 설정하고 그들 사이를 이동합니까? –

+0

이것은 당신이 무엇을하려고하는지에 달려 있습니다. 이 코드를 사용해보고 문제가 해결되었는지 확인하십시오. – Rohit5k2