Prem
Prem

Reputation: 4831

Android - Activity rendering issue

I am facing an issue in my application which i have explained below.

In Activity 1 i have a button. On touch of that button i am moving to Activity 2. On click of a button in Activity 2 i am moving to Activity 3.

My issue is - once Activity 3 appears, suddenly Activity 1 on create method getting called and the ontouch event is auto fired and Activity 2 re-appears. This appears only on first trial. When i click on a button in Activity 2 again, i go to Activity 3 and stay there.

If anybody had faced a similar issue, please help me on solving the same.

Upvotes: 0

Views: 231

Answers (2)

Prem
Prem

Reputation: 4831

The reason for this issue is ... On touch listener is fired twice. So, i replaced it with onclick listener and it worked.

Upvotes: 1

user1203673
user1203673

Reputation: 1015

when u are calling second activity

Intent activity2Intent = new Intent();
                activity2Intent .setClass(getApplicationContext(),
                        Activity2.class);
                startActivity(activity2Intent );
                finish();

and in the second activity when u are calling 3rd activity call like this

Intent activity3Intent = new Intent();
                activity3Intent .setClass(getApplicationContext(),
                        Activity3.class);
                startActivity(activity2Intent );
                finish();

The main thing u have to call is finish() even then if flickering is there use

intent.flag_activity_clear_top

Upvotes: 1

Related Questions