I want to change text size by screen resolution to phones and i used with dimens like this:
I set by Screen Height and its works fine with phone like naxus 5 or pixel 3XL. My question is if this is how I should define? What did I do well enough to fit any cell phone and tablet?
The files listed above will most certainly cover any android device or tablet. You can always add more configurations if you eventually find a device that isn't utilizing the correct dimens.xml that you desire. There are so many android devices of all shapes and sizes, it is hard to have a coverall approach by using xml files.
Another option would be to programmatically set the the font size based on a ratio of the screen dimensions which can be found below. Exactly how to best do that would depend on how your app is set up.
Using the height and width above you could change the font size. However, Where exactly to do that in your code depends entirely on how your app is set up.