活动开始缓慢

时间:2014-12-19 18:52:49

标签: android android-activity lag layout-inflater android-inflate

我的应用中有几个按钮。每当我按下任何按钮时,新活动就会快速启动。它开了一个新活动滞后。为什么它会滞后?  这是代码snipet:

        Intent intent = new Intent(this, ChooseActivity.class);
        startActivityForResult(intent, Constant.MP_REQUEST);

ChooseActivity.class:

    ChooseActivityHelper mActivityHelper;

    public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity);
    mActivityHelper = new ChooseActivityHelper(this);

    mActivityHelper.inflateView();
}

ChooseActivityHelper:

public ChooseActivityHelper(Context ctx) {
    mCurrentTabIndex = 1;
    mContext = ctx;
}

// inflate data to view
    @SuppressLint("UseSparseArrays")
    public void inflateView() {
        ChooseActivity act = (ChooseActivity) mContext;
        try {
            assMngr = act.getAssets();
            String[] folders = assMngr.list(Constant._FOLDER);
            for (String f : folders) {
                inflateTabView(f);
                stampFolderList.add(f);
            }

        } catch (IOException e) {

            e.printStackTrace();
        }

    }

0 个答案:

没有答案