Q:

how to generate light and pastel colors randomly in android?

I want to set background color to my layout, color must be generated randomly,
till now i am using this code to generate colors but the colors are so dark, but i don't want these dark colors, need only light and pastel colors.
Random rnd = new Random();
    int r = rnd.nextInt(155) + 100; // 128 ... 255
    int g = rnd.nextInt(155) + 010; // 128 ... 255
    int b = rnd.nextInt(155) + 001; // 128 ... 255

    int clr = Color.rgb(r, g, b);

A:

I don't understand why you add different numbers to each channel. Currently the result would be that you generate primarily red colors. 
Also if you put a leading 0 in front of a number it is interpreted as an octal number. In other words it is interpreted as base 8.
So 010 would actually be an octal number and the decimal equivalent is counter intuitively 8. The same goes for 001, but in that case the octal number is the same as the decimal one. 1 in octal is equivalent to 1 in decimal.
Additionally you don't use a seed for your Random instance. This is pretty bad because it means that you will always generate the exactly same colors. You need to use a seed from a sufficiently random source like System.currentTimeMillis().

But let's get to the point:
You can generate random pastel colors by randomly picking values for each channel and then mixing it with either white or with another pastel color. Try something like this:
final Random mRandom = new Random(System.currentTimeMillis());

public int generateRandomColor() {
    // This is the base color which will be mixed with the generated one
    final int baseColor = Color.WHITE;

    final int baseRed = Color.red(baseColor);
    final int baseGreen = Color.green(baseColor);
    final int baseBlue = Color.blue(baseColor);

    final int red = (baseRed + mRandom.nextInt(256)) / 2;
    final int green = (baseGreen + mRandom.nextInt(256)) / 2;
    final int blue = (baseBlue + mRandom.nextInt(256)) / 2;

    return Color.rgb(red, green, blue);
}

You can pick a light grey as base color, or some other pastel color you like. You should probably not pick white as base color since then the generated colors tend to be to light for white text to be easily visible. Try slightly darker shades or for the best result some pastel color you like.

