How can I send or detect a reference or flag if a specific `Activity` was started from another `Activity` or not? I actually need a form in which I can execute only a certain piece of code only if this code was called by a specific `Activity`, for example:

**Activity 1:**

```
Intent intent = new Intent(this,ranking.class);
startActivity(intent);

```

**Activity2:**

```
Intent intent = new Intent(this,ranking.class);
startActivity(intent);

```

**Ranking.class (It's pseudocode since I don't really know how/what to do)**:

```
if(I was called by Activity  1) {
    //do something
} else {
     finish();
}

```