Я уже пробовал попробовать и поймать. Похоже, что не устанавливает общее значение. Он показывает ошибку:
android .app.IntentReceiverLeaked: Сервис com.google. android .gms.autofill.service.AutofillService произошла утечка IntentReceiver com.google. android. gms.autofill.smsretriever. TracingSmsBroadcastReceiver@ebf8324, который был первоначально зарегистрирован здесь. Вы пропускаете вызов unregisterReceiver ()?
package com.example.myproject1;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.TextView;
public class Bill extends AppCompatActivity {
TextView t,t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17;
Button b,b1;
int i1,i2,i3,i4,i5;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_bill);
t=findViewById(R.id.textView);
t1=findViewById(R.id.textView5);
t2=findViewById(R.id.textView10);
t3=findViewById(R.id.textView15);
t4=findViewById(R.id.textView6);
t5=findViewById(R.id.textView11);
t6=findViewById(R.id.textView16);
t7=findViewById(R.id.textView7);
t8=findViewById(R.id.textView12);
t9=findViewById(R.id.textView17);
t10=findViewById(R.id.textView8);
t11=findViewById(R.id.textView13);
t12=findViewById(R.id.textView18);
t13=findViewById(R.id.textView9);
t14=findViewById(R.id.textView14);
t15=findViewById(R.id.textView19);
t16=findViewById(R.id.textView20);
t17=findViewById(R.id.textView21);
b=findViewById(R.id.button22);
b1=findViewById(R.id.button23);
Intent obj2 = getIntent();
String r = obj2.getStringExtra("k");
t.setText(r);
String res = obj2.getStringExtra("key");
String res1 = obj2.getStringExtra("key2");
String res2 = obj2.getStringExtra("key3");
String res3 = obj2.getStringExtra("key4");
String res4 = obj2.getStringExtra("key5");
String res5 = obj2.getStringExtra("key6");
String res6 = obj2.getStringExtra("key7");
String res7 = obj2.getStringExtra("key8");
String res8 = obj2.getStringExtra("key9");
String res9 = obj2.getStringExtra("key10");
String res10 = obj2.getStringExtra("key11");
String res11 = obj2.getStringExtra("key12");
String res12 = obj2.getStringExtra("key13");
String res13 = obj2.getStringExtra("key14");
String res14 = obj2.getStringExtra("key15");
t1.setText(res);
t2.setText(res1);
t3.setText(res2);
t4.setText(res3);
t5.setText(res4);
t6.setText(res5);
t7.setText(res6);
t8.setText(res7);
t9.setText(res8);
t10.setText(res9);
t11.setText(res10);
t12.setText(res11);
t13.setText(res12);
t14.setText(res13);
t15.setText(res14);
try{
if (res2 != null) {
i1 = Integer.parseInt(res);
}else{
i1 = 0;
}
if (res5 != null) {
i2 = Integer.parseInt(res5);
} else {
i2 = 0;
}
if (res8 != null) {
i3 = Integer.parseInt(res8);
} else {
i3 = 0;
}
if (res11 != null) {
i4 = Integer.parseInt(res11);
} else {
i4 = 0;
}
if (res14 != null) {
i5 = Integer.parseInt(res14);
} else {
i5 = 0;
}
}catch (NumberFormatException e){
}
t16.setText("Total Price:");
int total=i1+i2+i3+i4+i5;
t17.setText(String.valueOf(total));
b.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent obj = new Intent(Bill.this, Menu.class);
startActivity(obj);
}
});
b1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent obj1 = new Intent(Bill.this, MainActivity.class);
startActivity(obj1);
}
});
}
}
Ошибка Logcat
2020-03-05 18:33:48.035 2514-2514/? E/ActivityThread: Service com.google.android.gms.autofill.service.AutofillService has leaked IntentReceiver com.google.android.gms.autofill.smsretriever.TracingSmsBroadcastReceiver@ebf8324 that was originally registered here. Are you missing a call to unregisterReceiver()?
android.app.IntentReceiverLeaked: Service com.google.android.gms.autofill.service.AutofillService has leaked IntentReceiver com.google.android.gms.autofill.smsretriever.TracingSmsBroadcastReceiver@ebf8324 that was originally registered here. Are you missing a call to unregisterReceiver()?
at android.app.LoadedApk$ReceiverDispatcher.<init>(LoadedApk.java:1437)
at android.app.LoadedApk.getReceiverDispatcher(LoadedApk.java:1214)
at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:1486)
at android.app.ContextImpl.registerReceiver(ContextImpl.java:1459)
at android.app.ContextImpl.registerReceiver(ContextImpl.java:1447)
at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:633)
at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:633)
at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:633)
at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:633)
at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:633)
at lmp.<init>(:com.google.android.gms@200414028@20.04.14 (100400-294335909):5)
at llg.<init>(:com.google.android.gms@200414028@20.04.14 (100400-294335909):1)
at kze.a(:com.google.android.gms@200414028@20.04.14 (100400-294335909):10)
at bzmn.a(:com.google.android.gms@200414028@20.04.14 (100400-294335909):5)
at kzm.a(:com.google.android.gms@200414028@20.04.14 (100400-294335909):2)
at bzmn.a(:com.google.android.gms@200414028@20.04.14 (100400-294335909):5)
at kxp.b(:com.google.android.gms@200414028@20.04.14 (100400-294335909):0)
at lhy.onFillRequest(:com.google.android.gms@200414028@20.04.14 (100400-294335909):70)
at android.service.autofill.-$$Lambda$I0gCKFrBTO70VZfSZTq2fj-wyG8.accept(Unknown Source:8)
at com.android.internal.util.function.pooled.PooledLambdaImpl.doInvoke(PooledLambdaImpl.java:287)
at com.android.internal.util.function.pooled.PooledLambdaImpl.invoke(PooledLambdaImpl.java:182)
at com.android.internal.util.function.pooled.OmniFunction.run(OmniFunction.java:77)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:201)
at android.app.ActivityThread.main(ActivityThread.java:6823)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:873)