我正在实施谷歌提供的原生广告代码.这样做还可以google
广告单元ID ADMOB_AD_UNIT_ID ="ca-app-pub-3940256099942544/2247696110"
但当我用我的id替换它没有显示广告和执行onAdFailedToLoad方法并且 无法加载原生广告:0错误.
I tried two different ad unit id but it didn't load ad.
so what should I do??please help me
Run Code Online (Sandbox Code Playgroud)
我试过下面的代码
final LayoutInflater li = (LayoutInflater) appContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
AdLoader.Builder builder = new AdLoader.Builder(appContext, Global.ADMOB_AD_UNIT_ID);
builder.forContentAd(new NativeContentAd.OnContentAdLoadedListener() {
@Override
public void onContentAdLoaded(NativeContentAd ad) {
//viewHolder.rlnativead.setVisibility(View.VISIBLE);
NativeContentAdView adView = (NativeContentAdView)li
.inflate(R.layout.ad_content, null);
populateContentAdView(ad, adView);
viewHolder.fl_adplaceholder.removeAllViews();
viewHolder.fl_adplaceholder.addView(adView);
}
});
AdLoader adLoader = builder.withAdListener(new AdListener() {
@Override
public void onAdFailedToLoad(int errorCode) {
// Toast.makeText(appContext, "Failed to …Run Code Online (Sandbox Code Playgroud) 我是firebase的新手,我想实施Firebase云消息传递(FCM)我正面临着开始使用它的问题.firebase没有初始化.谢谢你的帮助.
的build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.gms:google-services:3.0.0'
}
}
allprojects {
repositories {
jcenter()
}
}
Run Code Online (Sandbox Code Playgroud)
build.gradle(app)
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "24.0.0"
defaultConfig {
applicationId "com.example.sai_praneeth7777.hasportal"
minSdkVersion 21
targetSdkVersion 24
versionCode 1
versionName "1.0"
}
buildTypes { …Run Code Online (Sandbox Code Playgroud) 我想在旋转车轮时播放声音根据角度和坐标轮的旋转速度
当Pin触摸在线触摸Arc时,我想在正确的时间播放Sound Play.
此外,想要动画在Pin上像触摸一样震动.
声音是播放但是声音连续播放并且根据画布轮不寻求坐标
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
drawWheelBackground(canvas);
initComponents();
float tempAngle = 0;
float sweepAngle = 360 / mWheelItems.size();
if (this.mWheelItems != null) {
Log.e("mWheelItems.size()", String.valueOf(mWheelItems.size()));
for (int i = 0; i < mWheelItems.size(); i++) {
archPaint.setColor(mWheelItems.get(i).color);
archPaint1.setColor(Color.WHITE);
canvas.drawArc(range, tempAngle, sweepAngle, true, archPaint2);
canvas.drawArc(range, tempAngle, sweepAngle, true, archPaint);
drawImage(canvas, tempAngle, mWheelItems.get(i).bitmap, mWheelItems.get(i).mvalue, sweepAngle);
}
if (!(this.resourcePlayer == null)) {
if (this.resourcePlayer.isPlaying()) {
resourcePlayer.setVolume(100, 100);
this.resourcePlayer.seekTo(0);
} else {
this.resourcePlayer.start();
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
根据wheelItemCenter和360度旋转
final …Run Code Online (Sandbox Code Playgroud) 我正在尝试将一个片段插入另一个片段,并且我已经成功做到这一点,直到我第一次吃完主要片段为止,但是当我尝试重新加载片段时,应用崩溃了,我有这个错误:
Caused by: java.lang.IllegalArgumentException: Binary XML file line #26:
Duplicate id 0x7f0e00e2, tag null, or parent id 0xffffffff with another
fragment for com.google.android.gms.location.places.ui.PlaceAutocompleteFragment
Run Code Online (Sandbox Code Playgroud)
这是我的片段
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.source_destination,container, false);
PlaceAutocompleteFragment sourcr_autocompleteFragment = (PlaceAutocompleteFragment)
getActivity().getFragmentManager()
.findFragmentById(R.id.sourcr_autocomplete_fragment);
return rootView;
// List item
}
Run Code Online (Sandbox Code Playgroud)
这是我的XML
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:padding="10dp"
android:background="@color/colorPrimary"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/margin_medium"
android:layout_marginBottom="@dimen/margin_medium">
<fragment
android:id="@+id/sourcr_autocomplete_fragment"
android:name="com.google.android.gms.location.places.ui.PlaceAutocompleteFragment"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</android.support.v7.widget.CardView>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud) 我想生成这样的随机数
ADF1845CFT
ADF1864ATY
ADF18AT65Y
注意:在那里我修复了ADF18我想只需要接下来的5位数字和包机
我成功创建了带数字的5位数字
我正在使用各种解决方案
等方法
通过这些方法,我创建了成功的随机5位数字.
任何帮助欣赏......
我想录制像 snapchat 这样的视频,我正在尝试创建这样的录制按钮

并且还可以在用户长按按钮时录制视频,并在用户离开时停止录制,我该如何构建它?请伙计们帮帮我!!!
我正在尝试keyboard使用此代码禁用左右两侧的功能,但viewPager按左右键会button更改寻呼机的状态。
edComment.setOnEditorActionListener(
new EditText.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (actionId == EditorInfo.IME_FLAG_NAVIGATE_PREVIOUS
|| actionId == EditorInfo.IME_FLAG_NAVIGATE_NEXT
|| actionId == EditorInfo.IME_ACTION_PREVIOUS
|| actionId == EditorInfo.IME_ACTION_NEXT
) {
return false;
}
// Return true if you have consumed the action, else false.
return false;
}
});
Run Code Online (Sandbox Code Playgroud)
import android.app.AlertDialog;
import android.app.Service;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Bundle;
import android.os.IBinder;
import android.provider.Settings;
import android.util.Log;
public class GPSTracker extends Service implements LocationListener {
private Context mContext;
// flag for GPS status
boolean isGPSEnabled = false;
// flag for network status
boolean isNetworkEnabled = false;
// flag for GPS status
boolean canGetLocation = false;
Location location; // location
double latitude; // latitude
double longitude; // longitude
// The minimum distance to change …Run Code Online (Sandbox Code Playgroud)