if I change the switch: MODE_NIGHT_YES to NO, nothing is changing in the app
I cannot find a sampe wirh the java Nerd 4 construction.
An InitApplication exist in the directory, but where should I implement folloeing lines to call the InitApplication?
The sample is based on a AppCompatActivity, but I have
Sample Code
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (InitApplication.getInstance().isNightModeEnabled()) {
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
} else {
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
}
setContentView(R.layout.activity_main);
**MainAcitivity**
public class Activity_MindX extends SingleFragmentActivity
{
private final String LOG = this.getClass().getName();
@Override
protected Fragment createFragment() {
return new FragmentMenuMindX();
}
// ################################################
public void onCardSetUpdated(CardSet cardset) {
// ################################################
FragmentManager fm = getSupportFragmentManager();
fm.findFragmentById(R.id.fragmentContainer);
}
in the Fragment
public class FragmentMenuMindX extends Fragment implements OnClickListener,
OnChartValueSelectedListener,
SeekBar.OnSeekBarChangeListener,
MindXconstants, MessageConst, DialogConstants {
}
int the FragemtActivity
@TargetApi(11)
@Override
// ################################################
public View onCreateView(LayoutInflater inflater, ViewGroup parent,
Bundle savedInstanceState) {
// ################################################
**AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);**
View v = inflater.inflate(R.layout.activity_menu_mind_x, parent, false