List of usage examples for android.widget ImageView setImageBitmap
@android.view.RemotableViewMethod public void setImageBitmap(Bitmap bm)
From source file:com.microsoft.filediscovery.adapters.DisplayFileItemAdapter.java
@Override public Object instantiateItem(ViewGroup container, int position) { ImageView imageView = new ImageView(mActivity); try {//w ww . jav a2s. c o m imageView.setScaleType(ImageView.ScaleType.CENTER_INSIDE); imageView.setImageBitmap(mResizer.getBitmapFrom(mData.get(position))); ((ViewPager) container).addView(imageView, 0); } catch (Exception e) { Log.e("Asset", e.getMessage()); } return imageView; }
From source file:ch.pec0ra.mobilityratecalculator.ItineraryConfirmationDialog.java
@NonNull @Override//from ww w.j av a2s. c om public Dialog onCreateDialog(Bundle savedInstanceState) { final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); // Get the layout inflater LayoutInflater inflater = getActivity().getLayoutInflater(); final View v = inflater.inflate(R.layout.itinerary_confirmation_dialog, null); final String twoWay; if (itinerary.isTwoWay) { twoWay = getString(R.string.two_way); } else { twoWay = getString(R.string.one_way); } int distance = (int) Math.ceil((double) itinerary.distance / 1000); if (itinerary.isTwoWay) { distance = distance * 2; } final ImageView image = (ImageView) v.findViewById(R.id.map_image); image.setImageBitmap(itinerary.image); ((TextView) v.findViewById(R.id.from_text_view)).setText(getString(R.string.from_format, itinerary.from)); ((TextView) v.findViewById(R.id.to_text_view)).setText(getString(R.string.to_format, itinerary.to)); ((TextView) v.findViewById(R.id.two_way_text_view)).setText(twoWay); ((TextView) v.findViewById(R.id.total_distance_text_view)) .setText(getString(R.string.distance_format, distance)); // Inflate and set the layout for the dialog // Pass null as the parent view because its going in the dialog layout final int finalDistance = distance; builder.setView(v).setTitle(getString(R.string.itinerary)) // Add action buttons .setPositiveButton(R.string.confirm, new DialogInterface.OnClickListener() { @Override public void onClick(final DialogInterface dialog, int id) { mListener.onDialogPositiveClick(finalDistance); } }).setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { ItineraryConfirmationDialog.this.getDialog().cancel(); } }); Dialog dialog = builder.create(); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); return builder.create(); }
From source file:MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); final ImageView imageViewThumbnail = (ImageView) findViewById(R.id.imageViewThumbnail); imageViewThumbnail.setImageBitmap(loadSampledResource(R.drawable.image, 100, 100)); imageViewThumbnail.setOnClickListener(new View.OnClickListener() { @Override/*w w w . jav a 2 s. c o m*/ public void onClick(View view) { zoomFromThumbnail((ImageView) view); } }); mImageViewExpanded = (ImageView) findViewById(R.id.imageViewExpanded); mImageViewExpanded.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mImageViewExpanded.setVisibility(View.GONE); mImageViewExpanded.setImageBitmap(null); imageViewThumbnail.setVisibility(View.VISIBLE); } }); }
From source file:com.cnm.cnmrc.fragment.search.SearchVodDetail.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View layout = inflater.inflate(R.layout.search_vod_detail, container, false); Bundle bundle = getArguments().getBundle("bundle"); byte[] logoImage = bundle.getByteArray("logoImg"); String title = bundle.getString("title"); String hd = bundle.getString("hd"); String grade = bundle.getString("grade"); String director = bundle.getString("director"); String actor = bundle.getString("actor"); String price = bundle.getString("price"); String contents = bundle.getString("contents"); Bitmap bmp = BitmapFactory.decodeByteArray(logoImage, 0, logoImage.length); ImageView logoImg = (ImageView) layout.findViewById(R.id.logo_img); logoImg.setImageBitmap(bmp); if (title != null) ((TextView) layout.findViewById(R.id.title)).setText(title); if (hd != null) { if (hd.equalsIgnoreCase("yes")) ((ImageView) layout.findViewById(R.id.hd_icon)).setVisibility(View.VISIBLE); }//w w w .j a v a 2s. c o m if (grade != null) ((ImageView) layout.findViewById(R.id.grade_icon)).setBackgroundResource(Util.getGrade(grade)); if (director != null) ((TextView) layout.findViewById(R.id.director_name)).setText(" " + director); if (actor != null) ((TextView) layout.findViewById(R.id.actor_name)).setText(" " + actor); if (grade != null) ((TextView) layout.findViewById(R.id.grade_text)).setText(" " + grade); if (price != null) ((TextView) layout.findViewById(R.id.price_amount)).setText(" " + price); if (contents != null) ((TextView) layout.findViewById(R.id.contents)).setText(contents); return layout; }
From source file:com.hivewallet.androidclient.wallet.ui.WalletAddressDialogFragment.java
@Override public Dialog onCreateDialog(final Bundle savedInstanceState) { address = getArguments().getString(KEY_ADDRESS); final Bitmap qrCode = (Bitmap) getArguments().getParcelable(KEY_QR_CODE); final Dialog dialog = new Dialog(activity); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.wallet_address_dialog); dialog.setCanceledOnTouchOutside(true); final ImageView imageView = (ImageView) dialog.findViewById(R.id.iv_qr_code); imageView.setImageBitmap(qrCode); imageView.setOnClickListener(new View.OnClickListener() { @Override//from w w w .j a va2s . c o m public void onClick(final View v) { dismiss(); } }); final TextView textView = (TextView) dialog.findViewById(R.id.tv_bitcoin_address); textView.setText(address); final ImageButton copyButton = (ImageButton) dialog.findViewById(R.id.ib_copy_wallet_address); copyButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { handleCopy(); } }); final ImageButton shareButton = (ImageButton) dialog.findViewById(R.id.ib_share_wallet_address); shareButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { handleShare(); } }); return dialog; }
From source file:com.liquid.wallpapers.free.core.favourites.FavouriteListAdapter.java
@Override public View getView(int position, View convertView, ViewGroup parent) { Favourite favourite = this.favourites.get(position); if (convertView == null) { convertView = LayoutInflater.from(this.context).inflate(R.layout.favourite, null); }//from w w w.j a va 2s . co m TextView textView = (TextView) convertView.findViewById(R.id.favouriteTextBox); textView.setText(favourite.getWallpaper().getTitle()); ImageView imageView = (ImageView) convertView.findViewById(R.id.favouriteImageView); try { imageView.setImageBitmap(this.wallpaperManager.getThumbImage(favourite.getWallpaper())); } catch (ClientProtocolException ex) { AlertDialogFactory.showErrorMessage(this.context, R.string.errorText, R.string.downloadException); } catch (IOException ex) { AlertDialogFactory.showErrorMessage(this.context, R.string.errorText, R.string.downloadException); } return convertView; }
From source file:com.facebook.notifications.internal.asset.handlers.BitmapAssetHandler.java
@NonNull @Override/*from w w w. j a va2 s. c o m*/ public View createView(@NonNull BitmapAsset asset, @NonNull Context context) { ImageView imageView = new ImageView(context); imageView.setImageBitmap(asset.getBitmap()); imageView.setScaleType(ImageView.ScaleType.FIT_CENTER); imageView.setAdjustViewBounds(true); return imageView; }
From source file:com.dp.chapter01.part1.ImageLoader.java
private void updateImageView(final ImageView imageView, final Bitmap bitmap) { mUiHandler.post(new Runnable() { @Override/*from w w w.j av a 2 s . c om*/ public void run() { imageView.setImageBitmap(bitmap); ; } }); }
From source file:com.appbase.androidquery.callback.BitmapAjaxCallback.java
private static void setBmAnimate(ImageView iv, Bitmap bm, Bitmap preset, int fallback, int animation, float ratio, float anchor, int source) { bm = filter(iv, bm, fallback);//ww w . j av a2s . c o m if (bm == null) { iv.setImageBitmap(null); return; } Drawable d = makeDrawable(iv, bm, ratio, anchor); Animation anim = null; if (fadeIn(animation, source)) { if (preset == null) { anim = new AlphaAnimation(0, 1); anim.setInterpolator(new DecelerateInterpolator()); anim.setDuration(FADE_DUR); } else { Drawable pd = makeDrawable(iv, preset, ratio, anchor); Drawable[] ds = new Drawable[] { pd, d }; TransitionDrawable td = new TransitionDrawable(ds); td.setCrossFadeEnabled(true); td.startTransition(FADE_DUR); d = td; } } else if (animation > 0) { anim = AnimationUtils.loadAnimation(iv.getContext(), animation); } iv.setImageDrawable(d); if (anim != null) { anim.setStartTime(AnimationUtils.currentAnimationTimeMillis()); iv.startAnimation(anim); } else { iv.setAnimation(null); } }
From source file:com.shafiq.myfeedle.core.BitmapDownloadTask.java
@Override protected void onPostExecute(Bitmap bitmap) { if (mImageViewReference != null) { ImageView imageView = mImageViewReference.get(); BitmapDownloadTask bitmapDownloadTask = getBitmapDownloadTask(imageView); if (this == bitmapDownloadTask) imageView.setImageBitmap(bitmap); }/*from ww w . j av a2s. c om*/ }