Adding advertisement to android application using php file -


i have created android application chatting whatsapp. want show advertisement @ specified location , content of advertise title,link,image fetch using php file.so how can this.please me if know.i have searched lot no solution found.

i have solved problem creating popup window...i have created small strip layout contain textview,imgaview,button , on. popup.xml

<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:id="@+id/popup" android:color="#66ff0000"   android:layout_height="wrap_content" android:background="#fff" >  <imageview     android:id="@+id/imageview1"     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:layout_alignparentleft="true"     android:layout_alignparenttop="true"     android:src="@drawable/ic_launcher" />  <textview     android:id="@+id/textview2"     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:layout_alignleft="@+id/textview1"     android:layout_below="@+id/textview1"     android:textcolor="#fff"     android:text="ad description" />  <button     android:id="@+id/button1"     style="?android:attr/buttonstylesmall"     android:layout_width="30dp"     android:layout_height="30dp"     android:layout_alignparentright="true"     android:layout_alignparenttop="true"     android:background="@drawable/close"      />  <textview     android:id="@+id/textview3"     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:layout_below="@+id/textview2"     android:layout_torightof="@+id/textview1"     android:textcolor="#fff"     android:text="www.nspiresfot.com" />  <textview     android:id="@+id/textview1"     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:layout_alignparenttop="true"     android:textcolor="#fff"     android:layout_torightof="@+id/imageview1"     android:text="ad title" />  <button     android:id="@+id/btn_openad"     style="?android:attr/buttonstylesmall"     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:layout_alignbaseline="@+id/textview2"     android:layout_alignbottom="@+id/textview2"     android:layout_toleftof="@+id/button1"     android:background="@drawable/send" /> 

mainactivity.java

package com.popwindow;  import android.os.bundle; import android.os.handler; import android.app.activity; import android.content.context; import android.graphics.point; import android.graphics.drawable.bitmapdrawable; import android.view.gravity; import android.view.layoutinflater; import android.view.menu; import android.view.view; import android.widget.button; import android.widget.linearlayout; import android.widget.popupwindow;  public class mainactivity extends activity { point p;  popupwindow popup; @override public void oncreate(bundle savedinstancestate) {    super.oncreate(savedinstancestate);    setcontentview(r.layout.activity_main);     button btn_show = (button) findviewbyid(r.id.show_popup);    p = new point();    p.x = 0;    p.y =60;    //open popup window  new handler().postdelayed(new runnable() {      public void run() {         if (p != null)           showpopup(mainactivity.this, p);     } }, 900l); }   // method displays popup. private void showpopup(final activity context, point p) {    int popupwidth = 240;    int popupheight = 50;     //inflate popup_layout.xml    linearlayout viewgroup = (linearlayout) context.findviewbyid(r.id.popup);    layoutinflater layoutinflater = (layoutinflater) context      .getsystemservice(context.layout_inflater_service);    view layout = layoutinflater.inflate(r.layout.popup_layout, viewgroup);    layout.getbackground().setalpha(90);    //creating popupwindow    popup = new popupwindow(context);    popup.setcontentview(layout);    popup.setwidth(popupwidth);    popup.setheight(popupheight);     popup.setfocusable(false);     // offset align popup bit right, , bit down, relative button's position.    int offset_x = 0;    int offset_y = 0;     // clear default translucent background    popup.setbackgrounddrawable(new bitmapdrawable());     // displaying popup @ specified location, + offsets.    popup.showatlocation(layout, gravity.no_gravity, p.x + offset_x, p.y + offset_y);   // popup.showatlocation(layout,  gravity.no_gravity, getrequestedorientation(), getrequestedorientation());    // getting reference close button, , close popup when clicked.    button close = (button) layout.findviewbyid(r.id.button1);    close.setonclicklistener(new view.onclicklistener() {       @override      public void onclick(view v) {        popup.dismiss();      }    }); }  @override protected void ondestroy() {     // todo auto-generated method stub     super.ondestroy();      popup.dismiss(); }  } 

and have used php file load textview , imageview.


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -