Reputation: 95
A table was created to display certain important datas while giving users limited editing functionality. The limited functionality would include a drop down list that lets user choose the following options in that column. However, i have no idea how is it implemented, Any suggestions?
Code written for the creation of the table column:
TextView label_Col_5_data = new TextView(this);
label_Col_5_data.setId(200+Count);
label_Col_5_data.setPadding(30, 5, 30, 5);
label_Col_5_data.setTextColor(Color.BLACK);
tr.addView(label_Col_5_data);
Upvotes: 0
Views: 408
Reputation: 2878
Just use below code and create your dialog.
final CharSequence[] items = {"Info", "Rename", "Delete"};
AlertDialog.Builder builder = new AlertDialog.Builder(write your activity context);
builder.setTitle("Options for " + file.getName());
builder.setItems(items, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int item) {
//Set data here
}
}).show();
Upvotes: 1
Reputation: 2878
Add one on click listener like this.
label_Col_5_data.setOnClickListener(operationListener );
OnClickListener operationListener = new OnClickListener() {
public void onClick(View v) {
int _clickId = v.getId();
// Write your popup code here.
}
};
Upvotes: 2