Back to project page Pick-n-Eat-Android.
The source code is released under:
MIT License
If you think the Android project Pick-n-Eat-Android 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.nicolasdu.pick_n_eat; /*from w w w .j a va 2 s . c o m*/ import android.content.Intent; import android.net.Uri; import android.support.v7.app.ActionBarActivity; import android.os.Bundle; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.widget.TextView; public class RestaurantActivity extends ActionBarActivity { Restaurant restaurant; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_restaurant); restaurant = (Restaurant) getIntent().getSerializableExtra("Restaurant"); setViewContents(); } public void setViewContents(){ String displayAddress = ""; TextView title = (TextView)findViewById(R.id.textView2); TextView address = (TextView)findViewById(R.id.textView); TextView phone = (TextView)findViewById(R.id.textView4); title.setText(restaurant.getTitle()); phone.setText(restaurant.getDisplayPhone()); for (int i = 0; i < restaurant.getAddress().size(); i++) { displayAddress += restaurant.getAddress().get(i)+ System.getProperty ("line.separator"); } address.setText(displayAddress); } public void openMapDirections(View view){ Intent intent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse("http://maps.google.com/maps?daddr="+restaurant.getLatitude()+","+restaurant.getLongitude())); startActivity(intent); } public void callRestaurant(View view){ Intent intent = new Intent(Intent.ACTION_DIAL); intent.setData(Uri.parse("tel:"+restaurant.getPhone())); startActivity(intent); } public void openWebsite(View view){ Intent i = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse(restaurant.getWebsite().toString())); startActivity(i); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.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. switch (item.getItemId()) { case R.id.action_settings: Intent intent = new Intent(RestaurantActivity.this, SettingsActivity.class); startActivity(intent); return true; } return super.onOptionsItemSelected(item); } }