Asil_
Asistan
- Katılım
- 25 Ağustos 2012
- Mesajlar
- 111
- Reaksiyon puanı
- 0
- Puanları
- 16
Atıyorum 5 activity sonunda bizim belirlediğimiz bir activity ekranını nasıl getirebilirim.:confused1:
5. Activity sonuna Intent ile belirlediğin activity'i ekleSenaryonu tam anlatırsan daha iyi anlatırım
![]()
[COLOR=#000000]
[/COLOR][COLOR=#000088]public[/COLOR][COLOR=#000088]void[/COLOR][COLOR=#000000] startActivityFromIntent[/COLOR][COLOR=#666600]([/COLOR][COLOR=#660066]View[/COLOR][COLOR=#000000] view[/COLOR][COLOR=#666600])[/COLOR][COLOR=#666600]{[/COLOR][COLOR=#000000]
[/COLOR][COLOR=#660066]Intent[/COLOR][COLOR=#000000] intent [/COLOR][COLOR=#666600]=[/COLOR][COLOR=#000088]new[/COLOR][COLOR=#660066]Intent[/COLOR][COLOR=#666600]([/COLOR][COLOR=#000088]this[/COLOR][COLOR=#666600],[/COLOR][COLOR=#660066]DisplayMessageActivity[/COLOR][COLOR=#666600].[/COLOR][COLOR=#000088]class[/COLOR][COLOR=#666600]);[/COLOR][COLOR=#000000]
[/COLOR][COLOR=#660066]EditText[/COLOR][COLOR=#000000] editText [/COLOR][COLOR=#666600]=[/COLOR][COLOR=#666600]([/COLOR][COLOR=#660066]EditText[/COLOR][COLOR=#666600])[/COLOR][COLOR=#000000] findViewById[/COLOR][COLOR=#666600]([/COLOR][COLOR=#000000]R[/COLOR][COLOR=#666600].[/COLOR][COLOR=#000000]id[/COLOR][COLOR=#666600].[/COLOR][COLOR=#000000]edit_message[/COLOR][COLOR=#666600]);[/COLOR][COLOR=#000000]
[/COLOR][COLOR=#660066]String[/COLOR][COLOR=#000000] message [/COLOR][COLOR=#666600]=[/COLOR][COLOR=#000000] editText[/COLOR][COLOR=#666600].[/COLOR][COLOR=#000000]getText[/COLOR][COLOR=#666600]().[/COLOR][COLOR=#000000]toString[/COLOR][COLOR=#666600]();[/COLOR][COLOR=#000000]
intent[/COLOR][COLOR=#666600].[/COLOR][COLOR=#000000]putExtra[/COLOR][COLOR=#666600]([/COLOR][COLOR=#000000]EXTRA_MESSAGE[/COLOR][COLOR=#666600],[/COLOR][COLOR=#000000] message[/COLOR][COLOR=#666600]);[/COLOR][COLOR=#000000]
startActivity[/COLOR][COLOR=#666600]([/COLOR][COLOR=#000000]intent[/COLOR][COLOR=#666600]);[/COLOR][COLOR=#000000]
[/COLOR][COLOR=#666600]}
[/COLOR]
[COLOR=#660066]Intent[/COLOR][COLOR=#000000] intent [/COLOR][COLOR=#666600]=[/COLOR][COLOR=#000000] getIntent[/COLOR][COLOR=#666600]();[/COLOR][COLOR=#000000]
[/COLOR][COLOR=#660066]String[/COLOR][COLOR=#000000] message [/COLOR][COLOR=#666600]=[/COLOR][COLOR=#000000] intent[/COLOR][COLOR=#666600].[/COLOR][COLOR=#000000]getStringExtra[/COLOR][COLOR=#666600]([/COLOR][COLOR=#660066]MainActivity[/COLOR][COLOR=#666600].[/COLOR][COLOR=#000000]EXTRA_MESSAGE[/COLOR][COLOR=#666600]);[/COLOR]
static int i = 0;
@override public void onClick(View view) {
i++;
if (i == 5) {
i = 0;
Intent myIntent = new Intent(activity, LoginActivity.class);
activity.startActivity(myIntent);
}
}
public void onClick(View v) {
String username = Username.getText().toString();
String password = Password.getText().toString();
if(username.equals("guest") && password.equals("guest")){
lResult.setText("Login successful.");
} else {
lResult.setText("Login failed");
}
}