When I pressed edit text it pressed but when I want to write something it can't work and cursore goes to tab .
public class MainActivity extends SherlockFragment { private EditText e1,e2; public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // TODO Auto-generated method stub View v = inflater.inflate(R.layout.login, container, false); return v; } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);
//getActivity().setContentView(R.layout.login);
}
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
e1=(EditText) getActivity().findViewById(R.id.editText1);
e2=(EditText) getActivity().findViewById(R.id.editText2);
String name=e1.getText().toString();
String password=e2.getText().toString();
Button b1=(Button) getActivity().findViewById(R.id.button1);
b1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent i =new Intent(getActivity(),Checkboxclass.class);
startActivity(i);
}
});
}
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getActivity().getMenuInflater().inflate(R.menu.main, menu);
return true;
}
XML file is :
<EditText
android:id="@+id/editText1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="128dp"
android:cursorVisible="true"
android:ems="10"
android:inputType="textPersonName" />
<EditText
android:id="@+id/editText2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/editText1"
android:layout_centerHorizontal="true"
android:layout_marginTop="97dp"
android:ems="10"
android:inputType="textPassword" >
</EditText>
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:text="Button" />
No comments:
Post a Comment