android - My App Spinner is getting in last -
hey guys want set spinner default text in top select category
shown last when fetch data data base want set text on top of items
my code is
private void loadspinnerdata() { socialdatabase db = new socialdatabase(getapplicationcontext()); arraylist<string> lables = db.getalllabels(); lables.add("select category"); arrayadapter<string> dataadapter = new arrayadapter<string>(this, r.layout.spinner_text, lables); dataadapter .setdropdownviewresource(r.layout.spinner_text); txtspinner.setadapter(dataadapter); }
this output
[
want this
please me
try line of code
replace
lables.add("select category");
with
lables.add(0, "select category");
Comments
Post a Comment