Answer the question
In order to leave comments, you need to log in
How to execute certain code only for smartphones, ignoring tablets?
I just need to temporarily somehow restrict the work of a certain code for tablets, since it does not work on tablets as it should, and without it everything is fine, but I need to leave the code for phones. Here I would like to just select a block of code and tell it to work only on phones in the same place.
Something like this:
if (код выполняется на телефоне == true) {
// код для телефона
} else {
// код для планшета
}
Answer the question
In order to leave comments, you need to log in
In the values folder, create a bool.xml file:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<bool name="is_tablet">false</bool>
</resources>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<bool name="is_tablet">true</bool>
</resources>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question