Share your experience!
My Sony Xperia z1 front camera is not working.do help me to solve my problem.
Hi @Sriram2, welcome to our community!
I'm sorry to hear about the troubles with the front camera. 
Do you get any error message when you switch from the main camera to the front camera? Or is just showing a black screen?
There is a inbuilt test in the phone called Diagnostics, which you can find under Settings > About phone. Here you can test certain functions in your phone such as the front camera. How is the front camera working in this test?
If there is no change when running the Diagnostics test I'd recommend that you clear the data for the camera application in your phone. This will not delete any photos you have taken with your phone or videos that you have recorded, it will only delete the data and cache for the camera application.
Go to Settings > Apps > scroll to the right until you get to the "All" > scroll down and find "Camera" > tap on it and press "Clear data" and confirm with "OK".
Start the camera again and try the front camera, is it working now? If i'ts still not working correctly could you please try and reboot your phone in safe mode? When the phone is rebooted in safe mode all the applications that you have installed on your own will not be loaded, to see if one of them is the cause.
Let me know how it went!