Android Open Source - presence-calling-android Login Activity






From Project

Back to project page presence-calling-android.

License

The source code is released under:

MIT License

If you think the Android project presence-calling-android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.sinch.userpresencecalling;
/*from ww  w  . j  ava  2 s .c o m*/
import android.content.Intent;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.Toast;

public class LoginActivity extends ActionBarActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_login);

        findViewById(R.id.loginButton).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                String username = ((EditText) findViewById(R.id.usernameEditText)).getText().toString();
                if (username.length() == 0) {
                    Toast.makeText(getApplicationContext(), "Enter a username.", Toast.LENGTH_SHORT);
                } else {
                    Intent intent = new Intent(getApplicationContext(), MainActivity.class);
                    intent.putExtra("username", username);
                    startActivity(intent);
                }
            }
        });
    }

}




Java Source Code List

com.sinch.userpresencecalling.ApplicationTest.java
com.sinch.userpresencecalling.LoginActivity.java
com.sinch.userpresencecalling.MainActivity.java