android - In Child Activity, Fragment is recreated automatically - AppCompatViewInflater app:theme is now deprecated -
from mainactivity, start childactivity (which extends appcompatactivity) intent. purpose of child activity display fragments (welcome text user can fill edittext enter information).
intent myintent = new intent(this, createuseractivity.class); startactivityforresult(myintent, mainactivity.request_create_profile);
after few seconds, in activity, restarted...the view reloaded.
so annoying, because if in second fragment. activity restart , first one. user have restard work.
i've got following message in logcat when activity recreated :
08-07 20:45:37.673 8010-8010/com.xxxxx.xxxxxi/appcompatviewinflater﹕ app:theme deprecated. please move using android:theme instead.
any idea ?
childactivity code (relevant part):
@override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); intent intent = getintent(); setcontentview(r.layout.activity_main); // load layout createtoolbar(); setupprofile(); } @override public boolean onoptionsitemselected(menuitem item) { // handle action bar item clicks here. action bar // automatically handle clicks on home/up button, long // specify parent activity in androidmanifest.xml. int id = item.getitemid(); if (id == r.id.action_settings) { return true; } return super.onoptionsitemselected(item); } @override public void onbackpressed(){ //super.onbackpressed(); this.movetasktoback(true); } private boolean createtoolbar() { toolbar mtoolbar = (toolbar) findviewbyid(r.id.toolbar); setsupportactionbar(mtoolbar); mtoolbar.setnavigationicon(r.drawable.ic_drawer_white); //todo : isn't taking account...default icon not replaced - todo : understand why ??? mtoolbar.settitle("xxxxxx toolbar"); mtoolbar.setlogo(r.drawable.ic_menubar_v3); mtoolbar.setlogodescription(getresources().getstring(r.string.description)); mtoolbar.setnavigationcontentdescription(getresources().getstring(r.string.navigation_icon_description)); getsupportactionbar().setdisplayhomeasupenabled(true); getsupportactionbar().sethomebuttonenabled(true); getsupportactionbar().setdisplayshowtitleenabled(true); getsupportactionbar().settitle(null); return true; } //if first time app used, user needs create profile process private boolean setupprofile() { drawerlayout mdrawerlayout = (drawerlayout) findviewbyid(r.id.drawer_layout); setrequestedorientation(activityinfo.screen_orientation_nosensor); //disable orientation changes mdrawerlayout.setdrawerlockmode(drawerlayout.lock_mode_locked_closed); //disable drawer welcomefragment mywelcomefragment = welcomefragment.newinstance(); disableenablecontrols(false, (viewgroup) findviewbyid(r.id.root_linear_layout)); getsupportfragmentmanager().begintransaction() .replace(r.id.fragment_container3, mywelcomefragment).commit(); return true;
i have been having issue well, , have found because of custom support toolbar you're using. if not necessary, try stick conventional overflow menu
Comments
Post a Comment