Question One List any two features that make mobile devices important in our dai
ID: 3841815 • Letter: Q
Question
Question One
List any two features that make mobile devices important in our daily life? Notes: 1. Only list each feature within one line, no need to discuss or explain. 2. The question related to mobile device AND not mobile application.
Quation two
Question Three Suppose you are designing a login activity for your app. The app has two activity (LoginActiviy, NewActivity). Write only the Java Code here for LoginActivity. The login activity is show in the following figure:
ords: 36/279 English (US k me anything outcomes) Question Four uppose you are designing alogin activity for your app. The app has two Instructors State ctivity (LoginActiviy, NewActivity). Write only the Java Code here for the Learning Outcome(s) that LoginActivity. The login activity is show in the following figure match this question 6:0 it448testlapp Name Attempts Left 08:14 3/10/2017Explanation / Answer
Here are the solutions of your given questions please go through it.
Soution 1:- Two features that make mobile devices important in our daily life are
Solution 2:- Here is the java code for Login Activity where users have only 3 attempts to login and and if he failed also in thied times then we don't allow him to pressing again login button.
public class MainActivity extends ActionBarActivity {
//Here we intializing all the required layout elements
private EditText username;
private EditText password;
private Button login;
private TextView loginLockedTV;
private TextView attemptsLeftTV;
private TextView numberOfRemainingLoginAttemptsTV;
int numberOfRemainingLoginAttempts = 3;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
setupVariables();
}
/* When login button is pressed, authenticateLogin is called
If credentials are correct user is greeted,
but if credentials are wrong, we inform the user by switching the remaing attempts text view to "visible", but if he tried to login in third time, we have to prevent him from pressing again the login button
*/
public void authenticateLogin(View view) {
if (username.getText().toString().equals("admin") &&
password.getText().toString().equals("admin")) {
Toast.makeText(getApplicationContext(), "Hello admin!",
Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(getApplicationContext(), "Seems like you 're not admin!",
Toast.LENGTH_SHORT).show();
numberOfRemainingLoginAttempts--;
attemptsLeftTV.setVisibility(View.VISIBLE);
numberOfRemainingLoginAttemptsTV.setVisibility(View.VISIBLE);
numberOfRemainingLoginAttemptsTV.setText(Integer.toString(numberOfRemainingLoginAttempts));
if (numberOfRemainingLoginAttempts == 0) {
login.setEnabled(false);
loginLockedTV.setVisibility(View.VISIBLE);
loginLockedTV.setBackgroundColor(Color.RED);
loginLockedTV.setText("LOGIN LOCKED!!!");
}
}
}
private void setupVariables() {
username = (EditText) findViewById(R.id.usernameET);
password = (EditText) findViewById(R.id.passwordET);
login = (Button) findViewById(R.id.loginBtn);
loginLockedTV = (TextView) findViewById(R.id.loginLockedTV);
attemptsLeftTV = (TextView) findViewById(R.id.attemptsLeftTV);
numberOfRemainingLoginAttemptsTV = (TextView) findViewById(R.id.numberOfRemainingLoginAttemptsTV);
numberOfRemainingLoginAttemptsTV.setText(Integer.toString(numberOfRemainingLoginAttempts));
}
}
Please go through it throughly this code and try to understans this.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.