First let me tell you about the problem. I have a Dell XPS 15 (L502 X). The problem just happened all of a sudden, The little battery icon above the keyboard starting flashing white and orange constantly even when the battery was full.
This problem was first encountered after 5-6 months of getting this laptop. I figured out this happens due to over heating of battery. Do not let your battery over heat. Keep it cool. Keep some space beneath your laptop to allow air to flow.
In my case, this problem was caused due to playing high end games for long time on the laptop and thus over heating the battery. This puts the battery on a temporary failure state.
Here are some solutions which you can try :
#1) Charged Battery
If your battery is fully charged, then disconnect the charger. The battery icon will still keep flashing.
If your laptop is cool, then proceed and work normally and ignore the flashing battery icon. It will stop flashing after sometime.
But if your laptop is hot, then shutdown and let it cool. Once its on normal temperature, turn it on and use it normally the way you want.
# 2) Low Battery
If your battery is low during the temporary failure state then charging it wont help. The battery wont get charged even if you try to do so.
So in this case, you have to shutdown your laptop and let it cool for hours.
# 3) Dead Battery
If your laptop is cool and still the battery is not getting charged, then try again after few hours or a day. If its still not charging, then have it replaced under the warranty.
If you have any questions, feel free to comment below. And if your battery is in good state, then maintain it and do not let your laptop overheat.