I have activity and activity has a viewpager.
I want to send my edittext's text to pager 1 and call page1's asynctask from activity has viewpager.
I have activity and activity has a viewpager.
I want to send my edittext's text to pager 1 and call page1's asynctask from activity has viewpager.
in case you want to send text from outside ViewPager (Activity) to somewhat screen inside ViewPager,
try implement this in activity, to provide the way to get your text from this activity through interface
public class TestActivity implement GetTextCallback {
public interface GetTextCallback {
String getText()
}
@Override
public String getText() {
return editText.getText().toString();
}
}
and this in ViewPager's fragment, to get text from your activity through interface you created
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
if (getTextCallback == null) {
getTextCallback = (GetTextCallback) activity;
}
}
public void whenYouWantToGetText() {
if (getTextCallback != null) {
getTextCallback.getTextYouWant();
}
}