I am attempting to integrate a vungle ad into my android app. I had the ad working a few days ago and I changed nothing more than some xml layout since then. Now the vungle app is not loading. The vungle event listener works as it runs the code I have under the adUnavaliable section.

I noticed that a message comes up when I hover my cursor over the vunglepub.playAd(); line of code.

this messageg is: Note: This element neither has attached source nor attached Javadoc and hence no Javadoc could be found.

I'm not exactly sure what this means.

Here is my code for this section:

public class FinishActivity extends android.app.Activity {

// get the VunglePub instance
  final VunglePub vunglePub = VunglePub.getInstance();




  //setting a different score for the application in order to give back to the previouos screen after ad was played
  int score1 = 0;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.endscreen);
    vunglePub.setEventListener(vungleListener);

    final int score = getIntent().getIntExtra("finalscore", -1);
    score1 = score;
    final View restart = findViewById(R.id.restartButton);
    final View continueButton = findViewById(R.id.continueButton);

    final TextView scorefinal = (TextView) findViewById(R.id.finalscore);
    scorefinal.setText("Your Score: " + score);


    restart.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {

    //if restarting thescore use this
    Intent menuIntent = new Intent("com.nordquistproduction.robberducky.StartProgram");
    startActivity(menuIntent);
    finish();
        }
    });


    continueButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {

            //playing add 

            vunglePub.playAd();


        }
    });

}

private final EventListener vungleListener = new EventListener(){
    @Override
    public void onAdEnd(boolean wasCallToActionClicked) {
        // Called when the user leaves the ad and control is returned to your application
        /// if keeping the score use this
        Intent intent = new Intent(getApplicationContext(), StartProgram.class);
        intent.putExtra("startingscore", score1);
        startActivity(intent);
        finish();
    }

    @Override
    public void onAdStart() {
        // TODO Auto-generated method stub


    }

    @Override
    public void onAdUnavailable(String arg0) {
        // TODO Auto-generated method stub

        finish();
    }

    @Override
    public void onCachedAdAvailable() {
        // TODO Auto-generated method stub

    }

    @Override
    public void onVideoView(boolean arg0, int arg1, int arg2) {
        // TODO Auto-generated method stub

    }
};

  @Override
  protected void onPause() {
      super.onPause();
      vunglePub.onPause();
  }

  @Override
  protected void onResume() {
      super.onResume();
      vunglePub.onResume();
  }

I am super confused of why this ad is no longer working and what the message about the java docs means.

Please help! I have been stuck on this for a day or two now.

2

There are 2 best solutions below

3
On

This message means exactly what it says. No javadoc comment was provided over the method where it is actually defined.

/**
 *This is java doc
 *This method does something
 */
public void doSomething(){
    System.out.println("Do something");
}

When you mouse over this method in eclipse or another IDE that supports a similar feature, you will be provided with information about the method. There are various annotations that can be included to specify information about parameters and returns types as well. The java doc can also be generated into a file which can be browsed. For example: http://docs.oracle.com/javase/7/docs/api/

Also you may not see the java doc of code from a jar file you have included in your project because it is accessing compiled .class files instead of .java. If you really want the java docs and the jar is open source you can download the source and attach it as follows (assuming you are using Eclipse):

  1. Highlight that method
  2. Press F2 to focus
  3. Click 'Open Declaration' on the bottom
  4. Click 'Change Attached Source'
  5. Select the source you have downloaded

This will not only let you see the java docs but will also allow you step through the code you have imported in the debugger. While you usually will not have a need to do this, in some cases you might find a bug in that code.

The other issue about your code not working is unrelated. If you are not doing so already, I highly recommend that you get your code version controlled. git is what I would recommend (Though it can be rough on beginners, if you are the sole contributor to the code base you won't run into most of the intricacies people struggle with). With version control you could simply reset to the previous stable version of your program and try to figure out how you broke it from there. As well as being able to clearly what you actually changed between those two commits.

0
On

@Roger is spot on about the javadoc warning, but to resolve your other question (about the Vungle Ad not loading) you'll want to double check that you're running the init method on your vunglePub object as early as possible.

You could call it during onCreate (right before setting your event listener) to be sure an ad is cached and ready to play by the time you need it to be shown to the user:

public void onCreate(Bundle savedInstanceState) {
    ...
    vunglePub.init(this, "yourVungleAppId");
    vunglePub.setEventListener(vungleListener);
    ...
}

Hope that helps!