Add transview function and reorganize onCreate method.