Wednesday, 28 October 2015

This post helps
the Tyro’s who are trying to apply their user-defined font type or face to
their android views i.e. (TextView, Button, EditText etc…) in android there are
only four basic predefined fonts type are available to design but in order to
design our rich UI we are suppose to go with our own font face (.ttf) so first
we need to copy our font type file (.ttf) in to our assets folder showed in Package
Explorer and use the code highlighted in the GodTest.java file

Tuesday, 19 May 2015

java.lang.OutofMemoryError: bitmap size exceeds VM budget. This is most common error for us when we are
decoding Bitmap more than 4 MB. In generally before decoding bitmap we do not
know how much bigger the size of a bitmap will be. So its very difficult
problem for us to handle this error in proactive approachBut good thing is that
android provide a way to handle this problem.Before decoding bitmap we just
decode it with options.inJustDecodeBounds = true. options is the instance of BitmapFactory.

It does not load bitmap into memory but it help us to find the width and height
of a bitmap so that we can reduce the height and width according to our device

As Bitmaps take
up a lot of memory, especially for rich images like photographs. For example,
the camera on the Galaxy Nexus takes photos up to 2592x1936 pixels (5
megapixels). If the bitmap configuration used is ARGB_8888 (the default from
the Android 2.3 onward) then loading this image into memory takes about 19MB of
memory (2592*1936*4 bytes), immediately exhausting the per-app limit on some
devices.

Here inSampleSize will reduce the size and memory size of
an Bitmap.To use this method, first
decode withinJustDecodeBounds set to true, pass the options through
and then decode again using the newinSampleSize value and inJustDecodeBounds set
to false.

Tuesday, 3 February 2015

CountDownTimer is a
predefined class, which help us in the timer related activities, such as
showing up the reducing of time seconds,
that we have seen while playing games or doing some timer related stuffs to our
apps etc… its easy to develop just passing the milliseconds as parameters and
it throws as our customized output as (HH:MM:SS) etc…

1.Design
a layout with a counter start Button and TextView to display the time

Friday, 2 January 2015

Plurals are a type of resource, we use it very often to deal with plurality of Strings, what does plurality of Strings means? Suppose you wants to denote the stock items and you want to print out the result, you will have to write at least 2 Strings like:

1
2
3
4
5

<resources>
<string name="zero"> No Items on the Stall!</string>
<string name="one">Only One Item on the Stall</string>
<string name="moreThanOne">There are %d Items on the Stall</string>
</resources>

Note that each language have limited quantity values based on grammar of each language, for English there are only two values of quantity “one”

and “other”, “zero” is not allowed in english, The plurals have the following types but it get differs to the languages.

ZeroWhen the language requires special treatment of the number 0 (as in Arabic).

One When the language requires special treatment of numbers like one (as with the number 1 in English and most other languages; in Russian, any number ending in 1 but not ending in 11 is in this class).

Two When the language requires special treatment of numbers like two (as with 2 in Welsh, or 102 in Slovenian).

Few When the language requires special treatment of "small" numbers (as with 2, 3, and 4 in
Czech; or numbers ending 2, 3, or 4 but not 12, 13, or 14 in Polish).

Many When the language requires special treatment of "large" numbers (as with numbers ending 11-99 in Maltese).

Other When the language does not require special treatment of the given quantity (as with all
numbers in Chinese, or 42 in English).

When using the getQuantityString() method, you need to pass the ItemsCount twice if your string includes string formatting with a number. For example, for the string %d Items found, the first ItemsCount parameter selects the appropriate plural string and the second ItemsCount parameter is inserted into the %d placeholder. If your plural strings do not include string formatting, you don't need to pass the third parameter to