Android广告 [英] Android Advertising

查看:90
本文介绍了Android广告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前有一个免费的Android应用程序,该应用程序在Android市场上非常高兴.问题在于它没有赚钱.

有人可以告诉我如何在应用程序中投放一些广告,以便可以利用我在Android上的辛勤工作和投资.

在此先感谢

Pie Eater

I currently have a free Android application which exists quite happily on the Android market. The problem is that it does not make any money.

Can someone tell me how to put some advertising into the application so that I can capitalise on my hard work and investment in Android.

Thanks in advance

Pie Eater

推荐答案

问题是您的广告是什么样的?假设您要下载一些新信息,以便从网络上显示这些信息.要阅读文字,您可以使用类似以下内容的内容:
The question is what your advertising looks like? Let''s suppose you want to download some new info to be shown from web. To read text you can use something like:
InputStream is = null;
try {
    is = OpenHttpConnection(URL);
    InputStreamReader isr = new InputStreamReader(is);
    int read;
    String str = "";
    char[] ib = new char[1024];

   while ((read = isr.read(ib))>0)
   {
     String string =
     String.copyValueOf(ib, 0, read);
     str += string;
     ib = new char[1024];
  }
   in.close();
} catch (Exception e) {
}



对于图像,BitmapFactory具有解码流方法.
最后使用Toast展示您的广告.如果提供相应的布局,它可能会非常复杂.设计布局以获取所需的所有信息并显示吐司:



For images BitmapFactory has decodeStream method.
And finally use Toast to show your ads. It can be quite complicated, if you provide corresponding layout for it. Design your layout to have all info needed and show the toast:

Toast toast = new Toast(getApplicationContext());
toast.setGarvity(Gravity.LEFT | Gravity.BOTTOM, 0, 0);
toast.setDuration(Toast.LENGTH_LONG);
toast.setView(layout);
toast.show();


这篇关于Android广告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