Search code examples
androidandroid-activitylayout

Go one activity from another activity using third layout in android


After clicking a button on first activity i want to go second activity. But before view second activity layout i want to show 3rd layout for specific time.


Solution

  • put a framelayout to your second activity layout and hide it after your specific time. You can use something like:

    new Thread(new Runnable() {
            @Override
            public void run() {               
                try {
                    Thread.sleep(yourspecifictimeinmilliseconds);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }                
                getActivity().runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        your3rdlayoutslayout.setVisibility(View.GONE);
                    }
                });                
            }            
        }).start();