just found out my mistake.
In my MainActivity.java i was importing android.support.v4.app.Fragment;
and in my LoginFragment.java i was importing android.app.Fragment;
. I changed it to the same thing and fm.findFragmentById(R.id.login_fragment)
now return the right fragment.