Back to project page CoHomeAndroid.
The source code is released under:
Apache License
If you think the Android project CoHomeAndroid listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.cohome.android; //ww w. ja v a 2 s .co m import com.example.androidspike.R; import android.app.Activity; import android.app.ActionBar; import android.app.Fragment; import android.content.Intent; import android.os.Bundle; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.os.Build; public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Button btnHome = (Button) findViewById(R.id.button1); btnHome.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent openPage1 = new Intent(MainActivity.this,SearchAd.class); startActivity(openPage1); } }); Button btnGPS = (Button) findViewById(R.id.button2); btnGPS.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent openPage2 = new Intent(MainActivity.this,ActivityGPS.class); startActivity(openPage2); } }); } @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; } @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. int id = item.getItemId(); if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } }