Posts

Showing posts from March, 2015

Custom ImageView Circular imageview

Circular imageview android


import android.content.Context;import android.graphics.Bitmap;import android.graphics.Bitmap.Config;import android.graphics.Canvas;import android.graphics.Color;import android.graphics.Paint;import android.graphics.PorterDuff;import android.graphics.PorterDuff.Mode;import android.graphics.PorterDuffXfermode;
import android.graphics.Rect;import android.graphics.RectF;import android.graphics.drawable.BitmapDrawable;importandroid.graphics.drawable.Drawable;import android.util.AttributeSet;import android.widget.ImageView;
publicclass RoundImageView extends ImageView {
public RoundImageView(Context context) {super(context);}
public RoundImageView(Context context, AttributeSet attrs) {super(context, attrs);}
public RoundImageView(Context context, AttributeSet attrs, intdefStyle) {super(context, attrs, defStyle);}
@Overrideprotectedvoid onDraw(Canvas canvas) {BitmapDrawable drawable = (BitmapDrawable) getDrawable();
if (drawable == null) {return;}
if (getWidth() == 0 || ge…

Admob integration into Android application (Google advertisements )

    In Activity file add the below code
AdView mAdView = (AdView) rootView.findViewById(R.id.adView);AdRequest adRequest = new AdRequest.Builder().build();mAdView.loadAd(adRequest);

Declare in your xml layout file wherever you want to place advertisement
     <com.google.android.gms.ads.AdViewandroid:id="@+id/adView"android:layout_width="match_parent"android:layout_height="100dp"android:layout_weight="1"ads:adSize="BANNER"ads:adUnitId="@string/banner_ad_unit_id" >
</com.google.android.gms.ads.AdView>

Manifest declaration :

<!--Include the AdActivity configChanges and theme. --><activityandroid:name="com.google.android.gms.ads.AdActivity"android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
android:theme="@android:style/Theme.Translucent"/>


in strings.xmldeclare banner ad unit id<stringname="banner_ad_unit_id"&g…