com.kii.ad
Class KiiAdNetLayout

java.lang.Object
  extended by android.view.View
      extended by android.view.ViewGroup
          extended by android.widget.RelativeLayout
              extended by com.kii.ad.KiiAdNetLayout
All Implemented Interfaces:
android.graphics.drawable.Drawable.Callback, android.view.accessibility.AccessibilityEventSource, android.view.KeyEvent.Callback, android.view.ViewManager, android.view.ViewParent

public class KiiAdNetLayout
extends android.widget.RelativeLayout

android widget for KiiAdnetwork.

  1. Add the following permissions to AndroidManifest.xml
    <uses-permission android:name="android.permission.INTERNET" />
  2. Add KiiAdNetSDK_Android_1.0.0.jar to classpath.
  3. Add jar files of other ad-network(i.e. Admob/InMobi).
  4. Create an com.kii.ad.KiiAdNetLayout. Make sure that this code is called in the main thread.
     // get scaledDensity
     Display display = getWindowManager().getDefaultDisplay();
     DisplayMetrics metrics = new DisplayMetrics();
     display.getMetrics(metrics);
     float scaledDensity = metrics.scaledDensity;
     
     // set targeting parameter
     KiiAdNetTargeting.setGender(KiiAdNetTargeting.Gender.FEMALE);
     KiiAdNetTargeting.setKeywords("Application");
     KiiAdNetTargeting.setAge(35);
     KiiAdNetTargeting.setPostalCode("30900");
     
     // create an KiiAdnetLayout
     KiiAdNetLayout adLayout = new KiiAdNetLayout(this, APP_ID, APP_KEY);
     layout.addView(adLayout);
     adLayout.setMaxWidth((int)(scaledDensity * 320));
     adLayout.setMaxHeight((int)(scaledDensity * 52));
     


Nested Class Summary
static interface KiiAdNetLayout.SiteID
           
 
Nested classes/interfaces inherited from class android.widget.RelativeLayout
android.widget.RelativeLayout.LayoutParams
 
Nested classes/interfaces inherited from class android.view.ViewGroup
android.view.ViewGroup.MarginLayoutParams, android.view.ViewGroup.OnHierarchyChangeListener
 
Nested classes/interfaces inherited from class android.view.View
android.view.View.BaseSavedState, android.view.View.MeasureSpec, android.view.View.OnClickListener, android.view.View.OnCreateContextMenuListener, android.view.View.OnFocusChangeListener, android.view.View.OnKeyListener, android.view.View.OnLongClickListener, android.view.View.OnTouchListener
 
Field Summary
 
Fields inherited from class android.widget.RelativeLayout
ABOVE, ALIGN_BASELINE, ALIGN_BOTTOM, ALIGN_LEFT, ALIGN_PARENT_BOTTOM, ALIGN_PARENT_LEFT, ALIGN_PARENT_RIGHT, ALIGN_PARENT_TOP, ALIGN_RIGHT, ALIGN_TOP, BELOW, CENTER_HORIZONTAL, CENTER_IN_PARENT, CENTER_VERTICAL, LEFT_OF, RIGHT_OF, TRUE
 
Fields inherited from class android.view.ViewGroup
FOCUS_AFTER_DESCENDANTS, FOCUS_BEFORE_DESCENDANTS, FOCUS_BLOCK_DESCENDANTS, PERSISTENT_ALL_CACHES, PERSISTENT_ANIMATION_CACHE, PERSISTENT_NO_CACHE, PERSISTENT_SCROLLING_CACHE
 
Fields inherited from class android.view.View
DRAWING_CACHE_QUALITY_AUTO, DRAWING_CACHE_QUALITY_HIGH, DRAWING_CACHE_QUALITY_LOW, FOCUS_BACKWARD, FOCUS_DOWN, FOCUS_FORWARD, FOCUS_LEFT, FOCUS_RIGHT, FOCUS_UP, FOCUSABLES_ALL, FOCUSABLES_TOUCH_MODE, GONE, HAPTIC_FEEDBACK_ENABLED, INVISIBLE, KEEP_SCREEN_ON, NO_ID, SCROLLBARS_INSIDE_INSET, SCROLLBARS_INSIDE_OVERLAY, SCROLLBARS_OUTSIDE_INSET, SCROLLBARS_OUTSIDE_OVERLAY, SOUND_EFFECTS_ENABLED, VISIBLE
 
