android Programming Glossary: getresources
AlphabetIndexer with Custom Adapter managed by LoaderManager http://stackoverflow.com/questions/10224233/alphabetindexer-with-custom-adapter-managed-by-loadermanager true lv.setScrollingCacheEnabled true lv.setDivider getResources .getDrawable R.drawable.list_divider These are the Contacts..
How ListView's recycling mechanism works http://stackoverflow.com/questions/11945563/how-listviews-recycling-mechanism-works TypedValue.applyDimension TypedValue.COMPLEX_UNIT_DIP 62 getResources .getDisplayMetrics 1.0f params.topMargin int TypedValue.applyDimension.. TypedValue.applyDimension TypedValue.COMPLEX_UNIT_DIP 1 getResources .getDisplayMetrics params.bottomMargin int TypedValue.applyDimension.. TypedValue.applyDimension TypedValue.COMPLEX_UNIT_DIP 1 getResources .getDisplayMetrics create.setLayoutParams params create.setBackgroundColor..
Google maps api v2 custom infowindow like in original android google maps http://stackoverflow.com/questions/14123243/google-maps-api-v2-custom-infowindow-like-in-original-android-google-maps new OnInfoWindowElemTouchListener infoButton getResources .getDrawable R.drawable.btn_default_normal_holo_light getResources.. .getDrawable R.drawable.btn_default_normal_holo_light getResources .getDrawable R.drawable.btn_default_pressed_holo_light @Override.. Context context float dp final float scale context.getResources .getDisplayMetrics .density return int dp scale 0.5f That's..
How to maintain multi layers of ImageViews and keep their aspect ratio based on the largest one? http://stackoverflow.com/questions/16729169/how-to-maintain-multi-layers-of-imageviews-and-keep-their-aspect-ratio-based-on super.invalidateDrawable dr @Override public Resources getResources return mResources @Override public void setImageBitmap Bitmap.. v new LayeredImageView this Resources res v.getResources v.setImageResource R.drawable.background Matrix m m new Matrix..
How to adjust text font size to fit textview http://stackoverflow.com/questions/2617266/how-to-adjust-text-font-size-to-fit-textview i textColumn.setPadding 0 0 1 0 textColumn.setTextColor getResources .getColor R.drawable.text_default row.addView textColumn new..
Check orientation on Android phone http://stackoverflow.com/questions/2795833/check-orientation-on-android-phone as available from the Resources' Configuration object as getResources .getConfiguration .orientation http developer.android.com reference..
getting the screen density programmatically in android? http://stackoverflow.com/questions/3166501/getting-the-screen-density-programmatically-in-android from the DisplayMetrics struct DisplayMetrics metrics getResources .getDisplayMetrics Though Android doesn't use a direct pixel..
Change title bar text in Android http://stackoverflow.com/questions/3438276/change-title-bar-text-in-android false actionBar.setBackgroundDrawable new ColorDrawable getResources .getColor R.color.title_bar_gray actionBar.setTitle heading..
Custom ImageView with drop shadow http://stackoverflow.com/questions/3693234/custom-imageview-with-drop-shadow Canvas canvas Bitmap bmp BitmapFactory.decodeResource getResources R.drawable.omen Paint paint new Paint paint.setAntiAlias true..
Converting pixels to dp http://stackoverflow.com/questions/4605527/converting-pixels-to-dp Converts 14 dip into its equivalent px Resources r getResources float px TypedValue.applyDimension TypedValue.COMPLEX_UNIT_DIP..
How can I use the animation framework inside the canvas? http://stackoverflow.com/questions/4938822/how-can-i-use-the-animation-framework-inside-the-canvas context super context ball BitmapFactory.decodeResource getResources R.drawable.football load a ball image bgr BitmapFactory.decodeResource.. load a ball image bgr BitmapFactory.decodeResource getResources R.drawable.sky_bgr load a background ballW ball.getWidth ballH.. context super context ball BitmapFactory.decodeResource getResources R.drawable.football Load a ball image. bgr BitmapFactory.decodeResource..
Image in Canvas with touch events http://stackoverflow.com/questions/5743328/image-in-canvas-with-touch-events MyImageView Context context this context null 0 mImage getResources .getDrawable R.drawable.imagename mImage.setBounds 0 0 mImage.getIntrinsicWidth..
ANDROID::Rotate image in imageview by an angle http://stackoverflow.com/questions/8981845/androidrotate-image-in-imageview-by-an-angle mat new Matrix Bitmap bMap BitmapFactory.decodeResource getResources imageid mat.postRotate Integer.parseInt degree angle to be rotated..
AlphabetIndexer with Custom Adapter managed by LoaderManager http://stackoverflow.com/questions/10224233/alphabetindexer-with-custom-adapter-managed-by-loadermanager 0 null this ListView lv getListView lv.setFastScrollEnabled true lv.setScrollingCacheEnabled true lv.setDivider getResources .getDrawable R.drawable.list_divider These are the Contacts rows that we will retrieve. final String CONTACTS_SUMMARY_PROJECTION..
How ListView's recycling mechanism works http://stackoverflow.com/questions/11945563/how-listviews-recycling-mechanism-works params new LinearLayout.LayoutParams 0 int TypedValue.applyDimension TypedValue.COMPLEX_UNIT_DIP 62 getResources .getDisplayMetrics 1.0f params.topMargin int TypedValue.applyDimension TypedValue.COMPLEX_UNIT_DIP 1 getResources .getDisplayMetrics.. 62 getResources .getDisplayMetrics 1.0f params.topMargin int TypedValue.applyDimension TypedValue.COMPLEX_UNIT_DIP 1 getResources .getDisplayMetrics params.bottomMargin int TypedValue.applyDimension TypedValue.COMPLEX_UNIT_DIP 1 getResources .getDisplayMetrics.. 1 getResources .getDisplayMetrics params.bottomMargin int TypedValue.applyDimension TypedValue.COMPLEX_UNIT_DIP 1 getResources .getDisplayMetrics create.setLayoutParams params create.setBackgroundColor Color.BLUE create.setText Test the following..
Google maps api v2 custom infowindow like in original android google maps http://stackoverflow.com/questions/14123243/google-maps-api-v2-custom-infowindow-like-in-original-android-google-maps deals with the pressed state so it shows up this.infoButtonListener new OnInfoWindowElemTouchListener infoButton getResources .getDrawable R.drawable.btn_default_normal_holo_light getResources .getDrawable R.drawable.btn_default_pressed_holo_light.. new OnInfoWindowElemTouchListener infoButton getResources .getDrawable R.drawable.btn_default_normal_holo_light getResources .getDrawable R.drawable.btn_default_pressed_holo_light @Override protected void onClickConfirmed View v Marker marker .. .position new LatLng 51.51 0.1 public static int getPixelsFromDp Context context float dp final float scale context.getResources .getDisplayMetrics .density return int dp scale 0.5f That's it. So far I only tested this on my Galaxy Nexus 4.2.1 and..
How to maintain multi layers of ImageViews and keep their aspect ratio based on the largest one? http://stackoverflow.com/questions/16729169/how-to-maintain-multi-layers-of-imageviews-and-keep-their-aspect-ratio-based-on Drawable dr if verifyDrawable dr invalidate else super.invalidateDrawable dr @Override public Resources getResources return mResources @Override public void setImageBitmap Bitmap bm throws RuntimeException String detailMessage setImageBitmap.. return d and how it can be used final LayeredImageView v new LayeredImageView this Resources res v.getResources v.setImageResource R.drawable.background Matrix m m new Matrix m.preTranslate 81 146 pixels to offset final Layer layer1..
How to adjust text font size to fit textview http://stackoverflow.com/questions/2617266/how-to-adjust-text-font-size-to-fit-textview textColumn new TextView this textColumn.setText ColumnNames i textColumn.setPadding 0 0 1 0 textColumn.setTextColor getResources .getColor R.drawable.text_default row.addView textColumn new TableRow.LayoutParams table.addView row new TableLayout.LayoutParams..
Check orientation on Android phone http://stackoverflow.com/questions/2795833/check-orientation-on-android-phone as used to determine which resources to retrieve etc as available from the Resources' Configuration object as getResources .getConfiguration .orientation http developer.android.com reference android content res Configuration.html#orientation ..
getting the screen density programmatically in android? http://stackoverflow.com/questions/3166501/getting-the-screen-density-programmatically-in-android share improve this question You can get info on the display from the DisplayMetrics struct DisplayMetrics metrics getResources .getDisplayMetrics Though Android doesn't use a direct pixel mapping it uses a handful of quantized Density Independent..
Change title bar text in Android http://stackoverflow.com/questions/3438276/change-title-bar-text-in-android false actionBar.setDisplayShowHomeEnabled false actionBar.setBackgroundDrawable new ColorDrawable getResources .getColor R.color.title_bar_gray actionBar.setTitle heading actionBar.show Styling the Action Bar The Action bar provides..
Custom ImageView with drop shadow http://stackoverflow.com/questions/3693234/custom-imageview-with-drop-shadow so I'm still working on that. @Override protected void onDraw Canvas canvas Bitmap bmp BitmapFactory.decodeResource getResources R.drawable.omen Paint paint new Paint paint.setAntiAlias true paint.setShadowLayer 5.5f 6.0f 6.0f Color.BLACK canvas.drawColor..
Converting pixels to dp http://stackoverflow.com/questions/4605527/converting-pixels-to-dp
How can I use the animation framework inside the canvas? http://stackoverflow.com/questions/4938822/how-can-i-use-the-animation-framework-inside-the-canvas float dY float acc Bitmap ball bgr public BallBounce Context context super context ball BitmapFactory.decodeResource getResources R.drawable.football load a ball image bgr BitmapFactory.decodeResource getResources R.drawable.sky_bgr load a background.. ball BitmapFactory.decodeResource getResources R.drawable.football load a ball image bgr BitmapFactory.decodeResource getResources R.drawable.sky_bgr load a background ballW ball.getWidth ballH ball.getHeight acc 0.2f acceleration dY 0 vertical speed.. long timePrevFrame 0 long timeDelta public BallBounces Context context super context ball BitmapFactory.decodeResource getResources R.drawable.football Load a ball image. bgr BitmapFactory.decodeResource getResources R.drawable.sky_bgr Load a background...
Image in Canvas with touch events http://stackoverflow.com/questions/5743328/image-in-canvas-with-touch-events mScaleDetector private float mScaleFactor 1.f public MyImageView Context context this context null 0 mImage getResources .getDrawable R.drawable.imagename mImage.setBounds 0 0 mImage.getIntrinsicWidth mImage.getIntrinsicHeight public MyImageView..
ANDROID::Rotate image in imageview by an angle http://stackoverflow.com/questions/8981845/androidrotate-image-in-imageview-by-an-angle TextView tv TextView findViewById txtViewsid Matrix mat new Matrix Bitmap bMap BitmapFactory.decodeResource getResources imageid mat.postRotate Integer.parseInt degree angle to be rotated Bitmap bMapRotate Bitmap.createBitmap bMap 0 0 bMap.getWidth..
|