import android.app.Activity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.content.Intent; import android.view.View; import android.widget.EditText; import android.widget.Button; public class MainActivity extends Activity { private EditText et1; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); et1= (EditText)findViewById(R.id.et1); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.menu_main, menu); return true; } public void ejecutar(View view){ Intent i= new Intent(this, MainActivity2.class); i.putExtra("direc", et1.getText().toString()); startActivity(i); EditView id =et1 Hint = ingrese el sitio web TextView id = tv1 Text =Ingrese el sitio web Button id = Button1
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
@Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.menu_main, menu); return true; }
public void ejecutar(View view){ Intent i= new Intent(this, MainActivity2.class); i.putExtra("direc", et1.getText().toString()); startActivity(i); } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long
EditView id =et1
Hint = ingrese el sitio web
TextView id = tv1
Text =Ingrese el sitio web
Button id = Button1
// as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId();
//noinspection SimplifiableIfStatement if (id == R.id.action_settings) { return true; }
public void finalizar (View view){ finish(); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.menu_main_activity2, menu); return true; }
@Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml.
h
int id = item.getItemId();
//noinspection SimplifiableIfStatement if (id == R.id.action_settings) { return true; }