I can't focus when I reading books or playing with friends. I am getting bad grades on school exams. Why this happening. How to stay focused
Get checked for ADHD or ADD. My son had the same issues and now, with medication, he is doing a lot better.
This is happening for a number of reasons. I can only go off the information you have provided. But in the information age, with many social media sites and mobile apps, we are finding out that because we are frequently using technology in a way that in the long term and even short term, find us not being able to concentrate for ample periods of time. I find that exercise is a huge factor in the problem as it is healthy for the mind and body and allows us to go throughout or day more productively. Also limiting the time we spent on our phones and on the internet makes a huge difference. There are studies done on this to prove what i am saying. I can post these if you would like. Diet is also a big positive. What we put inside ourselves often dictates what comes out. So exercise, diet and monitoring our use of technology and social media will definitely help you out.
This is the last thing you should consider (firstly, as adviced in the previous answers, take care of yourself physically and mentally and seek professional help, as this seems to be seriously intervening with your daily life the way you describe it), but if you need to focus and find yourself unable to, having something to fidget with may help (boading balls, fidget spinners, chewing gums, etc.). Also, playing music on the background may help, but it may also make it worse.
You might consult with a doctor regarding your thyroid level. It seems that if you are losing weight your TSH (thyroid secretion hormone) may be too high. The thyroid gland regulates your metabolism. Since the metabolism affects every organ and the brain as well. It would also affect the attention span.
You should also get checked out for diabetes type 2 because this can also cause serious weight loss if left unchecked. I was diagnosed with it recently after my blood sugar spiked to 26.5, the normal range is between 4-7. This was preceded by a massive weight loss (43lbs in 8 weeks). Chronic High blood sugar can seriously impair mental focus.