-1

i used edittext but not focauseble softkey board what wrong with me.How to solve it? my code below.

My Xml Code ::

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/relative_sendimage_send"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@android:color/white"
    android:orientation="vertical" >

    <RelativeLayout
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_centerHorizontal="true" >

        <com.buymysari.SegmentedRadioGroup
            android:id="@+id/segment_text"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_margin="5dip"
            android:checkedButton="@+id/button_one"
            android:orientation="horizontal" >

            <RadioButton
                android:id="@id/button_one"
                android:layout_margin="15dip"
                android:button="@null"
                android:gravity="center"
                android:minHeight="80dip"
                android:minWidth="80dip"
                android:text="S"
                android:textAppearance="?android:attr/textAppearanceSmall"
                android:textColor="@color/radio_colors" />

            <RadioButton
                android:id="@+id/button_two"
                android:layout_margin="15dip"
                android:button="@null"
                android:gravity="center"
                android:minHeight="80dip"
                android:minWidth="80dip"
                android:text="C"
                android:textAppearance="?android:attr/textAppearanceSmall"
                android:textColor="@color/radio_colors" />

            <RadioButton
                android:id="@+id/button_three"
                android:layout_margin="15dip"
                android:button="@null"
                android:gravity="center"
                android:minHeight="80dip"
                android:minWidth="80dip"
                android:text="A"
                android:textAppearance="?android:attr/textAppearanceSmall"
                android:textColor="@color/radio_colors" />
        </com.buymysari.SegmentedRadioGroup>

        <com.buymysari.SegmentedRadioGroupMale
            android:id="@+id/segment_text_male"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@+id/segment_text"
            android:layout_marginTop="20dip"
            android:checkedButton="@+id/button_one_male"
            android:orientation="horizontal" >

            <RadioButton
                android:id="@id/button_one_male"
                android:layout_margin="15dip"
                android:button="@null"
                android:gravity="center"
                android:minHeight="80dip"
                android:minWidth="80dip"
                android:text="M"
                android:textAppearance="?android:attr/textAppearanceSmall"
                android:textColor="@color/radio_colors" />

            <RadioButton
                android:id="@+id/button_one_female"
                android:layout_margin="15dip"
                android:button="@null"
                android:gravity="center"
                android:minHeight="80dip"
                android:minWidth="80dip"
                android:text="F"
                android:textAppearance="?android:attr/textAppearanceSmall"
                android:textColor="@color/radio_colors" />
        </com.buymysari.SegmentedRadioGroupMale>

        <RelativeLayout
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_below="@+id/segment_text_male"
            android:layout_centerHorizontal="true"
            android:layout_marginTop="20dip" >

            <EditText
                android:id="@+id/edt_text_store_name"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="20dip"
                android:focusable="true"
                android:focusableInTouchMode="true"
                android:cursorVisible="true"
                android:hint="Name" />

            <Button
                android:id="@+id/btn_send_image"
                android:layout_width="80dip"
                android:layout_height="100dip"
                android:layout_below="@+id/edt_text_store_name"
                android:layout_marginTop="20dip"
                android:text="send" />
        </RelativeLayout>
    </RelativeLayout>

</RelativeLayout>

I used Fragment:::

public class SendImageServerFragment extends Fragment {
    SegmentedRadioGroup segmentText;
    SegmentedRadioGroupMale segmentTextMale;
    Button sendImg;
    EditText edt_txt;
    MyApplication app;
    View view;
    Bundle bundle;
    byte[] path;
    String base64string = "";
    Bitmap b;

    public View onCreateView(LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);

        if (android.os.Build.VERSION.SDK_INT > 9) {
            StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder()
                    .permitAll().build();
            StrictMode.setThreadPolicy(policy);
        }

        view = inflater.inflate(R.layout.sendimageserver, null);
        bundle = this.getArguments();
        path = bundle.getByteArray("position");
        segmentText = (SegmentedRadioGroup) view
                .findViewById(R.id.segment_text);
        segmentTextMale = (SegmentedRadioGroupMale) view
                .findViewById(R.id.segment_text_male);
        sendImg = (Button) view.findViewById(R.id.btn_send_image);
        edt_txt = (EditText) view.findViewById(R.id.edt_text_store_name);
        app = (MyApplication) getActivity().getApplicationContext();

        sendImg.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                // TODO Auto-generated method stub

                int segTxt = segmentText.getCheckedRadioButtonId();
                RadioButton radiocatButton = (RadioButton) view
                        .findViewById(segTxt);
                int segmentTextMaleTxt = segmentTextMale
                        .getCheckedRadioButtonId();
                RadioButton radioSexButton = (RadioButton) view
                        .findViewById(segmentTextMaleTxt);

                 b = BitmapFactory.decodeByteArray(path, 0,path.length);
                 base64string = Base64.encodeToString(path, Base64.DEFAULT);
                Log.v("log_tag", "base64string :: "+base64string);

            }
        });

        return view;
    }

}
crickpatel0024
  • 1,999
  • 6
  • 30
  • 47

2 Answers2

1

Check this post. There is an issue apparently, and you need to change your keyboard after onCreateView().

SoftKeyboard does not display for a newly displayed Fragment

Community
  • 1
  • 1
Booger
  • 18,579
  • 7
  • 55
  • 72
0

try this

<EditText
            android:id="@+id/edt_text_store_name"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="20dip"
            android:focusable="true"
            android:focusableInTouchMode="true"
            android:cursorVisible="true"
            android:hint="Name" >
         <requestFocus />
         </EditText>
maddy d
  • 1,530
  • 2
  • 12
  • 23