# 10. Global Actions

Birden çok hedefin (destination) kullanabileceği ortak bir eylem oluşturmak için genel bir eylem (global action) kullanabilirsiniz. Örneğin, farklı hedeflerdeki düğmelerin aynı ana uygulama ekranına gitmesini isteyebilirsiniz. Bu durumda global action tanımlamak doğru bir yaklaşım olacaktır.

### Global action nasıl eklenir?

Bunun için tekrar örneğimize dönelim ve bir önceki derste hazırladığımız nested graph'a bir global action tanımlayalım.

**1.** Context menüsünü görüntülemek için hedefe sağ tıklayın.

![Context menüsünü görüntülemek için hedefe sağ tıklayın.](/files/-M-EoCw9tfgDcXi1F5Kx)

**2.** **Add Action > Global**’i seçin. Hedefin solunda bir ok belirir.

![](/files/-M-EokHXpT1oupKBAffN)

**3.** XML metin görünümüne gitmek için Metin sekmesini tıklayın. Genel eylem için XML aşağıdakine benzer:

```markup
<?xml version="1.0" encoding="utf-8"?>
<navigation xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/nav_graph"
    app:startDestination="@id/blankFragment">

    <fragment
        android:id="@+id/blankFragment"
        android:name="com.etiya.jpnavigation1.BlankFragment"
        android:label="fragment_blank"
        tools:layout="@layout/fragment_blank">
        <action
            android:id="@+id/action_blankFragment_to_blankFragment2"
            app:destination="@id/navigation" />
        <action
            android:id="@+id/action_blankFragment_to_blankFragment4"
            app:destination="@id/blankFragment4" />
    </fragment>
    <fragment
        android:id="@+id/blankFragment4"
        android:name="com.etiya.jpnavigation1.BlankFragment4"
        android:label="fragment_blank_fragment4"
        tools:layout="@layout/fragment_blank_fragment4">
        <action
            android:id="@+id/action_blankFragment4_to_blankFragment5"
            app:destination="@id/blankFragment5" />
    </fragment>
    <fragment
        android:id="@+id/blankFragment5"
        android:name="com.etiya.jpnavigation1.BlankFragment5"
        android:label="fragment_blank_fragment5"
        tools:layout="@layout/fragment_blank_fragment5" />
    <navigation
        android:id="@+id/navigation"
        app:startDestination="@id/blankFragment2">
        <fragment
            android:id="@+id/blankFragment2"
            android:name="com.etiya.jpnavigation1.BlankFragment2"
            android:label="fragment_blank_fragment2"
            tools:layout="@layout/fragment_blank_fragment2">
            <action
                android:id="@+id/action_blankFragment2_to_blankFragment3"
                app:destination="@id/blankFragment3" />
        </fragment>
        <fragment
            android:id="@+id/blankFragment3"
            android:name="com.etiya.jpnavigation1.BlankFragment3"
            android:label="fragment_blank_fragment3"
            tools:layout="@layout/fragment_blank_fragment3" />
    </navigation>
    <action
        android:id="@+id/action_global_navigation"
        app:destination="@id/navigation" />
</navigation>
```

Yaptığımız ekleme işleminden sonra ana root içerisinde eklenen global action aşağıdaki gibi XML dosyasına eklenmiş oldu.

```markup
<action
        android:id="@+id/action_global_navigation"
        app:destination="@id/navigation" />
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://egemen-mede.gitbook.io/jetpack-navigation/10.-global-actions.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