Constructor Summary
KiiAdNetLayout(android.app.Activity context, java.lang.String appId, java.lang.String appKey)
           
KiiAdNetLayout(android.app.Activity context, java.lang.String appId, java.lang.String appKey, int siteId)
           
KiiAdNetLayout(android.content.Context context, android.util.AttributeSet attrs)
           
 
Method Summary
 android.app.Activity getActivity()
          return activity
 com.kii.ad.core.KiiAdNetManager getKiiAdNetManager()
           
 boolean onInterceptTouchEvent(android.view.MotionEvent event)
          We intercept clicks to provide raw metrics
 void setMaxHeight(int height)
           
 void setMaxWidth(int width)
           
 
Methods inherited from class android.widget.RelativeLayout
dispatchPopulateAccessibilityEvent, generateLayoutParams, getBaseline, requestLayout, setGravity, setHorizontalGravity, setIgnoreGravity, setVerticalGravity
 
Methods inherited from class android.view.ViewGroup
addFocusables, addFocusables, addStatesFromChildren, addTouchables, addView, addView, addView, addView, addView, bringChildToFront, childDrawableStateChanged, clearChildFocus, clearDisappearingChildren, clearFocus, dispatchConfigurationChanged, dispatchDisplayHint, dispatchKeyEvent, dispatchKeyEventPreIme, dispatchKeyShortcutEvent, dispatchSetSelected, dispatchTouchEvent, dispatchTrackballEvent, dispatchUnhandledMove, dispatchWindowFocusChanged, dispatchWindowVisibilityChanged, findFocus, focusableViewAvailable, focusSearch, gatherTransparentRegion, getChildAt, getChildCount, getChildMeasureSpec, getChildVisibleRect, getDescendantFocusability, getFocusedChild, getLayoutAnimation, getLayoutAnimationListener, getPersistentDrawingCache, hasFocus, hasFocusable, indexOfChild, invalidateChild, invalidateChildInParent, isAlwaysDrawnWithCacheEnabled, isAnimationCacheEnabled, offsetDescendantRectToMyCoords, offsetRectIntoDescendantCoords, recomputeViewAttributes, removeAllViews, removeAllViewsInLayout, removeView, removeViewAt, removeViewInLayout, removeViews, removeViewsInLayout, requestChildFocus, requestChildRectangleOnScreen, requestDisallowInterceptTouchEvent, requestFocus, requestTransparentRegion, scheduleLayoutAnimation, setAddStatesFromChildren, setAlwaysDrawnWithCacheEnabled, setAnimationCacheEnabled, setClipChildren, setClipToPadding, setDescendantFocusability, setLayoutAnimation, setLayoutAnimationListener, setOnHierarchyChangeListener, setPadding, setPersistentDrawingCache, showContextMenuForChild, startLayoutAnimation, updateViewLayout
 
