Código:
package sg.peru.donest; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.app.Activity; import android.content.Intent; import android.content.Context; import android.util.Log; public class LoginActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.login); public boolean isOnline() { Context context = getApplicationContext(); ConnectivityManager connectMgr = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); if (connectMgr != null) { NetworkInfo[] netInfo = connectMgr.getAllNetworkInfo(); if (netInfo != null) { for (NetworkInfo net : netInfo) { if (net.getState() == NetworkInfo.State.CONNECTED) { return true; } } } } else { Log.d("RED", "No se dispone de una coneccion de internet"); } return false; } final EditText Tusuario = (EditText)findViewById(R.id.tusuario); final EditText Tpass = (EditText)findViewById(R.id.tpass); Button Bsesion = (Button)findViewById(R.id.bsesion); Bsesion.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { Intent intent = new Intent(LoginActivity.this, CoordActivity.class); Bundle bundle = new Bundle(); bundle.putString("NOMBRE", Tusuario.getText().toString()); bundle.putString("NOMBRE", Tpass.getText().toString()); intent.putExtras(bundle); startActivity(intent); } }); } }