In Java, as I understood you are using webView and you want to get all cookies of specific previewed URL, you can get current URL from webView client an pass it as a parameter to getCookie()
String cookies = CookieManager.getInstance().getCookie(webView.getUrl());
as a best practice, you should try it after page loaded like this
WebView webView = findViewById(R.id.webview_id);
WebViewClient webViewClient = new WebViewClient(){
@Override
public void onPageFinished(WebView view, String url) {
super.onPageFinished(view, url);
String cookies = CookieManager.getInstance().getCookie(view.getUrl());
// save cookies or call new fun to handle actions
// newCookies(cookies);
}
};
webView.setWebViewClient(webViewClient);
//webView.loadUrl(/*what ever url you want to load */);