나는 현재 주로 내가 심각하게 데모가 listFragment에서 세부 조각을 시작하는 방식, 인터페이스에 의해 혼동 된FragmentTransactions 또는 .commit없이 단편을 초기화 하시겠습니까? 잘못된?
(https://android.googlesource.com/platform/development/+/master/samples/WiFiDirectDemo/src/com/example/android/wifidirect) 아래에 나열된 구글의 데모를, 다음으로, 와이파이 다이렉트를 파악하고
: 우리는 다음 detailFragment 자신의 showDetails bouncedto (장치)) 방법입니다@Override
public void showDetails(WifiP2pDevice device) {
DeviceDetailFragment fragment = (DeviceDetailFragment) getFragmentManager()
.findFragmentById(R.id.frag_detail);
fragment.showDetails(device);
}
아래와 같이 부모 호스트 활동에서 호출 (showDetails (장치)),
public void showDetails(WifiP2pDevice device) {
this.device = device;
this.getView().setVisibility(View.VISIBLE);
TextView view = (TextView) mContentView.findViewById(R.id.device_address);
view.setText(device.deviceAddress);
view = (TextView) mContentView.findViewById(R.id.device_info);
view.setText(device.toString());
}
코드를 통해 검색 했으므로 어디에도 .commit() 또는 FragmentTransaction이 없습니다. 나는 그것이 .getView.SET_VISIBILITY 호출이라고 생각하지만 .commit이 없으면 아무 일도 일어나지 않을 것입니다. 어떤 도움을 주시면 감사하겠습니다!
아, 방금 찾았습니다. 나는 이런 식으로 조각을 사용한 적이 없다. 고맙습니다! –