Deleted hosts file (can't connect to internet) i have a rooted device (Lenovo A3000-h) , and i had this issue of having my hosts file filled every now and then with additional lines (that sometimes blocked me from logging into my google play account) , and i used to manually edit the file and just erase these extra lines (keeping the 127.0.0.1 line intact)

so yea everything was fine till this morning , i tried to access my google play and i couldn't so i tried to edit the hosts file one more time (as usual) but i noticed that the file size became 2.5mb although it has always been less than 0.5mb (170kb-250kb). anyways when i tried to edit it , the file wouldnt open giving me the message (not enough memory)

long story short i deleted the file and i noticed i had a hosts.bak file so i copied it and tried to connect but its taking forever and it's not connecting to the internet anymore.

hint : i took a copy of the file from my friend's "Samsung galaxy mega" phone and still it wouldn't connect
You shouldn't need a hosts file to connect to the internet. It's used to map custom (private) IPs to a hostname. Deleting it shouldn't prevent your device from connecting to the internet, but I can think of one instance where it could. I have to explain some background info first to help you understand.

DNS is the protocol used to map a FQDN (fully quantified domain name) like play.google.com to an IP address. Android is Linux based, which uses a config file called resolv.conf to send DNS lookup requests to. If your cell carrier is populating that file with a FQDN instead of an IP address, the IP address of that FQDN would need to be listed in the hosts file so your phone will know how to look it up.

Look at the contents of /system/etc/resolv.conf. You should see one or two lines that begin with the word nameserver. If the data that comes after that word looks like a FQDN, then a corresponding entry needs to be in the hosts file too. If it's an IP address, then the cause of your connectivity issues is something else entirely. The first step is making sure your device can reach the internet. I usually do something like ping 8.8.8.8 to do this as 8.8.8.8 is one of Google's public DNS servers. If you can hit that server, then your issue is DNS related. If you can't, then there's something else unrelated to the hosts file preventing you from reaching the internet.