Я сталкиваюсь с проблемой IonWrapper, когда собираюсь преобразовать Activity в фрагмент:
IonWrapper (Context, com.codingvisions.chat_fcm.helper.IonWrapper.WebServiceInterFace) в IonWrapper нельзя применять к (FragmentActivity,android.support.v4.app.FragmentActivity)
Я пытался дважды передать getActivity в IonWrapper.
/* Original function Activity */
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_richiesta_invio_pacco);
customAlertDialog = new CustomAlertDialog(this);
sharedPrefsHelper = new SharedPrefsHelper(this);
webServices = new WebServices(this, new IonWrapper(this, this));
sqliteDbManager = new SqliteDbManager(this);
DataPartenzaInput = (TextInputEditText)findViewById(R.id.data_partenza_pacco);
DimensioniInput = (TextInputEditText)findViewById(R.id.dimensioni_input);
VaiButton = (Button)findViewById(R.id.vai_button);
}
/* Function in Fragment */
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_richiesta_pacco, container, false);
/* .... */
customAlertDialog = new CustomAlertDialog(getActivity());
sharedPrefsHelper = new SharedPrefsHelper(getActivity());
webServices = new WebServices(this, new IonWrapper(getActivity(), getActivity()));
sqliteDbManager = new SqliteDbManager(getActivity());
/* ....*/
/* Constructor IonWrapper
public IonWrapper(Context context, WebServiceInterFace webServiceInterFace) {
this.context = context;
this.webServiceInterFace = webServiceInterFace;
}
*/
}