Cody
Cody

Reputation: 25

Android keep my layout from timing out

Hey, So I've pretty much got my applications code down, but I'm having an issue with one of my classes. The Layout for my game board is pretty extensive and takes a long time(as far as android is concerned) to build. To make the game playable there is a large amount of input from a bunch of buttons and a lot of code that takes a long time. Although my layout by itself loads without an issue, when I throw the running code into the class's onCreate() the application dies. How could I keep my application from timing out? Would making another class that does all of the game actions or would it still time out?

Upvotes: 0

Views: 63

Answers (1)

Haphazard
Haphazard

Reputation: 10948

Make that second class and turn it into an AsyncTask. This will allow you to do the heavy lifting in the background while showing a friendly spinner to the user. The official tutorial can be found here.

Upvotes: 1

Related Questions