I want to hide a listview item on release build but make it visible on debug build. I searched it on internet but I can't find anything about it. Anyone can help me?
5
-
If you are using Android Studio, you can create build flavors in your gradle file which then you can you use in an if statement to set the visibility.– DevsilCommented Jul 24, 2017 at 13:55
-
1Welcome to Stack Overflow. Please read first in the help center, how to ask a good question on this forum: stackoverflow.com/help/how-to-ask. So we can better unterstand your question and can help you with your problems.– JulianCommented Jul 24, 2017 at 13:55
-
Why don't you set the visibility to invisible?– B001ᛦCommented Jul 24, 2017 at 13:56
-
1. You can use flavor and have different layout for debug and release. 2. You can use BuildConfig.DEBUG flag in if else statements.– Sandeep ShabdCommented Jul 24, 2017 at 14:19
-
BuildConfig.DEBUG worked. thanks– user8141097Commented Jul 24, 2017 at 16:59
Add a comment
|
1 Answer
According to this post, there is an option to detect if an app is in debug or release mode:
if (BuildConfig.DEBUG) {
lbl.setVisibility(View.VISIBLE);
} else {
lbl.setVisibility(View.INVISIBLE);
}
Then you simply set the visibility based on the condition to visible or invisible.