List of usage examples for android.os AsyncTask THREAD_POOL_EXECUTOR
Executor THREAD_POOL_EXECUTOR
To view the source code for android.os AsyncTask THREAD_POOL_EXECUTOR.
Click Source Link
From source file:org.dbhatt.d_deleted_contact.Deleted_contact.java
@Override public void onBindViewHolder(Contact holder, int position) { try {/*from w w w. j a va2 s . co m*/ org.dbhatt.d_deleted_contact.Data.Contact contact = deleted_contact.get(position); holder.contact_name.setText(contact.getName()); holder.account_type.setText(contact.getAccount_type()); new Load_Contact_Photo(holder.contact_photo, contact.getName()) .executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } catch (Exception e) { e.printStackTrace(); Toast.makeText(context, R.string.contact_developer, Toast.LENGTH_SHORT).show(); } }
From source file:com.fastbootmobile.encore.app.fragments.AlbumsFragment.java
/** * {@inheritDoc}/*from w w w. j a v a 2s. c o m*/ */ @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment final View root = inflater.inflate(R.layout.fragment_albums, container, false); mGridView = (GridView) root.findViewById(R.id.gvAlbums); mGridView.setFastScrollEnabled(true); // Get the albums new GetAlbumsTask().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); // Setup the click listener mGridView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { AlbumsAdapter.ViewHolder tag = (AlbumsAdapter.ViewHolder) view.getTag(); ImageView ivCover = tag.ivCover; Album item = mAdapter.getItem(position); Bitmap hero = ((MaterialTransitionDrawable) ivCover.getDrawable()).getFinalDrawable().getBitmap(); Intent intent = AlbumActivity.craftIntent(getActivity(), hero, item.getRef(), item.getProvider(), tag.itemColor); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { ActivityOptions opt = ActivityOptions.makeSceneTransitionAnimation(getActivity(), tag.ivCover, "itemImage"); getActivity().startActivity(intent, opt.toBundle()); } else { startActivity(intent); } } }); return root; }
From source file:com.fastbootmobile.encore.app.fragments.ArtistsListFragment.java
/** * {@inheritDoc}//from w ww .j a va 2 s. c o m */ @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View root = inflater.inflate(R.layout.fragment_artists, container, false); mArtistLayout = (RecyclerView) root.findViewById(R.id.rvArtists); mArtistLayout.setHasFixedSize(true); mArtistLayout.setLayoutManager(new StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL)); mArtistLayout .addItemDecoration(new SpaceItemDecorator(getResources().getDimensionPixelSize(R.dimen.one_dp))); // Get artists new GetArtistsTask().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); return root; }
From source file:eu.musesproject.client.contextmonitoring.sensors.DeviceProtectionSensor.java
private void createInitialContextEvent() { // create a list of installed ups and hold it if (!initialContextEventFired) { // create an initial context event since the information // gathered by this sensor does not change often new CreateContextEventAsync().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); initialContextEventFired = true; }/* w ww . ja v a2 s . co m*/ }
From source file:com.smoothsync.smoothsetup.utils.LoadingFragment.java
@Override public void onResume() { super.onResume(); MicroFragmentEnvironment<Params> mMicroFragmentEnvironment = new FragmentEnvironment<>(this); if (mFragmentTransition != null) { // the operation completed in the background mMicroFragmentEnvironment.host().execute(getActivity(), mFragmentTransition); } else {// w w w .java 2 s . c om new LoaderTask<>(getContext(), mMicroFragmentEnvironment, mLoader, this) .executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } }
From source file:com.hedgehog.smdb.ActionBarControlScrollViewActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_actionbarcontrolscrollview); // ObservableScrollView scrollView = (ObservableScrollView) findViewById(R.id.scroll); // scrollView.setScrollViewCallbacks(this); ImageLoader.getInstance().init(ImageLoaderConfiguration.createDefault(this)); mCustomPagerAdapter = new CustomPagerAdapter(this); mViewPager = (ViewPager) findViewById(R.id.pager); upcomingViewFlipper = (ViewFlipper) findViewById(R.id.viewFlipperUpcoming); starCastViewFlipper = (ViewFlipper) findViewById(R.id.viewFlipperStarCast); mViewPager.setAdapter(mCustomPagerAdapter); CirclePageIndicator titleIndicator = (CirclePageIndicator) findViewById(R.id.titles); titleIndicator.setViewPager(mViewPager); horizontalScrollLayout = (HorizontalScrollLayout) findViewById(R.id.horizontalLayout); horizontalScrollLayoutcast = (HorizontalScrollLayout) findViewById(R.id.horizontalLayoutcast); horizontalScrollLayout.init(this); horizontalScrollLayoutcast.init(this); repeat();/*from w ww .j a v a2 s.c o m*/ new TaskToDownload(this, this, Constants.UPCOMING_SHOWS).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, Constants.URL_UPCOMING); new TaskToDownload(this, this, Constants.STARCAST).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, Constants.URL_STARCAST); // ArrayList<SingleShow> list = new ArrayList<>(); // SingleShow show = new SingleShow(); // show.setName("Hello"); // show.setImageUrl("http://tvmazecdn.com/uploads/images/medium_portrait/53/132622.jpg"); // list.add(show); // show = new SingleShow(); // show.setName("Hello"); // show.setImageUrl("http://tvmazecdn.com/uploads/images/medium_portrait/53/132622.jpg"); // list.add(show); // show = new SingleShow(); // show.setName("Hello"); // show.setImageUrl("http://tvmazecdn.com/uploads/images/medium_portrait/53/132622.jpg"); // list.add(show); // show = new SingleShow(); // show.setName("Hello"); // show.setImageUrl("http://tvmazecdn.com/uploads/images/medium_portrait/53/132622.jpg"); // list.add(show); // horizontalScrollLayout.addItems(list, 300, 450); // horizontalScrollLayoutcast.addItems(list, 300, 450); }
From source file:eu.musesproject.client.connectionmanager.ConnectionManager.java
/** * Send data to the server //from w w w . ja v a2s . co m * @param data * @return void */ @Override public void sendData(String data) { if (NetworkChecker.isInternetConnected) { Log.d(APP_TAG, "ConnManager=> send data to server: " + data); HttpClientAsyncThread httpClientAsyncThread = new HttpClientAsyncThread(); httpClientAsyncThread.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, DATA, URL, Integer.toString(AlarmReceiver.DEFAULT_POLL_INTERVAL), data); } else { Log.d(APP_TAG, "ConnManager=> can't send data no intenet connection, calling statusCB"); callBacks.statusCb(Statuses.DATA_SEND_FAILED, DetailedStatuses.NO_INTERNET_CONNECTION); } }
From source file:maimeng.yodian.app.client.android.chat.activity.ShowBigImage.java
@SuppressLint("NewApi") @Override//from www. j a v a 2s . co m protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_show_big_image); setTitle(""); image = (PhotoView) findViewById(R.id.image); ViewCompat.setTransitionName(image, "img"); loadLocalPb = (ProgressBar) findViewById(R.id.pb_load_local); default_res = getIntent().getIntExtra("default_image", R.mipmap.default_avatar); Uri uri = getIntent().getParcelableExtra("uri"); String remotepath = getIntent().getExtras().getString("remotepath"); String secret = getIntent().getExtras().getString("secret"); EMLog.d(TAG, "show big image uri:" + uri + " remotepath:" + remotepath); // if (uri != null && new File(uri.getPath()).exists()) { EMLog.d(TAG, "showbigimage file exists. directly show it"); DisplayMetrics metrics = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(metrics); // int screenWidth = metrics.widthPixels; // int screenHeight =metrics.heightPixels; bitmap = ImageCache.getInstance().get(uri.getPath()); if (bitmap == null) { LoadLocalBigImgTask task = new LoadLocalBigImgTask(this, uri.getPath(), image, loadLocalPb, ImageUtils.SCALE_IMAGE_WIDTH, ImageUtils.SCALE_IMAGE_HEIGHT); if (android.os.Build.VERSION.SDK_INT > 10) { task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } else { task.execute(); } } else { image.setImageBitmap(bitmap); } } else if (remotepath != null) { //? EMLog.d(TAG, "download remote image"); Map<String, String> maps = new HashMap<String, String>(); if (!TextUtils.isEmpty(secret)) { maps.put("share-secret", secret); } downloadImage(remotepath, maps); } else { image.setImageResource(default_res); } image.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { finish(); } }); }
From source file:com.tlongdev.bktf.presenter.fragment.UserPresenter.java
private void getUserData(boolean isGuest) { //Start fetching the data and listen for the end GetUserDataInteractor interactor = new GetUserDataInteractor(mApplication, mProfileManager.getUser(), isGuest, this); interactor.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); mLoading = true;// w w w . j av a 2s. co m mTracker.send(new HitBuilders.EventBuilder().setCategory("Request").setAction("UserData").build()); }
From source file:org.dbhatt.d_deleted_contact.All_contact.java
@Override public void onBindViewHolder(Contact holder, int position) { try {// w w w .ja v a2 s. c o m org.dbhatt.d_deleted_contact.Data.Contact contact = all_contact.get(position); holder.contact_name.setText(contact.getName()); holder.account_type.setText(contact.getAccount_type()); new Load_Contact_Photo(holder.contact_photo, contact.getName()) .executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, String.valueOf(contact.getRaw_id())); } catch (Exception e) { e.printStackTrace(); Toast.makeText(context, R.string.contact_developer, Toast.LENGTH_SHORT).show(); } }