0

I have made a simple application which takes two numbers and add them but on button click my app crashes every time. I am new to android, Id really appreciate if someone can help me with this

 `<?xml version="1.0" encoding="utf-8"?> <RelativeLayout android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:tools="http://schemas.android.com/tools"
    android:orientation="vertical"
    xmlns:android="http://schemas.android.com/apk/res/android"
    tools:context=".MapsActivity">
<LinearLayout
    android:id="@+id/linearLayout"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    android:padding="10dp">

    <ImageButton
        android:id="@+id/hospital"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:padding="30dp"
        android:src="@drawable/ic_baseline_local_hospital_24" />

    <ImageButton
        android:id="@+id/store"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:padding="30dp"
        android:src="@drawable/ic_baseline_store_24" />

    <ImageButton
        android:id="@+id/restaurant"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:padding="30dp"
        android:src="@drawable/ic_baseline_restaurant_24" />
</LinearLayout>


<fragment xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:map="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/map"
    android:name="com.google.android.gms.maps.SupportMapFragment"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_below="@+id/linearLayout" />
</RelativeLayout>`

I tried to figure out where these buttons didn't work and crashed but failed.

  • Does this answer your question? [Unfortunately MyApp has stopped. How can I solve this?](https://stackoverflow.com/questions/23353173/unfortunately-myapp-has-stopped-how-can-i-solve-this) – a_local_nobody Mar 28 '22 at 10:26
  • if your app crashes, there's a stack trace. find the stack trace, research it, 99% of the time someone already had a similar problem – a_local_nobody Mar 28 '22 at 10:27

0 Answers0