I have Activity
that contains custom ActionBar and ViewPager
with three tabs.
I am not able to read text from EditText
inside tab when click
on button in ActionBar
.
EDITED: Contains TABS...
public class TranAdd extends FragmentActivity...{
SectionsPagerAdapter mSectionsPagerAdapter;
ViewPager mViewPager;
EditText et;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.fragment_pager);
mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());
mViewPager = (ViewPager) findViewById(R.id.pager);
mViewPager.setAdapter(mSectionsPagerAdapter);
ActionBar mActionBar = getActionBar();
mActionBar.setDisplayShowHomeEnabled(false);
mActionBar.setDisplayShowTitleEnabled(false);
LayoutInflater mInflater = LayoutInflater.from(this);
et = (EditText) mViewPager.findViewById(R.id.editText);
//...reference null...
View mCustomView = mInflater.inflate(R.layout.custom_actionbar, null);
TextView textViewTitle = (TextView) mCustomView.findViewById(R.id.textViewTitle);
textViewTitle.setText("New Transaction");
ImageView imageViewOk = (ImageView) mCustomView.findViewById(R.id.imageViewOk);
imageViewOk.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
String txt = et.getText().toString();
}
});
mActionBar.setCustomView(mCustomView);
mActionBar.setDisplayShowCustomEnabled(true);
}
FRAGMENT:
public class Fragment extends Fragment...{
...
@Override
public void onViewCreated(View view, Bundle savedInstanceState){
}