Android Open Source - simple-restaurant Restaurant Detail Activity






From Project

Back to project page simple-restaurant.

License

The source code is released under:

GNU General Public License

If you think the Android project simple-restaurant listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package pad.practica1.restaurante;
//from   w  w w  .  j  a v  a 2s .  co  m
import pad.practica1.restaurante.restaurant.Restaurant;
import android.app.Activity;
import android.os.Bundle;
import android.widget.ImageView;
import android.widget.TextView;

public class RestaurantDetailActivity extends Activity {
  private TextView foodType;
  private TextView address;
  private TextView coussine;
  private TextView country;
  private TextView name;
  private TextView price;
  private TextView town;
  private ImageView image;
  
  private Restaurant fetchCurrentRestaurant() {
    RestaurantApplication app = (RestaurantApplication) getApplication();
    return app.getCurrentRestaurant();
  }
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    
    setContentView(R.layout.restaurant_detail);
    
    foodType = (TextView) findViewById(R.id.detailFoodType);
    address = (TextView) findViewById(R.id.detailAddr);
    coussine = (TextView) findViewById(R.id.detailCoussine);
    country = (TextView) findViewById(R.id.detailCountry);
    name = (TextView) findViewById(R.id.detailName);
    price = (TextView) findViewById(R.id.detailPrice);
    town = (TextView) findViewById(R.id.detailTown);
    image = (ImageView) findViewById(R.id.detailImage);
  }
  
  @Override
  protected void onResume() {
    super.onResume();
    
    setCurrentRestaurant();
  }

  private void setCurrentRestaurant() {
    Restaurant current = fetchCurrentRestaurant();
    
    foodType.setText(current.getFoodType());
    address.setText(current.getFullAddress());
    coussine.setText(current.getCoussine());
    country.setText(current.getCountry());
    name.setText(current.getName());
    price.setText(Double.toString(current.getPrice()));
    town.setText(current.getTown());
  };
}




Java Source Code List

pad.practica1.restaurante.MainActivity.java
pad.practica1.restaurante.RestaurantApplication.java
pad.practica1.restaurante.RestaurantDetailActivity.java
pad.practica1.restaurante.ResultsActivity.java
pad.practica1.restaurante.database.DBHelper.java
pad.practica1.restaurante.restaurant.RestaurantFetcher.java
pad.practica1.restaurante.restaurant.RestaurantSQLiteFetcher.java
pad.practica1.restaurante.restaurant.RestaurantXMLFetcher.java
pad.practica1.restaurante.restaurant.Restaurant.java