package com.example.spinner;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.content.Intent;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.ArrayAdapter;
import android.widget.Spinner;
import android.widget.Toast;
import android.widget.Button;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button tombolKeHal2=(Button)findViewById(R.id.buttonDua);
tombolKeHal2.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View arg0){
//Todo Auto-generated method stub
Intent intent=new Intent(arg0.getContext(),MainActivity2.class);
Bundle data=new Bundle();
data.putString("Salam", "Sukses selalu!");
intent.putExtras(data);
startActivityForResult(intent, 1);
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
}
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.content.Intent;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.ArrayAdapter;
import android.widget.Spinner;
import android.widget.Toast;
import android.widget.Button;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button tombolKeHal2=(Button)findViewById(R.id.buttonDua);
tombolKeHal2.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View arg0){
//Todo Auto-generated method stub
Intent intent=new Intent(arg0.getContext(),MainActivity2.class);
Bundle data=new Bundle();
data.putString("Salam", "Sukses selalu!");
intent.putExtras(data);
startActivityForResult(intent, 1);
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
}
0 komentar:
Post a Comment