Jump to content

Recommended Posts

Posted

Queres dizer entre activities, certo? Com Bundles:

http://developer.android.com/reference/android/os/Bundle.html

Espreita o Activity Lifecycle na documentação da Activity:

http://developer.android.com/reference/android/app/Activity.html

“There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult.”

-- Tony Hoare

Posted

Estou a utilizar este tutorial : http://www.portalandroid.org/comunidade/viewtopic.php?f=7&t=16945&hilit=singleton

Com uma variável estática consigo passar os valores, mas se na tela 2 escrever algo numa caixa de texto, ao chama-la na tela 1 não vai buscar o valor da mesma.

Na tela 1 estou a usar este código:

			 MySingleton mDados = MySingleton.getInstance ();
			 String s = mDados.getMyString();
			 mensagemExibir("",""+s);

E na tela 2 este:

	 MySingleton mDados = MySingleton.getInstance ();
	 String s = etLarU.getText().toString();
	 mDados.setMyString(s);

Resolvido :

etLarU.setonclickListener(new View.onclickListener() {
public void onclick(View v) {
 // TODO Auto-generated method stub
 MySingleton mDados = MySingleton.getInstance ();
	 String s = etLarU.getText().toString();
	 mDados.setMyString(s);
}
});

Estranha forma de vida que tem a capacidade de transformar comandos em mensagens de erro.

ndsotware.org

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.