No me deja abrir el apk que acabo de crear
Publicado por Pablo Layna (2 intervenciones) el 06/12/2015 17:03:52
Hola buenas, que ria que me ayudaseis por que soy nuevo en esto y he estado haciendo una calculadora con ayuda de un tutorial de youtube (https://www.youtube.com/watch?v=-Lt7mj_gDos&list=PLwHp8CeXZIfCJyTWwpz4UUSqm0SVTzgvZ&index=4), el problema que tengo que cuando ya ha generado el apk android studio y la voy a abrir en mi note 4, no me deja abrirla. Hace la accion de abrirla pero seguidamente se cierra, no por que pasa esto o es que he programado algo mal. Ayudarme porfaaaa!!!!
Os dejo el archivo java donde he programado:
Os dejo el archivo java donde he programado:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
package com.example.pablo.calculator3000;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
public class Calculator3000 extends AppCompatActivity {
EditText txtn1, txtn2;
Button btnS, btnR, btnM, btnD;
TextView txtR;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_calculator3000);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
txtn1 = (EditText) findViewById(R.id.txtn1);
txtn2 = (EditText) findViewById(R.id.txtn2);
btnS = (Button) findViewById(R.id.btnSuma);
btnR = (Button) findViewById(R.id.btnResta);
btnM = (Button) findViewById(R.id.btnMulti);
btnD = (Button) findViewById(R.id.btnDiv);
txtR = (EditText) findViewById(R.id.txtRes);
btnS.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
int num1 = Integer.parseInt(txtn1.getText().toString());
int num2 = Integer.parseInt(txtn2.getText().toString());
int s = num1 + num2;
txtR.setText("Resultado: " + s);
}
});
btnR.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
int num1 = Integer.parseInt(txtn1.getText().toString());
int num2 = Integer.parseInt(txtn2.getText().toString());
int s = num1 - num2;
txtR.setText("Resultado: " + s);
}
});
btnM.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
int num1 = Integer.parseInt(txtn1.getText().toString());
int num2 = Integer.parseInt(txtn2.getText().toString());
int s = num1 * num2;
txtR.setText("Resultado: " + s);
}
});
btnD.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
int num1 = Integer.parseInt(txtn1.getText().toString());
int num2 = Integer.parseInt(txtn2.getText().toString());
int s = num1 / num2;
txtR.setText("Resultado: " + s);
}
});
}
}
Valora esta pregunta
0