As we know that we can set ArrayAdapter to the Spinner or to ListView to populate data into these views.
In my app testView is there. I want to populate item of an arrayAdapter just below to TestView when TextView is clicked.
Please find the images:- In the Image if user will tap on 4 Selected then it show the list.
If user tap on other parts of the screen then list will gone.
In my app user will able to send message. Before sending message user needs to select people to whom he wants to send message from list(as shown in above image).
Suppose he select 5 people then on the top it will show "5 Selected" and when he clicks on "5 Selected" then I need to show selected person on top of the screen and when user tap some where else on the screen then the list will disappear.
Problem with expandable list view is when it expand then it expand on same screen but I want it will expand on top of the screen which will not disturb other views like spinner dropdown.
non of the above works for me. Any way thank you members for your time.
I achieve this by using AlerDialog and I put it on top.
public void showSelectedPeople(View v) {
ArrayList<String> aListNoOfSelection = new ArrayList<String>();
if (rows != null) {
for (PostOptionsRow postOptionsRow : rows) {
if (postOptionsRow.getType() == PostOptionsRow.TYPE_GROUP
&& !postOptionsRow.hasChildren()
&& postOptionsRow.isSelected()) {
aListNoOfSelection.add(postOptionsRow.getTitle());
} else if (postOptionsRow.getType() == PostOptionsRow.TYPE_GROUP
&& postOptionsRow.hasChildren()
&& postOptionsRow.getChildren() != null) {
for (PostOptionsRow postOptionsRowInner : postOptionsRow
.getChildren()) {
if (postOptionsRowInner.isSelected()) {
aListNoOfSelection.add(postOptionsRowInner
.getTitle());
}
}
}
}
}
aAdapterNoOfSelection = new NoOfSelectionAdapter(context, 0, aListNoOfSelection);
if (aListNoOfSelection.size() == 0) {
Toast.makeText(context, "Please select a recipient for this post.", Toast.LENGTH_SHORT).show();
return;
}
ListView listView = new ListView(this);
listView.setBackgroundColor(Color.WHITE);
listView.setAdapter(aAdapterNoOfSelection);
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setView(listView);
AlertDialog dialog = builder.create();
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
WindowManager.LayoutParams wmlp = dialog.getWindow().getAttributes();
wmlp.gravity = Gravity.TOP | Gravity.LEFT;
wmlp.x = 55; // x position
wmlp.y = 25; // y position
dialog.show();
}