Please check my code for this:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
JSONObject jsonlayout = null ;
try {
jsonlayout = new JSONObject(loadJSONFromAsset(getContext()));
} catch (JSONException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
ProteusLayoutInflater layoutInflater = (ProteusLayoutInflater)inflater;
ProteusView view = layoutInflater.inflate(jsonlayout.toString(), null, container, 0);
return view.getAsView();
}
I want to use the Proteus library to create a view and render it as a fragment.
Can you please tell me what I did wrong? With this code I'm getting the following error:
com.android.internal.policy.PhoneLayoutInflater cannot be cast to com.flipkart.android.proteus.ProteusLayoutInflater
Here is some sample code for the
Fragment
that should get you started:In your Fragment add and modify according to the following:
This is essentially a working example with a lot of space for enhancement and improvement. You should head to the git repo, clone it, play around with the demo app and check out the code for ProteusActivity for a reference implementation.