How do I use the deprecated getFragmentManager() in API Level 28?Problem Writing Files problem in Android EmulatorAndroid simple login screen crashes app when logging, no errors in eclipse. Which java class activity is at fault?Force close onClick of ImageButton, can't figure out whyWebview scale is changed in androidGoogle map API v2[Android]Object cannot be cast to java.lang.String AsynctaskWhy the values are not being inserted in the database?How to get selected items in a custom listview to another activity in same custom listviewYouTube Player crashes (java.lang.NullPointerException, null object reference)This use Navigation Drawer, and use Tab, and use Fragment. how communication between FragmentActivity and Fragment?

What food production methods would allow a metropolis like New York to become self sufficient

How can I answer high-school writing prompts without sounding weird and fake?

Would an 8% reduction in drag outweigh the weight addition from this custom CFD-tested winglet?

How to make the table in the figure in LaTeX?

How can a Lich look like a human without magic?

51% attack - apparently very easy? refering to CZ's "rollback btc chain" - How to make sure such corruptible scenario can never happen so easily?

Should these notes be played as a chord or one after another?

Is a diamond sword feasible?

Early arrival in Australia, early hotel check in not available

Increase height of laser cut design file for enclosure

International Code of Ethics for order of co-authors in research papers

Adding slope values to attribute table (QGIS 3)

Two researchers want to work on the same extension to my paper. Who to help?

Noob at soldering, can anyone explain why my circuit won't work?

Is there enough time to Planar Bind a creature conjured by a 1-hour-duration spell?

Ubuntu won't let me edit or delete .vimrc file

How can this pool heater gas line be disconnected?

How are Core iX names like Core i5, i7 related to Haswell, Ivy Bridge?

Can 'sudo apt-get remove [write]' destroy my Ubuntu?

Drawing Quarter-Circle

Is Simic Ascendancy triggered by Awakening of Vitu-Ghazi?

How could we transfer large amounts of energy sourced in space to Earth?

histogram using edges

How are one-time password generators like Google Authenticator different from having two passwords?



How do I use the deprecated getFragmentManager() in API Level 28?


Problem Writing Files problem in Android EmulatorAndroid simple login screen crashes app when logging, no errors in eclipse. Which java class activity is at fault?Force close onClick of ImageButton, can't figure out whyWebview scale is changed in androidGoogle map API v2[Android]Object cannot be cast to java.lang.String AsynctaskWhy the values are not being inserted in the database?How to get selected items in a custom listview to another activity in same custom listviewYouTube Player crashes (java.lang.NullPointerException, null object reference)This use Navigation Drawer, and use Tab, and use Fragment. how communication between FragmentActivity and Fragment?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








-1















In API level 28, getFragmentManager() is deprecated. I have used this FragmentActivity.getSupportFragmentManager() is solution for this. But how can I implement that in my code.



Here my activity class code.



 public class AttendanceActivity extends FragmentActivity 

@Override
protected void onCreate(Bundle savedInstanceState)
super.onCreate(savedInstanceState);
setContentView(R.layout.attendence_common_layout);

if (findViewById(R.id.attendance_fragment_container) != null)
if (savedInstanceState != null)
return;

getFragmentManager().beginTransaction().add(R.id.attendance_fragment_container, new FragmentAttendance()).addToBackStack(null).commit();



@Override
public void onBackPressed()
super.onBackPressed();
ActivityUtils.startActivity(this);













share|improve this question



















  • 2





    AndroidStudio has nothing to do with that .. So try not to mention it in title and in tags . Its an IDE .

    – ADM
    Jan 21 at 8:21












  • @ADM Thank you very much for your valuable suggestion.

    – Masum
    Mar 25 at 9:40

















-1















In API level 28, getFragmentManager() is deprecated. I have used this FragmentActivity.getSupportFragmentManager() is solution for this. But how can I implement that in my code.



Here my activity class code.



 public class AttendanceActivity extends FragmentActivity 

@Override
protected void onCreate(Bundle savedInstanceState)
super.onCreate(savedInstanceState);
setContentView(R.layout.attendence_common_layout);

if (findViewById(R.id.attendance_fragment_container) != null)
if (savedInstanceState != null)
return;

getFragmentManager().beginTransaction().add(R.id.attendance_fragment_container, new FragmentAttendance()).addToBackStack(null).commit();



@Override
public void onBackPressed()
super.onBackPressed();
ActivityUtils.startActivity(this);













share|improve this question



















  • 2





    AndroidStudio has nothing to do with that .. So try not to mention it in title and in tags . Its an IDE .

    – ADM
    Jan 21 at 8:21












  • @ADM Thank you very much for your valuable suggestion.

    – Masum
    Mar 25 at 9:40













-1












-1








-1








In API level 28, getFragmentManager() is deprecated. I have used this FragmentActivity.getSupportFragmentManager() is solution for this. But how can I implement that in my code.



