how can i get a string from the non activity java class ! i have used interface to send string from non activity java class to activity!
from this class file i have to pass the string Url.
public abstract class  CustomTabsURLSpan extends URLSpan implements Parcelable{
    String url;
    public CustomTabsURLSpan(String url) {
        super(url);
    }
    public void getLink(String url){
        this.url = url;
    }
    private OnSendUrl onSendUrl;
    public interface OnSendUrl{
        void singleUrl(String url);
    }
    @Override
    public void onClick(View widget) {
        Log.d("link",getURL()+"");
        url= getURL();
        onSendUrl.singleUrl(url); // throws null pointer Exception
    }
}
i need to get string here->>
public class MainActivity extends AppCompatActivity implements CustomTabsURLSpan.OnSendUrl{
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }
    @Override
    public void singleUrl(String url) {
        Log.d("url",url);
    }
}
 
    