Came here, then continued the results and came across an elegant answer . (Vincent Cao May 12, 11)
private static final boolean isA = UUID.randomUUID().getLeastSignificantBits() % 2 == 0;
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
if(isA){
setContentView(R.layout.mainA);
MyApp.getInstance().tracker().trackPageView("/AUser");
}else{
setContentView(R.layout.mainB);
MyApp.getInstance().tracker().trackPageView("/BUser");
}
...
}
My only thought is to keep the choice so that every time I return to the same layout.
Chris source
share