0

안드로이드 타블렛 용으로 개발 중이며 여러 개의 색환 뷰가 포함 된 여러 개의 ViewGroups (LinearLayouts)가있는 조각 인 탭 하나가 있습니다.이 탭에는 연결된 숫자 데이터 객체가 있습니다. (스크린 샷 참조)Android 태블릿 개발 - SQLite DB에서 여러 개의 비 목록보기를 자동으로 채우시겠습니까?

메시지가 네트워크에서 들어오고 각 원보기와 관련된 데이터 객체 수를 업데이트합니다. 그들이 SQLite DB에 추가하려고합니다. 그 변화가 청취하는 ViewGroup을 자동으로 업데이트 할 때. 그러면 각 CircleView와 연관된 데이터 객체의 수와 내용이 업데이트됩니다.

나는 콘텐츠 제공 업체, 어댑터 등을 조사 해왔다. 그러나 이것들은 전화기와 같은 전체 화면을 차지하는 listviews를 지향하고있는 것처럼 보인다. 질문 DB의 변경 사항을 기반으로 조각 내에서 자동으로 이러한 뷰를 효율적으로 업데이트하려면 어떻게해야합니까? 어떤 메커니즘을 사용하며 어떻게 사용합니까? 나는 많은 데드 엔드에왔다. (내 제한된 안드로이드 개발자의 경험에 기초)

어떤 통찰력도 좋을 것입니다! 감사합니다

난 내보기를 설정

탭 조각 :

public class TheoryFragment extends Fragment { 


    private ViewGroup theoriesView; 
    private HashMap<String, TheoryPlanetView> theoryViewsToAnchors = new HashMap<String, TheoryPlanetView>(); 
    private GestureDetector gestureDetector;  
    private SimpleCursorAdapter dataAdapter; 

    @Override 
    public View onCreateView(LayoutInflater inflater, ViewGroup container, 
      Bundle savedInstanceState) { 

     theoriesView = (ViewGroup) inflater.inflate(R.layout.theories_activity_vertical, 
       container, false); 

     setupListeners(); 

     return theoriesView; 
    } 

    /** 
    * Setups the listeners 
    */ 
    private void setupListeners() { 
     //add listeners to all the draggable planetViews 
     // get all the colors and the 
     int childCount = theoriesView.getChildCount(); 
     for (int i = 0; i < childCount; i++) { 
      View possibleView = theoriesView.getChildAt(i); 
      if(possibleView instanceof TheoryPlanetView) { 
       TheoryPlanetView tv = (TheoryPlanetView) possibleView; 
       tv.setOnDragListener(new TargetViewDragListener()); 

       theoryViewsToAnchors.put(tv.getAnchor(), tv); 
      } 
     } 

     ViewGroup planetColorsView = (FrameLayout)    theoriesView.findViewById(R.id.colors_include); 
     // get all the colors and the 
     childCount = planetColorsView.getChildCount(); 
     for (int i = 0; i < childCount; i++) { 
      View color = planetColorsView.getChildAt(i); 
      color.setOnTouchListener(new CircleViewDefaultTouchListener()); 
     } 
    } 

} 

screen shot

답변

0

질문을 이해하는 몇 가지 문제를 갖는하지만 기본적으로 당신이 원하는 비동기 작업 http://developer.android.com/reference/android/os/AsyncTask.html

을 사용 네트워크 또는 db 물건을 배경 스레드. > 진행률 표시 줄 등

doInBackground를 (시작) - - 작업이 완료 안드로이드 의지 자동 방법

onPreexecute()를 실행하는 것입니다> 네트워크/DB

onPostExecute() -> (당신의 UI를 업데이트

만약 이것이 충분하지 않다면, 옵저버 패턴을 볼 수도 있습니다.