question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Used this in a Fragment, but getting an error while casting inflater - please help

See original GitHub issue

please check my coding for this ProteusLayoutInflater layoutInflater = (ProteusLayoutInflater)inflater;

ProteusView view = layoutInflater.inflate(jsonlayout.toString(), null, container, 0);

return view.getAsView();

i want to use library send json object and create a view and render it as a fragment. can you please help what i did wrong? for the coding im getting the following error

com.android.internal.policy.PhoneLayoutInflater cannot be cast to com.flipkart.android.proteus.ProteusLayoutInflater

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
adityasharatcommented, Dec 16, 2017

Urge you post your questions on StackOverflow using the proteus tag.

It might be that the following lines are the cause of the exception:

ProteusLayoutInflater layoutInflater = (ProteusLayoutInflater) inflater;

Without looking a more code, it is hard to answer your question.

  1. What is the type of inflater?
  2. Why aren’t your using the ProteusBuilder?
  3. The first argument to layoutInflater.inflate() is a Layout not a String. Why?

Please check out the readme for a correct usage and please post the question in SO and I will be to happy to help. 😄

0reactions
adityasharatcommented, Dec 18, 2017

Answered here

Read more comments on GitHub >

github_iconTop Results From Across the Web

Used Proteus in an Android Fragment, but getting an error ...
I want to use the Proteus library to create a view and render it as a fragment. Can you please tell me what...
Read more >
Fragment cast error (Example) | Treehouse Community
Hi , in Fragment Course I get some error in displaying the list and the error I get in this line OnRecipeSelectedInterface listener...
Read more >
Fragment | Android Developers
A Fragment is closely tied to the Activity it is in, and can not be used ... Gets whether you should show UI...
Read more >
Applying Data Binding for Views | CodePath Android Cliffnotes
If you see an error message such as cannot resolve symbol 'ActivityMainBinding' then this means that the data binding auto-generated class has not...
Read more >
Android Passing Data Between Fragments | DigitalOcean
The displayReceivedData() would be called on the instance of FragmentTwo.java from inside the Custom Interface's method inside the MainActivity.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found