I have two activities in my app. One is a list that is presented when first launching the application. When the user selects it, the second activity is launched with an Intent
. The later takes information from the intent and performs a lengthy series of calculations (about 20 seconds). Here is what my second activity looks like:
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.second_screen);
Intent receivedIntent = getIntent();
Bundle MyBundle = receivedIntent.getExtras();
String myName = MyBundle.getString("selected");
/*
* Code for long operation here
*/
However, the user interface is not shown until the activity has finished the long operation, which I suspect is because it all takes place in onCreate()
(right?). So what can I do to fix this?