Methods inherited from class android.view.View
bringToFront, buildDrawingCache, buildDrawingCache, cancelLongPress, checkInputConnectionProxy, clearAnimation, computeScroll, createContextMenu, destroyDrawingCache, draw, findViewById, findViewWithTag, focusSearch, forceLayout, getAnimation, getApplicationWindowToken, getBackground, getBottom, getContentDescription, getContext, getDefaultSize, getDrawableState, getDrawingCache, getDrawingCache, getDrawingCacheBackgroundColor, getDrawingCacheQuality, getDrawingRect, getDrawingTime, getFocusables, getFocusedRect, getGlobalVisibleRect, getGlobalVisibleRect, getHandler, getHeight, getHitRect, getHorizontalFadingEdgeLength, getId, getKeepScreenOn, getKeyDispatcherState, getLayoutParams, getLeft, getLocalVisibleRect, getLocationInWindow, getLocationOnScreen, getMeasuredHeight, getMeasuredWidth, getNextFocusDownId, getNextFocusLeftId, getNextFocusRightId, getNextFocusUpId, getOnFocusChangeListener, getPaddingBottom, getPaddingLeft, getPaddingRight, getPaddingTop, getParent, getResources, getRight, getRootView, getScrollBarStyle, getScrollX, getScrollY, getSolidColor, getTag, getTag, getTop, getTouchables, getTouchDelegate, getVerticalFadingEdgeLength, getVerticalScrollbarWidth, getViewTreeObserver, getVisibility, getWidth, getWindowToken, getWindowVisibility, getWindowVisibleDisplayFrame, hasWindowFocus, inflate, invalidate, invalidate, invalidate, invalidateDrawable, isClickable, isDrawingCacheEnabled, isDuplicateParentStateEnabled, isEnabled, isFocusable, isFocusableInTouchMode, isFocused, isHapticFeedbackEnabled, isHorizontalFadingEdgeEnabled, isHorizontalScrollBarEnabled, isInEditMode, isInTouchMode, isLayoutRequested, isLongClickable, isOpaque, isPressed, isSaveEnabled, isScrollbarFadingEnabled, isSelected, isShown, isSoundEffectsEnabled, isVerticalFadingEdgeEnabled, isVerticalScrollBarEnabled, layout, measure, offsetLeftAndRight, offsetTopAndBottom, onCheckIsTextEditor, onCreateInputConnection, onFinishTemporaryDetach, onKeyDown, onKeyLongPress, onKeyMultiple, onKeyPreIme, onKeyShortcut, onKeyUp, onStartTemporaryDetach, onTouchEvent, onTrackballEvent, onWindowFocusChanged, performClick, performHapticFeedback, performHapticFeedback, performLongClick, playSoundEffect, post, postDelayed, postInvalidate, postInvalidate, postInvalidateDelayed, postInvalidateDelayed, refreshDrawableState, removeCallbacks, requestFocus, requestFocus, requestFocusFromTouch, requestRectangleOnScreen, requestRectangleOnScreen, resolveSize, restoreHierarchyState, saveHierarchyState, scheduleDrawable, scrollBy, scrollTo, sendAccessibilityEvent, sendAccessibilityEventUnchecked, setAnimation, setBackgroundColor, setBackgroundDrawable, setBackgroundResource, setClickable, setContentDescription, setDrawingCacheBackgroundColor, setDrawingCacheEnabled, setDrawingCacheQuality, setDuplicateParentStateEnabled, setEnabled, setFadingEdgeLength, setFocusable, setFocusableInTouchMode, setHapticFeedbackEnabled, setHorizontalFadingEdgeEnabled, setHorizontalScrollBarEnabled, setId, setKeepScreenOn, setLayoutParams, setLongClickable, setMinimumHeight, setMinimumWidth, setNextFocusDownId, setNextFocusLeftId, setNextFocusRightId, setNextFocusUpId, setOnClickListener, setOnCreateContextMenuListener, setOnFocusChangeListener, setOnKeyListener, setOnLongClickListener, setOnTouchListener, setPressed, setSaveEnabled, setScrollbarFadingEnabled, setScrollBarStyle, setScrollContainer, setSelected, setSoundEffectsEnabled, setTag, setTag, setTouchDelegate, setVerticalFadingEdgeEnabled, setVerticalScrollBarEnabled, setVisibility, setWillNotCacheDrawing, setWillNotDraw, showContextMenu, startAnimation, unscheduleDrawable, unscheduleDrawable, willNotCacheDrawing, willNotDraw
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface android.view.ViewParent
createContextMenu, getParent, isLayoutRequested
 

Constructor Detail

KiiAdNetLayout

public KiiAdNetLayout(android.app.Activity context,
                      java.lang.String appId,
                      java.lang.String appKey)

KiiAdNetLayout

public KiiAdNetLayout(android.app.Activity context,
                      java.lang.String appId,
                      java.lang.String appKey,
                      int siteId)

KiiAdNetLayout

public KiiAdNetLayout(android.content.Context context,
                      android.util.AttributeSet attrs)
Method Detail

onInterceptTouchEvent

public boolean onInterceptTouchEvent(android.view.MotionEvent event)
We intercept clicks to provide raw metrics

Overrides:
onInterceptTouchEvent in class android.view.ViewGroup

setMaxWidth

public void setMaxWidth(int width)

setMaxHeight

public void setMaxHeight(int height)

getKiiAdNetManager

public com.kii.ad.core.KiiAdNetManager getKiiAdNetManager()

getActivity

public android.app.Activity getActivity()
return activity

Returns:
null if activity is destroyed