i want to call LayoutInflater from static method as below :
private static void inflateLayout_keluarga_pp(int counter2, String name) {
LayoutInflater inflater = (LayoutInflater)getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
rowView = inflater.inflate(R.layout.layoutkeluarga, null);
..................
..................
}
this is how i call method inflateLayout_keluarga_pp
:
public static void onRetrieve(int position){
List<ModelKeluargaPP> mk = helper.getSelectTable_Marital();
for (int i=0; i<mk.size();i++){
inflateLayout_keluarga_pp(i,mk.get(position).getAnggota_pp());
}
}
but i got error in getActivity()
, they said : Cannot make a static reference to the non-static method getActivity() from the type Fragment
i need to make this method into static. how to fix it? i hope someone can help to solve my problem, thank you.