List of usage examples for android.widget TextView setVisibility
@RemotableViewMethod public void setVisibility(@Visibility int visibility)
From source file:com.cleverzone.zhizhi.capture.CaptureActivity.java
private void handleDecodeInternally(Result rawResult, ResultHandler resultHandler, Bitmap barcode) { final CharSequence displayContents = resultHandler.getDisplayContents(); // if (copyToClipboard && !resultHandler.areContentsSecure()) { // ClipboardInterface.setText(displayContents, this); // }//ww w.j ava 2 s . com SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); // if (resultHandler.getDefaultButtonID() != null && prefs.getBoolean(PreferencesActivity.KEY_AUTO_OPEN_WEB, false)) { // resultHandler.handleButtonPress(resultHandler.getDefaultButtonID()); // return; // } statusView.setVisibility(View.GONE); viewfinderView.setVisibility(View.GONE); resultView.setVisibility(View.VISIBLE); ImageView barcodeImageView = (ImageView) findViewById(R.id.barcode_image_view); if (barcode == null) { barcodeImageView.setImageBitmap(BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher)); } else { barcodeImageView.setImageBitmap(barcode); } TextView formatTextView = (TextView) findViewById(R.id.format_text_view); formatTextView.setText(rawResult.getBarcodeFormat().toString()); TextView typeTextView = (TextView) findViewById(R.id.type_text_view); typeTextView.setText(resultHandler.getType().toString()); DateFormat formatter = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT); TextView timeTextView = (TextView) findViewById(R.id.time_text_view); timeTextView.setText(formatter.format(new Date(rawResult.getTimestamp()))); TextView metaTextView = (TextView) findViewById(R.id.meta_text_view); View metaTextViewLabel = findViewById(R.id.meta_text_view_label); metaTextView.setVisibility(View.GONE); metaTextViewLabel.setVisibility(View.GONE); Map<ResultMetadataType, Object> metadata = rawResult.getResultMetadata(); if (metadata != null) { StringBuilder metadataText = new StringBuilder(20); for (Map.Entry<ResultMetadataType, Object> entry : metadata.entrySet()) { if (DISPLAYABLE_METADATA_TYPES.contains(entry.getKey())) { metadataText.append(entry.getValue()).append('\n'); } } if (metadataText.length() > 0) { metadataText.setLength(metadataText.length() - 1); metaTextView.setText(metadataText); metaTextView.setVisibility(View.VISIBLE); metaTextViewLabel.setVisibility(View.VISIBLE); } } final TextView contentsTextView = (TextView) findViewById(R.id.contents_text_view); final String baseUrl = "http://qrk.kuaipai.cn/loganal/base/scan/show-json-advert.action?code="; new Thread(new Runnable() { @Override public void run() { HttpGet get = new HttpGet(baseUrl + displayContents); Log.e(TAG, "full url = " + baseUrl + displayContents); HttpClient client = new DefaultHttpClient(); try { HttpResponse response = client.execute(get); String json = EntityUtils.toString(response.getEntity(), "UTF-8"); JSONObject jsonObject = new JSONObject(json); NetScanResult result = new NetScanResult(); result.name = jsonObject.getString("name"); result.url = jsonObject.getString("img"); Message message = new Message(); message.obj = result; message.what = 1; mNetHandler.sendMessage(message); } catch (Exception e) { mNetHandler.sendEmptyMessage(-1); e.printStackTrace(); } } }).start(); // contentsTextView.setText(displayContents); int scaledSize = Math.max(22, 32 - displayContents.length() / 4); contentsTextView.setTextSize(TypedValue.COMPLEX_UNIT_SP, scaledSize); TextView supplementTextView = (TextView) findViewById(R.id.contents_supplement_text_view); supplementTextView.setText(""); supplementTextView.setOnClickListener(null); // if (PreferenceManager.getDefaultSharedPreferences(this).getBoolean( // PreferencesActivity.KEY_SUPPLEMENTAL, true)) { // SupplementalInfoRetriever.maybeInvokeRetrieval(supplementTextView, // resultHandler.getResult(), // historyManager, // this); // } int buttonCount = resultHandler.getButtonCount(); ViewGroup buttonView = (ViewGroup) findViewById(R.id.result_button_view); buttonView.requestFocus(); for (int x = 0; x < ResultHandler.MAX_BUTTON_COUNT; x++) { TextView button = (TextView) buttonView.getChildAt(x); if (x < buttonCount) { button.setVisibility(View.VISIBLE); button.setText(resultHandler.getButtonText(x)); button.setOnClickListener(new ResultButtonListener(resultHandler, x)); } else { button.setVisibility(View.GONE); } } }
From source file:com.facebook.GraphObjectAdapter.java
protected void populateGraphObjectView(View view, T graphObject) { String id = getIdOfGraphObject(graphObject); view.setTag(id);//from w w w .ja v a 2 s . c o m CharSequence title = getTitleOfGraphObject(graphObject); TextView titleView = (TextView) view.findViewById(R.id.com_facebook_picker_title); if (titleView != null) { titleView.setText(title, TextView.BufferType.SPANNABLE); } CharSequence subtitle = getSubTitleOfGraphObject(graphObject); TextView subtitleView = (TextView) view.findViewById(R.id.picker_subtitle); if (subtitleView != null) { if (subtitle != null) { subtitleView.setText(subtitle, TextView.BufferType.SPANNABLE); subtitleView.setVisibility(View.VISIBLE); } else { subtitleView.setVisibility(View.GONE); } } if (getShowCheckbox()) { CheckBox checkBox = (CheckBox) view.findViewById(R.id.com_facebook_picker_checkbox); updateCheckboxState(checkBox, isGraphObjectSelected(id)); } if (getShowPicture()) { URL pictureURL = getPictureUrlOfGraphObject(graphObject); if (pictureURL != null) { ImageView profilePic = (ImageView) view.findViewById(R.id.com_facebook_picker_image); getPictureDownloader().download(id, pictureURL, profilePic); } } }
From source file:com.adrguides.ReadGuideFragment.java
private void printStatus() { TextView title = (TextView) v.findViewById(R.id.textTitle); TextView content = (TextView) v.findViewById(R.id.textContent); TextView message = (TextView) v.findViewById(R.id.textMessage); ProgressBar progress = (ProgressBar) v.findViewById(R.id.progressMessage); if (ttsfragment.isTTSReady() && ttsfragment.isGuideAvailable() && ttsfragment.isGuideLanguageAvailable()) { Guide guide = ttsfragment.getGuide(); int chapter = ttsfragment.getChapter(); int paragraph = ttsfragment.getParagraph(); String imageURL;/* w ww. jav a 2 s. c om*/ // Print title in bar getActivity().getActionBar().setTitle(guide.getTitle()); message.setVisibility(View.GONE); progress.setVisibility(View.GONE); Place mychapter = guide.getPlaces().get(chapter); title.setVisibility(View.VISIBLE); title.setText(mychapter.getVisibleLabel()); if (paragraph >= 0) { content.setVisibility(View.VISIBLE); content.setText(mychapter.getSections().get(paragraph).getText()); imageURL = mychapter.getSections().get(paragraph).getImageURL(); } else { content.setVisibility(View.GONE); if (mychapter.getSections().size() > 0) { imageURL = mychapter.getSections().get(0).getImageURL(); } else { imageURL = null; } } switchImage(imageURL); } else { getActivity().getActionBar().setTitle(getResources().getText(R.string.title_activity_read_guide)); title.setVisibility(View.GONE); content.setVisibility(View.GONE); message.setVisibility(View.VISIBLE); switchImage(null); if (!ttsfragment.isTTSReady()) { // Language not available if (ttsfragment.isInitialized()) { // error message.setText(getResources().getString(R.string.msg_tts_not_available)); progress.setVisibility(View.GONE); } else { // Initializing message.setText(getResources().getString(R.string.msg_tts_initializing)); progress.setVisibility(View.VISIBLE); } } else if (!ttsfragment.isGuideAvailable()) { message.setText(getResources().getString(R.string.msg_guide_not_available)); progress.setVisibility(View.GONE); } else { // !ttsfragment.isGuideLanguageAvailable message.setText(getResources().getString(R.string.msg_guide_language_not_available, ttsfragment.getGuide().getLocale().getDisplayName())); progress.setVisibility(View.GONE); } } getActivity().invalidateOptionsMenu(); }
From source file:ablgroup.daily2.authentification.AuthentificationFragment.java
@Override public void onClick(View v) { RelativeLayout r = (RelativeLayout) findViewById(R.id.login_first); RelativeLayout r2 = (RelativeLayout) findViewById(R.id.email_password_fields); RelativeLayout r3 = (RelativeLayout) findViewById(R.id.login_retrieve); switch (v.getId()) { case R.id.sign_up: createAccount(mEmailField.getText().toString(), mPasswordField.getText().toString()); break;/*from w w w. jav a 2 s . c om*/ case R.id.sign_in: signIn(mEmailField.getText().toString(), mPasswordField.getText().toString()); break; case R.id.log_out: signOut(); case R.id.sign_in_button_google: signIn(); break; case R.id.login_email_btn: r.setVisibility(View.INVISIBLE); r2.setVisibility(View.VISIBLE); r3.setVisibility(View.INVISIBLE); break; case R.id.login_comeback_btn: r.setVisibility(View.VISIBLE); r2.setVisibility(View.INVISIBLE); r3.setVisibility(View.INVISIBLE); break; case R.id.login_retrieve_comeback_btn: r.setVisibility(View.VISIBLE); r2.setVisibility(View.INVISIBLE); r3.setVisibility(View.INVISIBLE); break; case R.id.login_retrieve_btn: final TextView t = (TextView) findViewById(R.id.login_retrieve_email); final TextView t2 = (TextView) findViewById(R.id.login_retrieve_confirmation); final TextView btn = (Button) findViewById(R.id.login_retrieve_btn); String emailAddress = t.getText().toString(); mAuth.sendPasswordResetEmail(emailAddress).addOnCompleteListener(new OnCompleteListener<Void>() { @Override public void onComplete(@NonNull Task<Void> task) { if (task.isSuccessful()) { Log.d(TAG, "Email sent."); t.setVisibility(View.INVISIBLE); t2.setVisibility(View.VISIBLE); btn.setVisibility(View.INVISIBLE); } } }); break; case R.id.login_retrieve_view: r.setVisibility(View.INVISIBLE); r2.setVisibility(View.INVISIBLE); r3.setVisibility(View.VISIBLE); break; } }
From source file:com.breadwallet.tools.adapter.TransactionListAdapter.java
public View getTxView(View tmpLayout, int position) { TextView sentReceivedTextView = (TextView) tmpLayout.findViewById(R.id.transaction_sent_received_label); TextView dateTextView = (TextView) tmpLayout.findViewById(R.id.transaction_date); TextView bitsTextView = (TextView) tmpLayout.findViewById(R.id.transaction_amount_bits); TextView dollarsTextView = (TextView) tmpLayout.findViewById(R.id.transaction_amount_dollars); TextView bitsTotalTextView = (TextView) tmpLayout.findViewById(R.id.transaction_amount_bits_total); TextView dollarsTotalTextView = (TextView) tmpLayout.findViewById(R.id.transaction_amount_dollars_total); Utils.overrideFonts(sentReceivedTextView, dateTextView, bitsTextView, dollarsTextView, bitsTotalTextView, dollarsTotalTextView);//from w ww. ja va 2 s.c o m tmpLayout.setBackgroundResource(R.drawable.clickable_layout); bitsTextView.setVisibility(BreadWalletApp.unlocked ? View.VISIBLE : View.INVISIBLE); bitsTotalTextView.setVisibility(BreadWalletApp.unlocked ? View.VISIBLE : View.INVISIBLE); dollarsTextView.setVisibility(BreadWalletApp.unlocked ? View.VISIBLE : View.INVISIBLE); dollarsTotalTextView.setVisibility(BreadWalletApp.unlocked ? View.VISIBLE : View.INVISIBLE); final TransactionListItem item = data.get(position); tmpLayout.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (BRAnimator.checkTheMultipressingAvailability()) { FragmentSettingsAll fragmentSettingsAll = (FragmentSettingsAll) activity.getFragmentManager() .findFragmentByTag(FragmentSettingsAll.class.getName()); FragmentTransactionExpanded fragmentTransactionExpanded = new FragmentTransactionExpanded(); fragmentTransactionExpanded.setCurrentObject(item); BRAnimator.animateSlideToLeft((MainActivity) activity, fragmentTransactionExpanded, fragmentSettingsAll); } } }); boolean received = item.getSent() == 0; int blockHeight = item.getBlockHeight(); int confirms = blockHeight == Integer.MAX_VALUE ? 0 : SharedPreferencesManager.getLastBlockHeight(activity) - blockHeight + 1; if (item.getSent() > 0 && item.getSent() == item.getReceived()) { sentReceivedTextView.setBackgroundResource(R.drawable.unconfirmed_label); sentReceivedTextView.setText(R.string.moved); sentReceivedTextView.setTextColor(unconfirmedColor); } else if (blockHeight != Integer.MAX_VALUE && confirms >= 6) { sentReceivedTextView .setBackgroundResource(received ? R.drawable.received_label : R.drawable.sent_label); sentReceivedTextView.setText(received ? R.string.received : R.string.sent); sentReceivedTextView.setTextColor(received ? receivedColor : sentColor); } else { sentReceivedTextView.setBackgroundResource(R.drawable.unconfirmed_label); sentReceivedTextView.setTextColor(unconfirmedColor); if (!BRWalletManager.getInstance(activity).transactionIsVerified(item.getHexId())) { sentReceivedTextView.setText(R.string.unverified); } else { int confsNr = confirms >= 0 && confirms <= 5 ? confirms : 0; String message = confsNr == 0 ? activity.getString(R.string.nr_confirmations0) : (confsNr == 1 ? activity.getString(R.string.nr_confirmations1) : String.format(activity.getString(R.string.nr_confirmations), confsNr)); sentReceivedTextView.setText(message); } } long itemTimeStamp = item.getTimeStamp(); dateTextView.setText(itemTimeStamp != 0 ? Utils.getFormattedDateFromLong(itemTimeStamp * 1000) : Utils.getFormattedDateFromLong(System.currentTimeMillis())); long satoshisAmount = received ? item.getReceived() : (item.getSent() - item.getReceived()) * -1; bitsTextView.setText(BRStringFormatter.getFormattedCurrencyString("BTC", satoshisAmount)); dollarsTextView.setText(String.format("(%s)", BRStringFormatter.getExchangeForAmount(SharedPreferencesManager.getRate(activity), SharedPreferencesManager.getIso(activity), new BigDecimal(satoshisAmount), activity))); long satoshisAfterTx = item.getBalanceAfterTx(); bitsTotalTextView.setText(BRStringFormatter.getFormattedCurrencyString("BTC", satoshisAfterTx)); dollarsTotalTextView.setText(String.format("(%s)", BRStringFormatter.getExchangeForAmount(SharedPreferencesManager.getRate(activity), SharedPreferencesManager.getIso(activity), new BigDecimal(satoshisAfterTx), activity))); return tmpLayout; }
From source file:com.eutectoid.dosomething.picker.GraphObjectAdapter.java
protected void populateGraphObjectView(View view, JSONObject graphObject) { String id = getIdOfGraphObject(graphObject); view.setTag(id);/*from w w w . j ava 2 s . co m*/ CharSequence title = getTitleOfGraphObject(graphObject); TextView titleView = (TextView) view.findViewById(R.id.com_facebook_picker_title); if (titleView != null) { titleView.setText(title, TextView.BufferType.SPANNABLE); } CharSequence subtitle = getSubTitleOfGraphObject(graphObject); TextView subtitleView = (TextView) view.findViewById(R.id.picker_subtitle); if (subtitleView != null) { if (subtitle != null) { subtitleView.setText(subtitle, TextView.BufferType.SPANNABLE); subtitleView.setVisibility(View.VISIBLE); } else { subtitleView.setVisibility(View.GONE); } } if (getShowCheckbox()) { CheckBox checkBox = (CheckBox) view.findViewById(R.id.com_facebook_picker_checkbox); updateCheckboxState(checkBox, isGraphObjectSelected(id)); } if (getShowPicture()) { Uri pictureURI = getPictureUriOfGraphObject(graphObject); if (pictureURI != null) { ImageView profilePic = (ImageView) view.findViewById(R.id.com_facebook_picker_image); // See if we have already pre-fetched this; if not, download it. if (prefetchedPictureCache.containsKey(id)) { ImageResponse response = prefetchedPictureCache.get(id); profilePic.setImageBitmap(response.getBitmap()); profilePic.setTag(response.getRequest().getImageUri()); } else { downloadProfilePicture(id, pictureURI, profilePic); } } } }
From source file:com.cypress.cysmart.DataLoggerFragments.DataLoggerFragment.java
@Override public View onCreateView(LayoutInflater inflater, final ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.datalogger, container, false); mLogList = (ListView) rootView.findViewById(R.id.txtlog); mFileName = (TextView) rootView.findViewById(R.id.txt_file_name); mScrollDown = (Button) rootView.findViewById(R.id.btn_scroll_down); /*/*from w w w .ja v a2s.c o m*/ /History option text */ TextView mDataHistory = (TextView) rootView.findViewById(R.id.txthistory); //mScrollView = (CustumScrollView) rootView.findViewById(R.id.scroll_view_logger); Bundle bundle = this.getArguments(); if (bundle != null) { mFilepath = bundle.getString(Constants.DATA_LOGGER_FILE_NAAME); mVisible = bundle.getBoolean(Constants.DATA_LOGGER_FLAG); File fileinView = new File(mFilepath); mFileName.setText(fileinView.getName()); } // Handling the history text visibility based on the received Arguments if (mVisible) { mDataHistory.setVisibility(View.GONE); } else { Toast.makeText(getActivity(), getResources().getString(R.string.data_logger_timestamp) + Utils.GetTimeandDateUpdate(), Toast.LENGTH_SHORT).show(); mDataHistory.setVisibility(View.VISIBLE); } mDataHistory.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent dataloggerHistory = new Intent(getActivity(), DataLoggerHistoryList.class); startActivityForResult(dataloggerHistory, 123); } }); prepareData(); setHasOptionsMenu(true); mScrollDown.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { mLogList.post(new Runnable() { public void run() { mLogList.setSelection(mLogList.getCount() - 1); } }); } }); return rootView; }
From source file:fm.smart.r1.activity.ItemActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ExceptionHandler.register(this); // could check here to see if this was suspended for login and go // straight to add_item ... setContentView(R.layout.item);/*from ww w. j a v a2 s . co m*/ /* * ImageView author_icon = (ImageView) * findViewById(R.id.item_author_icon); if (item.author_image != null){ * author_icon.setImageBitmap(item.author_image); } */ TextView cue_and_pronunciation = (TextView) findViewById(R.id.cue_and_pronunciation); cue_and_pronunciation.setText(item.cue_text); // TODO handle case where item is null? TextView cue_part_of_speech = (TextView) findViewById(R.id.cue_part_of_speech); if (!TextUtils.equals(item.part_of_speech, "None")) { cue_part_of_speech.setText(item.part_of_speech); } else { cue_part_of_speech.setVisibility(View.INVISIBLE); } /* * TextView author = (TextView) findViewById(R.id.item_author); * author.setText(item.author_name); */ TextView response_and_pronunciation = (TextView) findViewById(R.id.response_and_pronunciation); response_and_pronunciation.setText(item.children[0][0]); TextView response_part_of_speech = (TextView) findViewById(R.id.response_part_of_speech); if (item.type != null && item.type.equals("meaning")) { item.type = "Translation"; } response_part_of_speech.setText(item.type); response_part_of_speech.setVisibility(View.INVISIBLE); ImageView cue_sound = (ImageView) findViewById(R.id.cue_sound); setSound(cue_sound, item.cue_sound_url, this, R.id.cue_sound, (String) item.item_node.atts.get("id"), item.cue_text); ImageView response_sound = (ImageView) findViewById(R.id.response_sound); setSound(response_sound, item.response_sound_url, this, R.id.response_sound, (String) item.item_node.atts.get("id"), item.response_node.getFirstContents("text")); EfficientAdapter adapter = new EfficientAdapter(ItemActivity.this, item.sentence_vector); setListAdapter(adapter); if (adapter.getCount() == 0 && !ItemActivity.shown_toast) { Toast t = Toast.makeText(this, "Know a good example? Click the menu button to add one", 250); t.setGravity(Gravity.CENTER, 0, 0); t.show(); ItemActivity.shown_toast = true; } // notify(); }
From source file:com.hybris.mobile.app.commerce.fragment.CatalogMenuFragment.java
/** * Add a child view to the view flipper//w w w . j a v a 2s .com * * @param parent * @param showCatalogMenuLogo */ private void buildChildrenView(final CategoryHierarchy parent, boolean showCatalogMenuLogo, boolean showNext) { // Layout for the view final View view = getActivity().getLayoutInflater().inflate(R.layout.include_catalog_menu_categories, mCatalogMenuViewFlipper, false); TextView textViewTopCategoryName = (TextView) view.findViewById(R.id.catalog_menu_top_category_name); RelativeLayout relativeLayoutTopCategory = (RelativeLayout) view .findViewById(R.id.catalog_menu_top_category); ListView listViewCategories = (ListView) view.findViewById(R.id.catalog_menu_list_category); // We set to visible the top category name relativeLayoutTopCategory.setVisibility(View.VISIBLE); // Setting the top category name textViewTopCategoryName.setText(parent.getName()); textViewTopCategoryName.setVisibility(View.VISIBLE); textViewTopCategoryName.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (parent.getParent() != null) { mCurrentCategoryId = parent.getParent().getId(); } else { mCurrentCategoryId = null; } // On click of the top category, we go back to the top view mCatalogMenuViewFlipper.setInAnimation(getActivity(), R.anim.translate_left_to_origin); mCatalogMenuViewFlipper.setOutAnimation(getActivity(), R.anim.translate_origin_to_right); mCatalogMenuViewFlipper.showPrevious(); // And we remove the view we just came by mCatalogMenuViewFlipper.removeViewAt(mCatalogMenuViewFlipper.getChildCount() - 1); // We display the catalog logo if we are on the top view if (mCatalogMenuViewFlipper.getChildCount() == 1) { showCatalogMenuLogo(view, true); } // Updating the content view updateContentView(parent.getParent(), false); } }); // Setting the list for the sub categories initListViewCatalog(listViewCategories, parent.getSubcategories()); // Show the subcategories mCatalogMenuViewFlipper.addView(view); if (showNext) { mCatalogMenuViewFlipper.setInAnimation(getActivity(), R.anim.translate_right_to_origin); mCatalogMenuViewFlipper.setOutAnimation(getActivity(), R.anim.translate_origin_to_left); mCatalogMenuViewFlipper.showNext(); // Updating the content view once the ViewFlipper has finished his animation updateContentView(parent, false); } // Hidding the catalog logo on subcategories showCatalogMenuLogo(view, showCatalogMenuLogo); }
From source file:com.trk.aboutme.facebook.widget.GraphObjectAdapter.java
protected void populateGraphObjectView(View view, T graphObject) { String id = getIdOfGraphObject(graphObject); view.setTag(id);/*from w ww.j a va2 s.co m*/ CharSequence title = getTitleOfGraphObject(graphObject); TextView titleView = (TextView) view.findViewById(R.id.com_facebook_picker_title); if (titleView != null) { titleView.setText(title, TextView.BufferType.SPANNABLE); } CharSequence subtitle = getSubTitleOfGraphObject(graphObject); TextView subtitleView = (TextView) view.findViewById(R.id.picker_subtitle); if (subtitleView != null) { if (subtitle != null) { subtitleView.setText(subtitle, TextView.BufferType.SPANNABLE); subtitleView.setVisibility(View.VISIBLE); } else { subtitleView.setVisibility(View.GONE); } } if (getShowCheckbox()) { CheckBox checkBox = (CheckBox) view.findViewById(R.id.com_facebook_picker_checkbox); updateCheckboxState(checkBox, isGraphObjectSelected(id)); } if (getShowPicture()) { URL pictureURL = getPictureUrlOfGraphObject(graphObject); if (pictureURL != null) { ImageView profilePic = (ImageView) view.findViewById(R.id.com_facebook_picker_image); // See if we have already pre-fetched this; if not, download it. if (prefetchedPictureCache.containsKey(id)) { ImageResponse response = prefetchedPictureCache.get(id); profilePic.setImageBitmap(response.getBitmap()); profilePic.setTag(response.getRequest().getImageUrl()); } else { downloadProfilePicture(id, pictureURL, profilePic); } } } }