0
Может быть, нужно сохранить значение в SharedPreferences?Как отображать изображение один раз?
XML
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:id="@+id/fragment2_bacground"
android:foreground="@drawable/fragment2">
Класс
FrameLayout frameLayout;
frameLayout = (FrameLayout)rootViewB.findViewById(R.id.fragment2_bacground);
prefs = getActivity.getSharedPreferences("com.example.potehki.potehki", getActivity.MODE_PRIVATE);
Этот метод не работает
if (prefs.getBoolean("firstrun", true)) {
frameLayout .setforeground(null);
prefs.edit().putBoolean("firstrun", false).commit();
}
Любая помощь приветствуется.
if (prefs.getBoolean ("firstrun", true)) { imageView.setVisibility (View.GONE); prefs.edit(). PutBoolean ("firstrun", false) .commit(); } Так оно и должно быть? – upward
yes и right before: imageView = (ImageView) rootViewB.findViewById (R.id. [imageViewId]); – HocineHamdi