I accidently deleted an activity.java from my com.packagename.appname. How do I get it back?

Viewed 187

While adding a feature to my app I messed up and decided to delete all the new files I had added for it but in doing that I accidentally deleted one of the activity from my app. I have integrated version control in my app and also shared my whole app source with GitHub but for some reason whenever I check out of previous version controls I cannot find the file. How can I recover the activity.java file? I have the app installed on my phone. Is it possible to recover it from there? or any other way to recover it?

2 Answers

If Ctrl + z or version control didnt worked try to check the local history of the android studio:

Move to project structure -> right click on your app name -> local history -> show history

enter image description here

Click on your package and do Ctrl+z and then undo changes.

Related