I'm trying to send Extras from Activity A to B. The sending part is good, and the variables are not nulls, but I can't figure out how can I get them in Activity B. This is the code of sending:
public void sendToFavorites(Context context){
String vID,vThumbnail,vTitle;
vID = sendResult.getId().getVideoId();
vThumbnail = sendResult.getSnippet().getThumbnails().getMedium().getUrl();
vTitle = sendResult.getSnippet().getTitle();
Intent fav = new Intent(context,Favorites.class);
fav.putExtra("title",vTitle);
fav.putExtra("thumbnail",vThumbnail);
fav.putExtra("id",vID);
}
This is the code of getting:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.favorites_layout);
getSupportActionBar().setTitle("Favorites");
initializeViews();
//////////////////
Bundle extras = getIntent().getExtras();
vidID = extras.getString("id");
vidTitle = extras.getString("title");
vidThumbnail = extras.getString("thumbnail");
loadFavorites();
}
for some reason, the application crashes when I'm launching Activity B with NO log..
What am I doing worng?
Aucun commentaire:
Enregistrer un commentaire