Showing posts from March, 2015

Custom ImageView Circular imageview

Circular imageview android

import android.content.Context; import; import; import; import; import; import; import; import;
import; import; import;; 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); }
@Override protectedvoid 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(; AdRequest adRequest = new AdRequest.Builder().build(); mAdView.loadAd(adRequest);

Declare in your xml layout file wherever you want to place advertisement
     < android: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" >

Manifest declaration :

<!--Include the AdActivity configChanges and theme. --> <activityandroid:name="" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"

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