Coder Social home page Coder Social logo

Comments (6)

RameshBhupathi avatar RameshBhupathi commented on August 22, 2024

Did u try with DialogFragment ?

from pickerview.

louiskhenghao avatar louiskhenghao commented on August 22, 2024

yes, the dialog is DialogFragment.

from pickerview.

CongBaDo avatar CongBaDo commented on August 22, 2024

I faced same problem. How to solve it?

from pickerview.

RameshBhupathi avatar RameshBhupathi commented on August 22, 2024

@llouiskhenghao @CongBaDo Can u please Post Your Code For ?

from pickerview.

CongBaDo avatar CongBaDo commented on August 22, 2024

This is DialogFragment with Picker
`public class FilterDialogFragment extends DialogFragment {
private String[] filters;

public FilterDialogFragment() {

}

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.dialog_filter, container);
    getDialog().getWindow().setSoftInputMode(
            WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
    getDialog().setTitle("Please enter username");

    CustomizedTextView customizedTextView = (CustomizedTextView)view.findViewById(R.id.tv_nationality_title);
    filters = getResources().getStringArray(R.array.filters);
    List<String> filterList = Arrays.asList(filters);

    LinearLayout llLocation = (LinearLayout)view.findViewById(R.id.ll_location);
    LinearLayout llRentType = (LinearLayout)view.findViewById(R.id.ll_rent_type);
    LinearLayout llBudget = (LinearLayout)view.findViewById(R.id.ll_budget);
    LinearLayout llNationality = (LinearLayout)view.findViewById(R.id.ll_nationality);
    LinearLayout llGender = (LinearLayout)view.findViewById(R.id.ll_gender);
    LinearLayout llAvailable = (LinearLayout)view.findViewById(R.id.ll_available_date);

    llLocation.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            showPickerView(1, getActivity());
        }
    });

    llRentType.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            showPickerView(4, getActivity());
        }
    });

    llBudget.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            showPickerView(4, getActivity());
        }
    });

    llNationality.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            showPickerView(2, getActivity());
        }
    });

    llGender.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            showPickerView(4, getActivity());
        }
    });


    return view;
}

private void showPickerView(int i, final Context context){

    MyOptionsPickerView singlePicker = new MyOptionsPickerView(context);
    final ArrayList<String> items = new ArrayList<String>();
    if(i == 1){
        List<ItemLocation> locationList = CoreManager.getInstance().getItemLocationList();
        for(int m =0; m < locationList.size(); m++){
            items.add(locationList.get(m).name);
        }
    }else if(i == 2){
        List<ItemCountry> locationList = CoreManager.getInstance().getItemCountryList();
        for(int m =0; m < locationList.size(); m++){
            items.add(locationList.get(m).name);
        }
    }else if(i == 3){
        for(int m =0; m < 20; m++){
            items.add(String.valueOf(m+1));
        }
    }else if(i == 4){
        List<ItemBudget> budgets = CoreManager.getInstance().getItemBudgetList();
        for(int m = 0; m < budgets.size(); m++){
            items.add(budgets.get(m).min +" - "+budgets.get(m).min);
        }
    }else if(i == 5){

    }

    singlePicker.setPicker(items);
    singlePicker.setTitle(filters[i]);
    singlePicker.setCyclic(false);
    singlePicker.setSelectOptions(0);
    singlePicker.setOnoptionsSelectListener(new MyOptionsPickerView.OnOptionsSelectListener() {
        @Override
        public void onOptionsSelect(int options1, int option2, int options3) {
            Toast.makeText(context, "" + items.get(options1), Toast.LENGTH_SHORT).show();
        }
    });

    singlePicker.show();
}

}`

from pickerview.

Ankur008 avatar Ankur008 commented on August 22, 2024

Any Solution?

from pickerview.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.