在Android上集成Tap Research sdk

时间:2017-02-27 09:50:49

标签: android android-studio sdk integration

我在我的Android应用上集成了Tap Research sdk,但应用程序却停止了。

知道为什么会这样吗?

这是我的代码tapresearchactivity.java



import android.app.Activity;
import android.app.Application;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.ProgressBar;
import android.widget.Toast;

import com.tapr.sdk.TapResearch;
import com.tapr.sdk.TapResearchOnRewardListener;

class MyApp extends Application {

    final private String YOUR_API_TOKEN = "fa7dbeeacebe7ae3e0b24e8dccaa6acb";

    public class onCreate{} {
        super.onCreate();
        TapResearch.configure(YOUR_API_TOKEN, this);
    }
}


public class TapresearchActivity extends Activity {
    private Button show_button;
    @Override
    protected void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        setContentView(R.layout.activity_tapresearch);

        /** Set up button to show an ad when clicked */
        show_button = (Button) findViewById(R.id.showbutton);
        if (TapResearch.getInstance().isSurveyAvailable()) {
            show_button.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    TapResearch.getInstance().showSurvey();
                }
            });

        }
    }
}




这是我的xml布局文件activity_tapreserch.xml



<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
                xmlns:tools="http://schemas.android.com/tools"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                tools:context=".TapresearchActivity">
 <Button
        android:layout_width="298dp"
        android:layout_height="68dp"
        android:enabled="false"
        android:id="@+id/showbutton"
        android:background="@drawable/button_blue"
        android:layout_alignParentBottom="true"
        android:layout_marginBottom="10dp"
        android:layout_centerHorizontal="true"/>
</RelativeLayout>
&#13;
&#13;
&#13;

0 个答案:

没有答案