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.

Fragment Issue with Data Binding

See original GitHub issue

I saw #29 Fragment Issue for loading fonts. May Its working fine with LayoutInflater like

LayoutInflater mInflater = getActivity().getLayoutInflater();

But I have used Data Binding Library with Fragment so I am inflating view like:

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {

        orderListBinding = DataBindingUtil.inflate(inflater, R.layout.fragment_order_list, container, false);

        // Inflate the layout for this fragment
        return orderListBinding.getRoot();
    }

How can I solve it for Data Binding? Any Help please.

Issue Analytics

  • State:open
  • Created 7 years ago
  • Reactions:1
  • Comments:18 (6 by maintainers)

github_iconTop GitHub Comments

9reactions
af-abecommented, Oct 26, 2016

Hi, i am using databinding too. I dont get this issue. Did you init the lib the right way in the parent activity?

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        CalligraphyConfig.initDefault(new CalligraphyConfig.Builder()
                .setFontAttrId(R.attr.fontPath)
                .build()
        );
    }

    @Override
    protected void attachBaseContext(Context newBase) {
        super.attachBaseContext(CalligraphyContextWrapper.wrap(newBase));
    }
1reaction
chrisjenxcommented, Apr 9, 2017

This is only applied to the Activity. Fragments extend from the Activity. No need to do anything else.

On Sat, 8 Apr 2017 at 19:21 Deshar Sunil notifications@github.com wrote:

How to use this function on a fragment !

@Override https://github.com/Override protected void attachBaseContext(Context newBase) { // Set Default Font super.attachBaseContext(CalligraphyContextWrapper.wrap(newBase)); }

Can you guyz provide more information ! Its not enough to move on !

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/chrisjenx/Calligraphy/issues/342#issuecomment-292736266, or mute the thread https://github.com/notifications/unsubscribe-auth/ABHRsZL13DIret3PqBmoDLn0lcINxefvks5rt9AegaJpZM4Kfi14 .

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to use data-binding with Fragment - Stack Overflow
The data binding implementation must be in the onCreateView method of the fragment, delete any data Binding that exist in your OnCreate method, ......
Read more >
View Binding - Android Developers
Data binding library ... Overview · Create a fragment · Fragment manager · Fragment transactions ... Support. Known issues · StackOverflow.
Read more >
View Binding with Fragments in Android Jetpack
View Binding with Fragments in Android Jetpack · Step 1: Create a new empty activity project · Step 2: Enable the ViewBinding feature...
Read more >
The ViewDataBinding.OnStartListener lifecycle observer leaks ...
We might actually have 2 issues here. Data Binding assumes it owns the view and the given lifecycle, which is not a correct...
Read more >
Simple one-liner ViewBinding in Fragments and Activities with ...
There's a new feature in Android Studio 3.6 called “view binding”. It's just like databinding, except all it does is take your existing...
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