**New Question abaut this:** [Android Studio Refresh Error](https://stackoverflow.com/questions/44704999/android-studio-refresh-error)

I want call a `Method` in a Fragment from another Fragment. I have already tried this: 

```
(Tab3Storage) (getSupportFragmentManager().findFragmentById(R.id.tab3storage)).Storagerefresh();

```

but I have a `NullPointerException` error. How I can make this or a calling form a activity to the Fragment, because the calling from the Fragment to the Activity works already fine.

Code:

Main Activity: 

```
public void refreshAll(){

    Tab3Storage tab3Storage = new Tab3Storage();
    tab3Storage.Storagerefresh();

    Tab4Gravel tab4Gravel = new Tab4Gravel();
    tab4Gravel.Gravelrefresh();
}

```

This is the Fragment Code:

```
totalMoney = loadData("totalMoney");
    totalMoneyDisplay.setText("$ " + totalMoney);

    totalGravel = loadData("totalGravel");
    totalGravelDisplay.setText(totalGravel + " Gravel");

    Storage_Level = loadData("storageLevel");
    if (Storage_Level == 0){
        Storage_Level = 1;
    }
    if(Storage_Level == 1){
        Storage_Capacity = Storage_Level1;
    }
    if(Storage_Level == 2){
        Storage_Capacity = Storage_Level2;
    }
    if(Storage_Level == 3){
        Storage_Capacity = Storage_Level3;
    }
    if(Storage_Level == 4){
        Storage_Capacity = Storage_Level4;
    }
    saveData("storageLevel", Storage_Level);

    Storage_Filled = totalGravel;
    storageCapacityDisplay.setText(Storage_Filled + "/" + Storage_Capacity);
    SellGravelButton.setText("Sell: $" + totalGravel);

    storageUpgradebtn.setText("Level " + Storage_Level + ":\n$" + Storage_Capacity / 2 );

```

load Data Code:

```
private long loadData(String name){

    SharedPreferences shared = this.getActivity().getPreferences(Context.MODE_PRIVATE);
    long value = shared.getLong(name, 0);
    return value;
}

```