は、私は、行項目の右上にユーザープレス十字ボタンをSOLVとき、リストから削除したい要するに
形式で詳細を入力ED私は(フォームを持っている)fragment_2から(recyclerviewを有する)fragment_1し、結果を送信するためにinterface
を作成する私は2番目のフラグメント まずから戻って最初のフラグメントにデータを取得するためにやった自分でこの問題
は、ここに私のフォームコードです
@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>();
アダプタ – lelloman
上など、私が知っている事をあなたのリストを更新したり、アダプタが使用しているものは何でも、コンテナ、その後notifyDataSetChanged(コール)またはnotifyItemChanged notifyItemInsertedが、どのように – androidXP
フォームデータとのリストを更新するために、関連するコード – lelloman