2014-12-25 5 views
-2

왜 지원 조각의 일부 정적 컨텐츠에 액세스하지 못 했습니까?
는 MapFragment.ARG_PLANET_NUMBER가 ARG_PLANET_NUMBER가 해결되지 또는 필드SupportMapFragment issue

답변

0

초기화하시기 바랍니다 정적 변수 ARG_PLANET_NUMBERMapFragment에서 클래스없는 수 없다는 내 코드

Fragment fragment = new PlanetFragment(); 
Bundle args = new Bundle(); 
args.putInt(MapFragment.ARG_PLANET_NUMBER, position); 
fragment.setArguments(args); 

public class MapFragment extends SupportMapFragment 
{ 
    protected View originalContentView; 
    protected MapWrapperLayout mapWrapperLayout; 
    @Override 
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) 
    { 
     originalContentView = super.onCreateView(inflater, container, savedInstanceState); 
     mapWrapperLayout = new MapWrapperLayout(RContextHelper.getActivity()); 
     mapWrapperLayout.addView(originalContentView); 
     return mapWrapperLayout; 
    } 
    @Override 
    public void onCreate(Bundle savedInstanceState) 
    { 
     super.onCreate(savedInstanceState); 



    } 

} 

참조하십시오. 예 :

public class MapFragment extends SupportMapFragment 
{ 
    //initialize this variable 
    public static int ARG_PLANET_NUMBER = 1; 

    protected View originalContentView; 
    protected MapWrapperLayout mapWrapperLayout; 
    @Override 
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) 
    { 
     originalContentView = super.onCreateView(inflater, container, savedInstanceState); 
     mapWrapperLayout = new MapWrapperLayout(RContextHelper.getActivity()); 
     mapWrapperLayout.addView(originalContentView); 
     return mapWrapperLayout; 
    } 
    @Override 
    public void onCreate(Bundle savedInstanceState) 
    { 
     super.onCreate(savedInstanceState); 



    } 

} 
+0

ARG_PLANET_NUMBER이 Fragment 클래스의 일부라고 생각합니다. 회신에 대한 감사합니다. – Ali

관련 문제