dimanche 17 mai 2015

NullExceptionPointer, nothing is null

I'm trying to send some data to Activity B from Activity A. This is the code of A:

public void sendToFavorites(){
        Intent fav = new Intent(MainActivity.this,Favorites.class);
        fav.putExtra("title",sendResult.getSnippet().getTitle());
        fav.putExtra("thumbnail",sendResult.getSnippet().getThumbnails().getMedium().getUrl());
        fav.putExtra("id", sendResult.getId().getVideoId());
}

This is the problem I get:

java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.content.Context.getPackageName()' on a null object reference

Aucun commentaire:

Enregistrer un commentaire