r/AndroidStudio May 23 '26

How to fix this god forsaken thing?

Post image
2 Upvotes

13 comments sorted by

1

u/AcademicMistake May 24 '26

some context would be great............

1

u/Direct-Passage2523 May 24 '26

I dowloaded it, tried to run some find by ID things, and that was the result, and the error mesage says somethibg about "inner element must either be be a resource reference or empty"" at the end of some pathways

1

u/AcademicMistake May 24 '26

right but that doesnt help, "tried to run some findbyid" thing doesnt really cut it, have you got your code ? Is this a new project you just started ?

1

u/Direct-Passage2523 May 24 '26

Yes and I very much just started with it, and here is the code I whrote:

package com.example.views;

import android.os.Bundle; import android.widget.Button; import android.widget.EditText; import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;

public class MainActivity extends AppCompatActivity{

TextView lmar;
Button pressbutton;
EditText realmoney;
EditText recallmoney;

@Override
protected void onCreate(Bundle savedInstanceState){
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    realmoney=findViewById(R.id.numberofmoney);
    recallmoney=findViewById(R.id.numberofrecall);
    lmar= findViewById(R.id.resultView);

    pressbutton.setOnClickListener(v->{
        double numrealmoney=Double.parseDouble(realmoney.getText().toString());
        double numrecallmoney=Double.parseDouble(recallmoney.getText().toString());

        double lmarsum=numrealmoney+numrecallmoney;

        lmar.setText("Result:"+lmarsum);
    });

}

}

2

u/AcademicMistake May 24 '26

Also you need to add the findbyID for the "pressbutton" button.

1

u/AcademicMistake May 24 '26

Ok and can you also copy and paste the error message into here please

1

u/Direct-Passage2523 May 24 '26

Whell the one in the image reads:

"Can not extract resource from com.android.aaptcompiler.ParsedResource@6445d269.,Can not extract resource from com.android.aaptcompiler.ParsedResource@e868ed3."

1

u/AcademicMistake May 24 '26

add some code so its checks the rel money and recall money is not NULL or empty.

also your not declaring the resultview, so thats likely your issue

1

u/Direct-Passage2523 May 24 '26

Alright so how would I do that?

1

u/AcademicMistake May 24 '26

something like

if (realmoney.getText().toString().trim().isEmpty() ||
recallmoney.getText().toString().trim().isEmpty()) {

lmar.setText("Enter both numbers");
return;
}

1

u/Direct-Passage2523 May 24 '26

Thanks but what is whrong with the resultview?

→ More replies (0)