Calculator
- By user2times4
- Android Development
- 0 Replies
I know it's simple but I am probably over complicating this 
I want to make a calculator with 3 fields required to get the result.
Example:
Field 1: (2)
Field 2: (4)
Field 3: (2)
Result: 4
Explanation:
Calculator takes what ever is entered in Field 1 AND multiplies it with Field 2, Example: (2*4=8)
Than the calculator takes the RESULT of Field 1 and Field 2 AND divides it with what ever is inserted in Field 3, Example: (8/2=4)
In short: 2*4=8/2=4.
Your help would be much appreciated.
So far I have this and I only have the first 2 fields working:
public class MainActivity extends AppCompatActivity {
private EditText etn1;
private EditText etn2;
private TextView appview;
@override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
etn1 = (EditText) findViewById(R.id.etn1);
etn2 = (EditText) findViewById(R.id.etn2);
appview = (TextView) findViewById(R.id.appview);
}
public void btnshoot(View view) {
int n1 = Integer.parseInt(etn1.getText().toString());
int n2 = Integer.parseInt(etn2.getText().toString());
int sum = n1 * n2;
appview.setText(String.valueOf(sum));

I want to make a calculator with 3 fields required to get the result.
Example:
Field 1: (2)
Field 2: (4)
Field 3: (2)
Result: 4
Explanation:
Calculator takes what ever is entered in Field 1 AND multiplies it with Field 2, Example: (2*4=8)
Than the calculator takes the RESULT of Field 1 and Field 2 AND divides it with what ever is inserted in Field 3, Example: (8/2=4)
In short: 2*4=8/2=4.
Your help would be much appreciated.
So far I have this and I only have the first 2 fields working:
public class MainActivity extends AppCompatActivity {
private EditText etn1;
private EditText etn2;
private TextView appview;
@override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
etn1 = (EditText) findViewById(R.id.etn1);
etn2 = (EditText) findViewById(R.id.etn2);
appview = (TextView) findViewById(R.id.appview);
}
public void btnshoot(View view) {
int n1 = Integer.parseInt(etn1.getText().toString());
int n2 = Integer.parseInt(etn2.getText().toString());
int sum = n1 * n2;
appview.setText(String.valueOf(sum));

I've made another attempt to develop & release Android app because I'm curious if it's still possible to hit the jackpot and get piece of cake from the market. I can tell this is tough, as Google Play Store is flooded with apps and it's difficult to get organic downloads. What's your experience guys? Is there some trick that works for you to get more traffic?