Skip to content Skip to sidebar Skip to footer

Android Layout Only Showing After Oncreate Method Finishes

I have created (what I thought was) a simple JAVA card game. In JAVA, the game loads the layout (frame) and displays ImageButtons consisting of a square like cardholder image for

Solution 1:

You should move the code that populates the cards into your activity's onResume() method - probably some sort of AsyncTask kicked off by onResume() that does the work over time, so that the user can visually see the changes.

The onResume() method is invoked when Android actually displays your activity on-screen; if you do do everything in onCreate() all work will be completed before your app ever appears on-screen - which is producing the results you're seeing.

Google has some good online documentation on how the activity lifecycle works.

Post a Comment for "Android Layout Only Showing After Oncreate Method Finishes"