Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
191 views
in Technique[技术] by (71.8m points)

java - Getting error in showing DialogFragment activity

With the below code I am getting this error:

error:';' expected dialogFragment.show((Activity) _context).getSupportFragmentManager(), "Dialog"));

@Override
public View getChildView(int groupPosition, final int childPosition,
                         boolean isLastChild, View convertView, ViewGroup parent) {

    final String childText = (String) getChild(groupPosition, childPosition);

    if (convertView == null) {
        LayoutInflater infalInflater = (LayoutInflater) this._context
                .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        convertView = infalInflater.inflate(R.layout.list_item, null);
    }

    TextView txtListChild = (TextView) convertView.findViewById(R.id.lblListItem);
    Button btnListChild = (Button) convertView.findViewById(R.id.btn);
    btnListChild.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            CustomDialogClass dialogFragment = new CustomDialogClass();
            dialogFragment.show((Activity) _context).getSupportFragmentManager(), "Dialog"));
        }
    });

    txtListChild.setText(childText);
    return convertView;
}
question from:https://stackoverflow.com/questions/65916991/getting-error-in-showing-dialogfragment-activity

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Change dialogFragment.show((Activity) _context).getSupportFragmentManager(), "Dialog")); to dialogFragment.show((Activity) _context.getSupportFragmentManager(), "Dialog");


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...