I am using ***textHeading named TextView*** in **UploadActivity.java** and ***controlling visibility of button*** in **LoginActivity.java** but getting **Null POinter Exception**

**Line of NPE:** 

```
if(UploadActivity.textHeading.getText().equals("0"))

```

**UploadActivity.java:-**

```
    static TextView textHeading = null ;

    @Override
    public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);      

    setContentView(R.layout.activity_upload);

    textHeading = (TextView) findViewById(R.id.txtEventNameDate);
    textHeading.setText(CameraLauncherActivity.folder);

    }   
} 

```

**LoginActivity.java:-**

```
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_login);

            if(UploadActivity.textHeading.getText().equals("0"))
            {
                btnGallery.setVisibility(View.VISIBLE);
            }
            else {
                btnGallery.setVisibility(View.GONE);
            }
      }

```