Back to project page GasTracker.
The source code is released under:
Copyright 2014 kurtzy317
If you think the Android project GasTracker 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.mindalsoblown.gastracker; /*w ww .j a v a 2 s .co m*/ import java.io.FileNotFoundException; import java.text.DecimalFormat; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.TextView; public class FillUpDetail extends Activity { DatabaseConnector connection; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_fill_up_detail); //get ID from intent and find record with that ID Intent intent = getIntent(); try { connection = new DatabaseConnector(openFileInput("ID")); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } Entry entry = connection.GetEntryById(intent.getIntExtra("entryId", 0)); //get text boxes in view detail screen TextView txtGallons = (TextView)findViewById(R.id.txtGallonsDtl); TextView txtCarMPG = (TextView)findViewById(R.id.txtCarDtl); TextView txtCalculatedMPG = (TextView)findViewById(R.id.txtCalculatedDtl); TextView txtAverageMPG = (TextView)findViewById(R.id.txtAverageDtl); TextView txtTrip = (TextView)findViewById(R.id.txtTripDtl); TextView txtOdometer = (TextView)findViewById(R.id.txtOdometerDtl); TextView lblCar = (TextView)findViewById(R.id.lblCarMpgDtl); TextView lblAverage = (TextView)findViewById(R.id.lblAverageMpgDtl); if (!connection.GetUserSetting("CarMPG")) { txtCarMPG.setVisibility(View.GONE); txtAverageMPG.setVisibility(View.GONE); lblAverage.setVisibility(View.GONE); lblCar.setVisibility(View.GONE); } //set values of text boxes DecimalFormat format = new DecimalFormat("0.#"); txtGallons.setText(entry.getGallons().toString()); txtCarMPG.setText(format.format(entry.getCarMPG())); txtCalculatedMPG.setText(format.format(entry.getCalculatedMPG())); txtAverageMPG.setText(format.format(entry.getAverageMPG())); txtTrip.setText(format.format(entry.getTripMiles())); txtOdometer.setText(format.format(entry.getTotalMiles())); } }