Reputation: 8626
On one fragment I have layout like
question.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TextView
android:id="@+id/question"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="44dp"
android:layout_marginTop="47dp"
android:text="TextView" />
<CheckBox
android:id="@+id/checkBox1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/question"
android:layout_marginLeft="85dp"
android:layout_toRightOf="@+id/question"
android:text="CheckBox" />
<EditText
android:id="@+id/editText1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@+id/question"
android:layout_marginTop="23dp"
android:ems="10"
android:inputType="text" />
</RelativeLayout>
I have an interface like this
But the problem is when I focus on EditText
and try to write something in it, then nothing is happening. No text , no keyboard is showing. If I click and hold on the EditText
then it shows message that nothing to paste. Why the text is not entering in Edit Text?
Here is my code
public class ListFrag extends ListFragment {
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
setListAdapter(new ListFragAdapter(
new MyListData("Software Engineer", "Basit", "4 years"),
new MyListData("Lt. Commander", "Kashif", "12 years"),
new MyListData("Beautiful", "Hafsa", "23 years"),
new MyListData("Electrical Engineer", "Wajahat", "7 years"),
new MyListData("Doctor", "Mehreen", "12 years")));
} //end of onActivityCreated()
@Override
public void onListItemClick(ListView l, View v, int position, long id) {
MyListData listData = (MyListData)getListAdapter().getItem(position);
DetailFrag frag = (DetailFrag) getFragmentManager().findFragmentById(R.id.frag_capt);
if (frag != null && frag.isInLayout()) {
getData(position, listData, frag);
}
} //end of onListItemClick()
private void getData(int position, MyListData listData, DetailFrag frag) {
String artist = listData.artist;
String title = listData.title;
frag.setText(artist, title);
} //end of getData()
} //end of class ListFrag
Here is my Detail Fragment
public class DetailFrag extends Fragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.question , container, false);
return view;
} //end of onCreateView()
public void setText(String artist, String title) {
TextView leftSide_artist = (TextView) getView().findViewById(R.id.question);
leftSide_artist.setText(artist);
} //end of setText()
} //end of class DetailFrag
Thanks
Upvotes: 5
Views: 1881
Reputation: 1075
Another Possibility is that you set the hardwareAccelerated = false in your activity or your application in the AndroidManifest.xml
Upvotes: 1
Reputation: 1206
yup there is a difference , usually it happens in Landscap mode keyboard not pops up in AVD but will work fine on device, how i managed this
Try if it works for you
Upvotes: 0