[Solved] Get integer value from edittext And Access value on Button


Declare the ed_text and mViewPager in your onCreate like this

 final EditText ed_text =(EditText)findViewById(R.id.editText1);
 final ExtendedViewPager mViewPager = (ExtendedViewPager) findViewById(R.id.view_pager);

and now you can access the ed_text value in the bt_Goto click listener like this

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

                if(ed_text.getText().toString().length() > 0){
                    mViewPager.setCurrentItem(Integer.parseInt( ed_text.getText().toString()));
                }
            }
        });

1

solved Get integer value from edittext And Access value on Button