我的应用程序已在Google Play商店停留了一个月,一切正常.两天前,我将它添加到"为家庭设计"类别中.我收到了Google团队的接受和祝贺.因此,我的插页式广告已停止展示.我收到了AdRequest.ERROR_CODE_NO_FILL.
InterstitialAd interstitialAd;
Bundle extras = new Bundle();
extras.putBoolean("is_designed_for_families", true);
AdRequest adRequest = new AdRequest.Builder()
.addNetworkExtrasBundle(AdMobAdapter.class, extras)
.build();
interstitialAd = new InterstitialAd(this);
interstitialAd.setAdUnitId(InterstitialSample.AD_UNIT_ID);
interstitialAd.loadAd(adRequest);
interstitialAd.setAdListener(new AdListener() {
@Override
public void onAdLoaded() {
Log.d("Tim", "OK");
}
@Override
public void onAdFailedToLoad(int errorCode) {
String message = String.format("onAdFailedToLoad (%s)", InterstitialSample.getErrorReason(errorCode));
Log.d("Tim", message);
}
});
Run Code Online (Sandbox Code Playgroud)
我没有更改包名.此外,我尝试改变AD_UNIT_ID没有成功.
我尝试使用两种类型的视图和两种类型的ViewHolrdes,但收到错误:
java.lang.ArrayIndexOutOfBoundsException: length=2; index=2
at android.widget.AbsListView$RecycleBin.addScrapView(AbsListView.java:6705)
at android.widget.AbsListView.trackMotionScroll(AbsListView.java:5210)
at android.widget.AbsListView$FlingRunnable.run(AbsListView.java:4368)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:776)
at android.view.Choreographer.doCallbacks(Choreographer.java:579)
at android.view.Choreographer.doFrame(Choreographer.java:547)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:762)
at android.os.Handler.handleCallback(Handler.java:800)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:194)
at android.app.ActivityThread.main(ActivityThread.java:5371)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
at dalvik.system.NativeStart.main(Native Method)
Run Code Online (Sandbox Code Playgroud)
这是我的适配器:
public class FriendsListAdapterFromKesh extends ArrayAdapter<FriendListEntryItem> {
List<FriendListEntryItem> friends;
List<FriendListEntryItem> friendsWithoutPoints;
Context context;
private LayoutInflater inflater;
private LayoutInflater mLayoutInflater;
private static String ROOT_DIRECTORY_PATH = Environment.getExternalStorageDirectory() + File.separator + ".SleepKeeker/Photos old";
FriendsTab friendsTab;
public FriendsListAdapterFromKesh(Context context, final List<FriendListEntryItem> friends, final List<FriendListEntryItem> friendsWithoutPoints) { …Run Code Online (Sandbox Code Playgroud) 我是Retrofit的新手.尝试时,如果没有收到retrofit.RetrofitError和NetworkOnMainThreadException,则无法发出请求:
RestAdapter restAdapter = new RestAdapter.Builder()
.setEndpoint(Url.BASE_URL)
.build();
Api api = restAdapter.create(Api.class);
for(Url url : Url.values()) {
Journal journal = api.getJournalInfo(url.getUrl()); //Here error
System.out.println("journal : " + journal.getTitle());
}
Run Code Online (Sandbox Code Playgroud)
这是班级期刊:
public class Journal {
private String title;
private String description;
private String image;
public String getTitle() {
return title;
}
}
Run Code Online (Sandbox Code Playgroud)
类网址:
public enum Url {
ECONAMICS("economics.json"),
PHYSICS("mathematical.json"),
MATHEMATICAL("physics.json");
public static final String BASE_URL = "https://dl.dropboxusercontent.com/u/17192683/rest/journals/";
private String url;
Url(String url) {
this.url = url;
}
public String getUrl() { …Run Code Online (Sandbox Code Playgroud)