Передаю bunlde в активити но выдает пустой bundle
Хочу открывать картинки в актвити из фрагмента передаю путь к картинке
public void openImage(String image) {
Intent intent = new Intent(getActivity(), FullscreenActivity.class);
Bundle b = new Bundle();
b.putString("image", image);
intent.putExtras(b);
startActivity(intent);
}
и в активити хочу получить путь который я засунул в Bundle
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_drawer_layout);
if(savedInstanceState == null) {
loge("savedinstance == null");
}
String image = savedInstanceState.getString("image");
ImageView imgView = (ImageView) findViewById(R.id.imageView4);
imgView.setImageDrawable(Drawable.createFromPath(image));
}
выходит так что bundle null и соответственно выдает exception
Источник: Stack Overflow на русском