[Solved] why textview get text show older value on button click?


onCreate() is called only once at the time of activity crated if you want it to update is when you come from background or from other activity you have to use onResume() so put this in onResume()

@Override
    protected void onResume() {
        super.onResume();
        ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
        if(clipboard.getText()!=null)
        {
            String paste_url=clipboard.getText().toString();
            Log.d("clip",paste_url);

            text_view.setText(paste_url);
        }

    }

1

solved why textview get text show older value on button click?