Hi

I have a custom DialogFragment which has an ArrayAdapter in it which has 
some editTexts in it. When the dialog is shown the soft keyboard does not 
appear even if i press on the edit text. The edit text does take focus but 
the keyboard never comes up.

If i do not use an adapter and just use a view with an edit text it works 
perfectly but as soon as i add the adapter i get the issue.

My code is below. Any help would be really appreciated.

Thanks in Advance.

=====================================================================================================
public class ParameterDialog extends DialogFragment {
    Context context;

    @Override
    public Dialog onCreateDialog(Bundle savedInstanceState) {

        ArrayList<Parameter> params = 
this.getArguments().getParcelableArrayList(MainActivity.KEY_PARAMS_TO_DIALOG);
        String name = 
this.getArguments().getString(MainActivity.KEY_NAME_TO_DIALOG);

        context = getActivity();
        // Use the Builder class for convenient dialog construction
        AlertDialog.Builder builder = new 
AlertDialog.Builder(getActivity());

        ParameterDialogAdapter pda = new 
ParameterDialogAdapter(context,R.layout.parameter_config_string , params);

        // Inflate and set the layout for the dialog
        // Pass null as the parent view because its going in the dialog 
layout
        builder
                .setTitle(name)
                .setAdapter(pda,null)
                .setPositiveButton("Send", new 
DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int id) {
                    }
                })
                .setNegativeButton(android.R.string.cancel, new 
DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int id) {
                    }
                });

        // Create the AlertDialog object and return it
        return builder.create();
    }
}

===================================================================================

public class ParameterDialogAdapter extends ArrayAdapter<Parameter> {

    Context context;
    int layoutResourceId;
    ArrayList<Parameter> data= null;

    public ParameterDialogAdapter(Context context, int layoutResourceId, 
ArrayList<Parameter> data) {
        super(context, layoutResourceId, data);
        this.layoutResourceId = layoutResourceId;
        this.context = context;
        this.data = data;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {

        View row = convertView;
        //ParameterHolder holder = null;
        final LayoutInflater inflater = 
((Activity)context).getLayoutInflater();
        final int p =position;
        row = inflater.inflate(layoutResourceId, parent, false);
        return row;
    }

}

=Layout=======================================================

<LinearLayout
    android:orientation="horizontal"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    xmlns:android="http://schemas.android.com/apk/res/android";
    android:id="@+id/paramValueHolder"
    android:paddingRight="10dp"
    android:paddingLeft="10dp"
    android:paddingBottom="5dp">

    <EditText
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:id="@+id/paramValue"
        android:hint="Value"
        android:textColor="@color/text_grey" />
</LinearLayout>

==Code To Show 
 Dialog==========================================================

ParameterDialog pDialog = new ParameterDialog ();

            Bundle bundle = new Bundle();
            bundle.putString(KEY_NAME_TO_DIALOG,action.getName());
            bundle.putParcelableArrayList(KEY_PARAMS_TO_DIALOG, params);
            pDialog.setArguments(bundle);

            pDialog.setArguments(bundle);
            pDialog.show(ft, "parameter_dialog");



-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to