@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_tvchannelviewpager); JSONObject crittercismConfig = new JSONObject(); try { crittercismConfig.put( "shouldCollectLogcat", true); // send logcat data for devices with API Level 16 and higher } catch (JSONException je) { } // Crittercism.init(getApplicationContext(), "51ccf765558d6a0c25000003", crittercismConfig); /*Bundle extras = getIntent().getExtras(); currIndex = extras.getInt("type_id", 0); if(currIndex > listnumber) currIndex = 0; functionFlag = extras.getInt("sort_id", 2);*/ currIndex = TvDramaApplication.shIO.getInt("type_id", 0); if (currIndex > listnumber) currIndex = 0; functionFlag = TvDramaApplication.shIO.getInt("sort_id", 2); initViews(); loadTask = new LoadDataTask(); if (Build.VERSION.SDK_INT < 11) loadTask.execute(); else loadTask.executeOnExecutor(LoadDataTask.THREAD_POOL_EXECUTOR, 0); }
private void loaddata() { /** 重要!!需要判断当前任务是否正在运行,否则重复执行会出错,典型的场景就是用户点击登录按钮多次 */ if (null != mLoadDataTask && mLoadDataTask.getStatus() == GenericTask.Status.RUNNING) return; mLoadDataTask = new LoadDataTask(); mLoadDataTask.setListener(mTaskListener); try { mLoadDataTask.execute(); } catch (Exception e) { // TODO: handle exception e.printStackTrace(); } }