Skip to content Skip to sidebar Skip to footer

How Get Value Of Textview (with Currentview ) In Viewpager?

how get value of textview (with currentview ) in viewpager? Problem i gettext of textview but now current showing textview its gee=ttingtext of next view's textview class Test pack

Solution 1:

Code you mentioned is not clear. Try the below code to get current contact name from view pager

copyImg.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {

           int position = mViewPager.getCurrentItem();

            setClipboard(testContactName.get(position));
        }
    });

private void setClipboard(String text) {
    Log.v(TAG, "check..."+text);
    if(android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.HONEYCOMB) {
        android.text.ClipboardManager clipboard = (android.text.ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
        clipboard.setText(text);
        Toast.makeText(getApplicationContext(),text,Toast.LENGTH_LONG).show();
    } else {
        android.content.ClipboardManager clipboard = (android.content.ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
        android.content.ClipData clip = android.content.ClipData.newPlainText("Copied Text", text);
        clipboard.setPrimaryClip(clip);
        Toast.makeText(getApplicationContext(),"Copied To ClipBoard", Toast.LENGTH_LONG).show();
    }
}

Post a Comment for "How Get Value Of Textview (with Currentview ) In Viewpager?"