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); }
@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(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.AdView 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" >
</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.xml declare banner ad unit id <stringname="banner_ad_unit_id"&g…