listener for android spinner change activity

تعرفه تبلیغات در سایت
عنوان عکس
عنوان عکس
عنوان عکس
عنوان عکس
عنوان عکس


یافته ها در جستجو

    امکانات وب

    آرشیو مطالب

    برچسب ها

    Vote count: 0

    i have a tabbed activity that has a spinner in its toolbar. I need to trigger changes in the tab fragments whenever the spinner value changes. I have so far implemented it by getting the spinner value from the fragment. However its not working as needed. I am new to listeners, is there any way i can do this with android callbacks. Any help would be appreciated.

    public class ExtensionActivity extends AppCompatActivity {
        private SectionsPageAdapter mSectionsPageAdapter;
        @BindView( ViewPager mViewPager;
        @BindView( TabLayout tabLayout;
        @BindView( Toolbar toolbar;
        @BindView( public Spinner cropsSpinner;
        protected void onCreate(Bundle savedInstanceState) {
            mSectionsPageAdapter = new SectionsPageAdapter(getFragmentManager());
     private void setupViewPager(ViewPager viewPager){
            SectionsPageAdapter adapter  = new SectionsPageAdapter(getFragmentManager());
            adapter.addFragment(new ExtDescFragment(),"Description");
            adapter.addFragment(new ExtLandPFragment(),"Land Preparation");

    public class ExtDescFragment extends Fragment {
        public View onCreateView(LayoutInflater inflater, ViewGroup container,
                                 Bundle savedInstanceState) {
            // Inflate the layout for this fragment
            View view = inflater.inflate(R.layout.fragment_ext_desc, container, false);
            ((ExtensionActivity)getActivity()).cropsSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
                public void onItemSelected(AdapterView parent, View view, int position, long id) {
                    CROP =((ExtensionActivity)getActivity()).cp.get(position);
                public void onNothingSelected(AdapterView parent) {
    asked 1 min ago
    Izzo Obella

    نویسنده : استخدام کار بازدید : 1 تاريخ : جمعه 21 مهر 1396 ساعت: 23:07
    برچسب‌ها :
    اخبار و رسانه هاهنر و ادبیاترایانه و اینترنتعلم و فن آوریتجارت و اقتصاداندیشه و مذهبفوتو بلاگوبلاگ و وبلاگ نویسیفرهنگ و تاریخجامعه و سیاستورزشسرگرمی و طنزشخصیخانواده و زندگیسفر و توریسمفارسی زبان در دیگر کشورها