I was trying to work out with multiple layout using some online tutorials. The thing is my program was building and compiling correctly as long as there was only one XML fil
My error got removed by importing the line
import com.example.myapplication.R;
your import line may be different depending upon your project name in which my project name is myapplication