Reputation: 89
hello guys seriously am new to android and please i would like you to help me with this code...to edit it
public class LoginFragment extends Fragment implements OnClickListener {
private EditText login, password, domain;
private ImageView apply;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.setup_generic_login, container, false);
login = (EditText) view.findViewById(R.id.setup_username);
password = (EditText) view.findViewById(R.id.setup_password);
domain = (EditText) view.findViewById(R.id.setup_domain);
apply = (ImageView) view.findViewById(R.id.setup_apply);
apply.setOnClickListener(this);
return view;
}
@Override
public void onClick(View v) {
int id = v.getId();
if (id == R.id.setup_apply) {
if (login.getText() == null || login.length() == 0 || password.getText() == null || password.length() == 0 || domain.getText() == null || domain.length() == 0) {
Toast.makeText(getActivity(), getString(R.string.first_launch_no_login_password), Toast.LENGTH_LONG).show();
return;
}
SetupActivity.instance().genericLogIn(login.getText().toString(), password.getText().toString(), domain.getText().toString());
}
}}
i'd like to assign domain a default string, (like domain = "pearlcom.au.ug") i've edited the xml file and removed the EditText field
please don't close my post.......just ignore! thanks for those who are goin to help me!
Upvotes: 0
Views: 79
Reputation: 1242
you can just do:
android:text="@string/domain" and assign whatever domain string you choose in the strings.xml and you would have that as default.
-> If you want a placeholder displayed, please include
android:hint="@string/enter_domain"
Upvotes: 1