Wednesday, January 28, 2015

Android applikasi alat pengiraan (calculate) untuk profesional

tel:01115424871
azhar.bin.awang@gmail.com
contact us to build Android app for your needs

download this app
http://goo.gl/02QGSo

This is a template for Professional Calculations app.
Basic calculation only requires input boxes for end users to key in some values, labelled appropriately, and output (result) can be displayed with auto copy to clipboard.

A X [B] = C
A - user key input (number decimals)
[B] is a value that belongs to B when user SELECT


Template :
SPINNER (also known as Drop-down select/menu)
SELECT item by Name/label, obtain value v



Example below:
1.  Construction professional needs to calculate the weight of steel by total length and steel type [Reinforcement]

As the developer, you NEED to create STRINGS and VALUES obtained from engineering tables.

2. Roof surface area = Floor surface area X 1/cos(angle of roof)

public class reinforcement extends Activity implements OnItemSelectedListener, OnClickListener {
 Spinner spinnerOsversions;
 TextView selVersion;
 private String[] steeltype = {"High Tensile - 6mm","High Tensile - 8mm","High Tensile - 10mm","High Tensile - 12mm","High Tensile - 16mm","High Tensile - 20mm","High Tensile - 25mm","High Tensile - 32mm","Mild Tensile - 6mm","Mild Tensile - 8mm","Mild Tensile - 10mm","Mild Tensile - 12mm","Mild Tensile - 16mm"};

 double expchosen, weight, input ;

 int integer1;

 Button result;

 EditText areainput1,weightresultOUTPUT, firstInput, secondInput, factor;

  @Override
 public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.reinforcement);

  Button result = (Button) findViewById(R.id.result);
  result.setOnClickListener(this);

firstInput = (EditText) findViewById(R.id.number1);

  System.out.println(state.length);
  selVersion = (TextView) findViewById(R.id.selVersion);
  spinnerOsversions = (Spinner) findViewById(R.id.osversions);
  ArrayAdapter<String> adapter_state = new ArrayAdapter<String>(this,
    android.R.layout.simple_spinner_item, state);
  adapter_state
    .setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  spinnerOsversions.setAdapter(adapter_state);
  spinnerOsversions.setOnItemSelectedListener(this);

  }

  public void onItemSelected(AdapterView<?> parent, View view, int pos,
   long id) {
  spinnerOsversions.setSelection(pos);
  String selState = (String) spinnerOsversions.getSelectedItem();
  selVersion.setText("Selected conversion:" + selState);

  double input = 3;
  double firstInputValue = 5.1;

  if (pos == 0) {
      // Beginner
      Toast.makeText(parent.getContext(), "0.222", Toast.LENGTH_LONG).show();
      expchosen= new Double("0.222");
  } else if(pos == 1) {
      // Advanced
      Toast.makeText(parent.getContext(), "0.395", Toast.LENGTH_LONG).show();
      expchosen = new Double("0.395");
  } else if(pos == 2) {
 Toast.makeText(parent.getContext(), "0.617", Toast.LENGTH_LONG).show();
      expchosen = new Double("0.617");
  } else if(pos == 3) {
      // Advanced
      Toast.makeText(parent.getContext(), "0.888", Toast.LENGTH_LONG).show();
      expchosen = new Double("0.888");
  } else if(pos == 4) {
      // Advanced
      Toast.makeText(parent.getContext(), "1.579", Toast.LENGTH_LONG).show();
      expchosen = new Double("1.579");
  } else if(pos == 5) {
      // Advanced
      Toast.makeText(parent.getContext(), "2.467", Toast.LENGTH_LONG).show();
      expchosen = new Double("2.467");
  } else if(pos == 6) {
      // Advanced
      Toast.makeText(parent.getContext(), "3.854", Toast.LENGTH_LONG).show();
      expchosen = new Double("3.854");
  } else if(pos == 7) {
      // Advanced
      Toast.makeText(parent.getContext(), "6.315", Toast.LENGTH_LONG).show();
      expchosen = new Double("6.315");
  } else if(pos == 8) {
      // Advanced
      Toast.makeText(parent.getContext(), "0.222", Toast.LENGTH_LONG).show();
      expchosen = new Double("0.222");
  } else if(pos == 9) {
      // Advanced
      Toast.makeText(parent.getContext(), "0.395", Toast.LENGTH_LONG).show();
      expchosen = new Double("0.395");
  } else if(pos == 10) {
      // Advanced
      Toast.makeText(parent.getContext(), "0.617", Toast.LENGTH_LONG).show();
      expchosen = new Double("0.617");
  } else if(pos == 11) {
      // Advanced
      Toast.makeText(parent.getContext(), "0.888", Toast.LENGTH_LONG).show();
      expchosen = new Double("0.888");

  } else {
      // last one 13
      Toast.makeText(parent.getContext(), "1.579", Toast.LENGTH_LONG).show();
      expchosen = new Double("1.579");
  }




 }

  @Override
 public void onNothingSelected(AdapterView<?> arg0) {
  // TODO Auto-generated method stub

  }

@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub

double firstInputValue = Double.parseDouble(firstInput.getText().toString());
   
double outputValue = 0;

outputValue = firstInputValue * expchosen;

String resulting = ""+outputValue;
  final EditText result1 = (EditText) findViewById(R.id.resultvalue);
  result1.setText(resulting);
 
ClipboardManager clip = (ClipboardManager)getSystemService(Context.CLIPBOARD_SERVICE);
  clip.setText(resulting);
 

String factor = ""+expchosen;
final EditText factor1 = (EditText) findViewById(R.id.factor);
factor1.setText(factor);
}




<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:background="#000" >
 
<TextView
        android:text="Calculate Weight (Kilogram) of Reinforcement"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:textSize="12sp" />
     
     
                <EditText
        android:id="@+id/number1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:ems="10"
        android:hint="Enter Length (meter)"
        android:inputType="numberDecimal" />
     
                     <TextView
        android:text="Select type and size"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:textSize="12sp" />
 
        <Spinner
        android:id="@+id/osversions"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="10dp" />

    <TextView
        android:id="@+id/selVersion"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
/>
 

        <EditText
        android:id="@+id/factor"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
/>
             

                        <Button
        android:id="@+id/result"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
     
        android:text="click to multiply Length by Factor to get Weight "
        android:textSize="22sp" />
             
                <EditText
        android:id="@+id/resultvalue"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:ems="10"

        />
                     <TextView
        android:text="Weight (Kilogram)"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:textSize="12sp" />
                   
                               <TextView
     
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
     
        android:text="Result is copied to clipboard "
        android:textSize="10sp" />
</LinearLayout>

   
   


No comments:

Post a Comment