Here my activity class code.



 public class AttendanceActivity extends FragmentActivity 

@Override
protected void onCreate(Bundle savedInstanceState)
super.onCreate(savedInstanceState);
setContentView(R.layout.attendence_common_layout);

if (findViewById(R.id.attendance_fragment_container) != null)
if (savedInstanceState != null)
return;

getFragmentManager().beginTransaction().add(R.id.attendance_fragment_container, new FragmentAttendance()).addToBackStack(null).commit();



@Override
public void onBackPressed()
super.onBackPressed();
ActivityUtils.startActivity(this);













share|improve this question
















In API level 28, getFragmentManager() is deprecated. I have used this FragmentActivity.getSupportFragmentManager() is solution for this. But how can I implement that in my code.



Here my activity class code.



 public class AttendanceActivity extends FragmentActivity 

@Override
protected void onCreate(Bundle savedInstanceState)
super.onCreate(savedInstanceState);
setContentView(R.layout.attendence_common_layout);

if (findViewById(R.id.attendance_fragment_container) != null)
if (savedInstanceState != null)
return;

getFragmentManager().beginTransaction().add(R.id.attendance_fragment_container, new FragmentAttendance()).addToBackStack(null).commit();



@Override
public void onBackPressed()
super.onBackPressed();
ActivityUtils.startActivity(this);










android android-fragments






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 23 at 10:44









Bhargav Rao

31.4k2093114




31.4k2093114










asked Jan 21 at 8:15









MasumMasum

484520




484520







  • 2





    AndroidStudio has nothing to do with that .. So try not to mention it in title and in tags . Its an IDE .

    – ADM
    Jan 21 at 8:21












  • @ADM Thank you very much for your valuable suggestion.

    – Masum
    Mar 25 at 9:40












  • 2





    AndroidStudio has nothing to do with that .. So try not to mention it in title and in tags . Its an IDE .

    – ADM
    Jan 21 at 8:21












  • @ADM Thank you very much for your valuable suggestion.

    – Masum
    Mar 25 at 9:40







2




2





AndroidStudio has nothing to do with that .. So try not to mention it in title and in tags . Its an IDE .

– ADM
Jan 21 at 8:21






AndroidStudio has nothing to do with that .. So try not to mention it in title and in tags . Its an IDE .

– ADM
Jan 21 at 8:21














@ADM Thank you very much for your valuable suggestion.

– Masum
Mar 25 at 9:40





@ADM Thank you very much for your valuable suggestion.

– Masum
Mar 25 at 9:40












1 Answer
1






active

oldest

votes


















1














Instead of



public class AttendanceActivity extends FragmentActivity


use



public class AttendanceActivity extends AppCompatActivity


Then, change the below line



getFragmentManager().beginTransaction()....


with



getSupportFragmentManager().beginTransaction()....


Make sure FragmentAttendance is declared like this:



public class FragmentAttendance extends android.support.v4.app.Fragment





share|improve this answer

























    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54285773%2fhow-do-i-use-the-deprecated-getfragmentmanager-in-api-level-28%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    Instead of



    public class AttendanceActivity extends FragmentActivity


    use



    public class AttendanceActivity extends AppCompatActivity


    Then, change the below line



    getFragmentManager().beginTransaction()....


    with



    getSupportFragmentManager().beginTransaction()....


    Make sure FragmentAttendance is declared like this:



    public class FragmentAttendance extends android.support.v4.app.Fragment





    share|improve this answer





























      1














      Instead of



      public class AttendanceActivity extends FragmentActivity


      use



      public class AttendanceActivity extends AppCompatActivity


      Then, change the below line



      getFragmentManager().beginTransaction()....


      with



      getSupportFragmentManager().beginTransaction()....


      Make sure FragmentAttendance is declared like this:



      public class FragmentAttendance extends android.support.v4.app.Fragment





      share|improve this answer



























        1












        1








        1







        Instead of



        public class AttendanceActivity extends FragmentActivity


        use



        public class AttendanceActivity extends AppCompatActivity


        Then, change the below line



        getFragmentManager().beginTransaction()....


        with



        getSupportFragmentManager().beginTransaction()....


        Make sure FragmentAttendance is declared like this:



        public class FragmentAttendance extends android.support.v4.app.Fragment





        share|improve this answer















        Instead of



        public class AttendanceActivity extends FragmentActivity


        use



        public class AttendanceActivity extends AppCompatActivity


        Then, change the below line



        getFragmentManager().beginTransaction()....


        with



        getSupportFragmentManager().beginTransaction()....


        Make sure FragmentAttendance is declared like this:



        public class FragmentAttendance extends android.support.v4.app.Fragment






        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Jan 21 at 8:27

























        answered Jan 21 at 8:18









        Sneh PandyaSneh Pandya

        4,78352243




        4,78352243





























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54285773%2fhow-do-i-use-the-deprecated-getfragmentmanager-in-api-level-28%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

            Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

            Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript