I have to layout xml named activity_layout_1 and activity_layout_2 and one common Activity. Based on different conditions, I set contentview of the two xml In a case, I need to check which layout is currently set.
I can get the id as below:
View currentView = this.getWindow().getDecorView().findViewById(android.R.id.content);
int id = currentView.getId();
Is there a better way to get/identify current layout running?
That id is the id of android.R.id.content no the id of the current layout.
A better way of doing is with tags
setTag()andgetTag()Like: