1. Are you ready for the Galaxy S20? Here is everything we know so far!

app error

Discussion in 'Android Development' started by ionut hanu, Jul 3, 2017.

  1. ionut hanu

    ionut hanu Lurker
    Thread Starter

    hi! I try to make an easy app which display sum of 2 number but when i run the app in the virtual manager i receive this error ( first image) why?

     

    Attached Files:

    • 211.PNG
      211.PNG
      File size:
      85.7 KB
      Views:
      98
    • 2.PNG
      2.PNG
      File size:
      61.3 KB
      Views:
      62
    • 3.PNG
      3.PNG
      File size:
      38.5 KB
      Views:
      80


  2. Best Answer:
    Post #5 by Deleted User, Jul 3, 2017 (3 points)

    1. Download the Forums for Android™ app!


      Download

       
  3. Deleted User

    Deleted User Guest

    Hi. I moved your thread over to the Application Development forum, which is the place to ask questions about app development.
    Please read the following thread, which contains some useful information for beginners, and explains the information needed when asking a question.

    https://androidforums.com/threads/please-read-me-before-posting.987318/

    Please don't use screenshots for code. Instead paste the code text using [code][/code] tags.
    Thanks!
     
    scary alien and mikedt like this.
  4. Deleted User

    Deleted User Guest

    Your layout issues are probably due to all the components being placed at the same location on the screen. Can you post your layout XML?
     
    scary alien likes this.
  5. ionut hanu

    ionut hanu Lurker
    Thread Starter

    Code (Text):
    1.  
    2. <?xml version="1.0" encoding="utf-8"?>
    3. <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    4.     xmlns:app="http://schemas.android.com/apk/res-auto"
    5.     xmlns:tools="http://schemas.android.com/tools"
    6.     android:layout_width="match_parent"
    7.     android:layout_height="match_parent"
    8.     tools:context="com.example.slimjr.proiectf.MainActivity"
    9.     tools:layout_editor_absoluteY="81dp"
    10.     tools:layout_editor_absoluteX="0dp">
    11.  
    12.     <EditText
    13.         android:id="@+id/txt1"
    14.         android:layout_width="wrap_content"
    15.         android:layout_height="wrap_content"
    16.         android:ems="10"
    17.         android:hint="X"
    18.         android:inputType="number"
    19.         app:layout_constraintLeft_toLeftOf="parent"
    20.         app:layout_constraintRight_toRightOf="parent"
    21.         tools:layout_editor_absoluteY="46dp" />
    22.  
    23.     <EditText
    24.         android:id="@+id/txt2"
    25.         android:layout_width="wrap_content"
    26.         android:layout_height="wrap_content"
    27.         android:ems="10"
    28.         android:hint="Y"
    29.         android:inputType="number"
    30.         tools:layout_editor_absoluteX="85dp"
    31.         tools:layout_editor_absoluteY="108dp" />
    32.  
    33.     <Button
    34.         android:id="@+id/button"
    35.         android:layout_width="wrap_content"
    36.         android:layout_height="wrap_content"
    37.         android:eek:nClick="onButtonClick"
    38.         android:text="Suma"
    39.         tools:layout_editor_absoluteX="148dp"
    40.         tools:layout_editor_absoluteY="218dp" />
    41.  
    42.     <TextView
    43.         android:id="@+id/res"
    44.         android:layout_width="75dp"
    45.         android:layout_height="42dp"
    46.         android:text="rezultat"
    47.         tools:layout_editor_absoluteX="154dp"
    48.         tools:layout_editor_absoluteY="168dp" />
    49.  
    50. </android.support.constraint.ConstraintLayout>
    51.  
     
    #4 ionut hanu, Jul 3, 2017
    Last edited by a moderator: Jul 3, 2017
  6. Deleted User

    Deleted User Guest

    You don't need to use the ConstraintLayout. A simple LinearLayout, with vertical orientation would do the job.
    I don't know why some app dev starter tutorials use ConstraintLayout. It's way too complicated for a basic app layout, and just causes confusion for beginners.

    https://developer.android.com/guide/topics/ui/layout/linear.html

    I would save yourself a lot of hassle, and use a LinearLayout.
     
    scary alien likes this.
  7. ionut hanu

    ionut hanu Lurker
    Thread Starter

    scary alien likes this.
  8. Deleted User

    Deleted User Guest

    Fantastic. Well done.
     
    scary alien likes this.
Loading...
Similar Threads - app error
  1. cocotus
    Replies:
    2
    Views:
    493
  2. hstroph
    Replies:
    8
    Views:
    718
  3. Krishnobiswas
    Replies:
    2
    Views:
    420
  4. Thamaraikannan S
    Replies:
    8
    Views:
    558
  5. Gabriel Nandes Lorenzetti
    Replies:
    1
    Views:
    838
  6. Eroot
    Replies:
    14
    Views:
    2,385
  7. kumaranil13k
    Replies:
    10
    Views:
    5,734
  8. kumaranil13k
    Replies:
    2
    Views:
    2,872
  9. curvenger
    Replies:
    3
    Views:
    2,618
  10. corvairbob
    Replies:
    0
    Views:
    507

Share This Page

Loading...