I'm developing an app where it will have the first Activity
fault, and I want to show it only once, only when the app is first opened.
In this case, I created a Activity
by calling a layout where it contains the textview and button , as soon as the user clicks the button, it will open Activity
main of the app, and then I do not want the Activity
of greeting to be shown anymore.
My layout (short):
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Saudação Aqui" />
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="sendMessage"
android:text="Ok, entrar para Activity principal e não mostrar mais essa tela" />
Greeting activity:
Button button;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
button=(Button)findViewById(R.id.button1);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Intent i = new Intent(getApplicationContext(),Activity Principal.class);
startActivity(i);
}
});
}
Thank you!