2016-09-01 2 views
1

enter image description here 내가 조각에 RecyclerView을 가지고 내가 아래 사용자 버튼을 누르면이 "새 행을 추가"때 여기까지 새로운 조각으로 리디렉션됩니다 원하는 텍스트 편집 내용에서 RecyclerView 목록 만들기 하지만 지금은 형태에 가득 자세한 내용은 동적 recyclerView에 행을 추가 할 수 있습니다 사용자가 위의 이미지에서 볼 수 있으며 모든 행의 교차 오른쪽 상단이 수 있듯이 recyclerview내가 그것을 달성 할 수있는 문제가없는

에서 새로운 행으로 표시됩니다 원하는 삭제하는 목록에서 행.

그래서, 내가 원하는 무엇

1) 내가 사용자를 누르 자마자 폼 입력을 가진 목록에 행을 추가 할 수있는 방법은 다음과 사용자 새로 추가 된 행을 보여 이벤트 저장 그의 난 형태로 사용자 입력을 목록에서 동적으로 행을 추가하고 또한

+0

갱신 목록 또는 어떤 컨테이너 어댑터가 – lelloman

+0

내가 아는 그 일에 notifyDataSetChanged() 또는 notifyItemChanged notifyItemInserted 등을 호출하지만 어떻게 폼 데이터 목록을 업데이트 한 후 사용하고는 관련 코드를 게시하시기 바랍니다 – androidXP

+0

어댑터 – lelloman

답변

0

내가 행 항목의 오른쪽 상단에서 사용자를 누르 크로스 버튼을 SOLV 때 목록에서 삭제하려는 한마디로

형태의 세부 사항을 입력 에드 내가 여기

은 내 양식 코드 (양식을 가지고있는) fragment_2에서 (recyclerview이있는) fragment_1하는 결과를 보내 두 번째 조각 먼저 내가 interface을 만들에서 다시 첫번째 조각에 데이터를 얻기 위해 무슨 짓을했는지 나 자신이 문제

@Override 
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { 
     View view=inflater.inflate(R.layout.ppl_details_form,container,false); 
     PPL_Title_Spinner= (Spinner) view.findViewById(R.id.PPL_Spinner); 
     Title= (EditText) view.findViewById(R.id.ppl_title); 
     Address= (AutoCompleteTextView) view.findViewById(R.id.ppl_address); 
     Year= (EditText) view.findViewById(R.id.ppl_passing_year); 
     Description= (EditText) view.findViewById(R.id.ppl_description); 
     btn1= (Button) view.findViewById(R.id.ppl_map_button); 

     Save= (Button) view.findViewById(R.id.ppl_save); 
     Save_PPL.setOnClickListener(new View.OnClickListener() { 
      @Override 
      public void onClick(View v) { 
       title=Title.getText().toString(); 
       address= Address.getText().toString(); 
       year=Year.getText().toString(); 
       description=Description.getText().toString(); 
       //PPL Wrapper 
       PPL_list_wrapper list=new PPL_list_wrapper(title,year,address); 

       Add_PPL=(PPL_transfer_data_to_list)getActivity(); 
       Add_PPL.addLocation(list); 
       fragment_1 fragment1=new fragment_1(); 
       FragmentTransaction fragmentTransaction=getFragmentManager().beginTransaction(); 
       fragmentTransaction.replace(R.id.Navigation_Main_Layout,fragment1); 
       fragmentTransaction.commit(); 

      } 
     }); 


    @Override 
    public void onAttach(Context context) { 
     super.onAttach(context); 
     try{ 
      Add_PPL= (PPL_transfer_data_to_list) context; 
     } 
     catch (ClassCastException e){ 
      throw new ClassCastException(getActivity().toString()+" Must Implement Interface"); 
     } 
    } 

그리고 내가 부모 활동에 infterface을 구현하고이

@Override 
    public void addEvent(PPL_list_wrapper PPL_DATA) { 
     fragment_1 recycler=new fragment_1(); 
     recycler.PPL_eve(PPL_DATA); 

    } 

T와 같은 활동에서 방법을 fragment_1 전화 암탉 나는 fragment_1에 데이터를 얻을 정적 목록이없는 static 원인은 너무 그것의 참조 데이터를 손실 할 조각에서의 ArrayList을해야하며 recyclerview에 데이터를 게재가 중단됩니다

public void PPL_eve(final PPL_list_wrapper ppl_list_wrapper){ 
     PPL_wrapper=ppl_list_wrapper; 
     event_details.add(ppl_list_wrapper);//Static ArrayList 
     adapter=new ppl_Recycler_Adapter(getActivity(),event_details); 
     adapter.notifyDataSetChanged(); 

    } 

내 목록이 고정되어 있는지 확인해야

static List<PPL_list_wrapper> event_details=new ArrayList<PPL_list_wrapper>(); 
관련 문제