当我在 android 模拟器上运行我的应用程序时,log-cat 告诉我它跳过了 70 帧(当应用程序开始启动时)并且它可能在主线程上做的太多了。如何分散负载或提高应用程序的性能。我需要在启动时加载屏幕吗?
这是我的启动活动,
package com.the.maze;
import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;
public class TheMazeActivity extends ListActivity{
String list[]={"New Game","Highscores","How to play","Settings","About"};
Class classes[]={GameActivity.class,null,Instructions.class,null,null};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setListAdapter(new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1, list));
}
@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
super.onListItemClick(l, v, position, id);
try{
Intent intent= new Intent(TheMazeActivity.this,classes[position]);
startActivity(intent);
}catch(Exception e){
e.printStackTrace();
}
}
}