How to solve "Unknown method 'executePendingTransactions'"?

207 views Asked by At

The full error is: "Unknown method 'executePendingTransactions' of 'android.support.v4.app.FragmentTransaction".

The detail is that I'm programming with AIDE.

I've imported the following packages (I've imported more, but these are the most relevant, I think):

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.support.v4.app.FragmentManager;
import android.support.v7.app.AppCompatActivity;

Must I update a think? How can I solve this problem?

1

There are 1 answers

0
private static On BEST ANSWER

Unknown method 'executePendingTransactions' of 'android.support.v4.app.FragmentTransaction.

You should be calling executePendingTransactions on the FragmentManager not FragmentTransaction.

FragmentManager mFragmentManager = getSupportFragmentManager();
FragmentTransaction mFragmentTransaction = mFragmentManager.beginTransaction();
Fragment fragment = mFragmentManager.findFragmentById(R.id.main_content);
mFragmentManager.executePendingTransactions();