Android Acrivity and delays

AnuraagAnuraag India
edited March 2015 in Android

I have two activities AppexActivity and QuestionActivity. I want to first start AppexActivity and then start QuestionActivity after 5 seconds automatically. This is the code I have written:

public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        new Handler().postDelayed(new Runnable() {
            public void run() {
                Intent intent = new Intent(getActivity(), AppexActivity.class);
    final View rootView = inflater.inflate(R.layout.activity_main, container, false);
    Button StartButton = (Button) rootView.findViewById(;
        Typeface typeface=Typeface.createFromAsset(getActivity().getAssets(),"fonts/1942.ttf");
    StartButton.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                Intent intent = new Intent(getActivity(), QuestionActivity.class);
    return rootView;

When this run QuestionActivity runs for 5 seconds instead of AppexActivity. What am I doing wrong?
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!