Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <LinearLayout
- android:id="@+id/layout_add"
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="horizontal">
- <EditText
- android:id="@+id/editTextWeightValue"
- android:layout_width="0dp"
- android:layout_height="32dp"
- android:drawableRight="@drawable/down"
- android:background="@drawable/background_edit_text"
- android:clickable="true"
- android:layout_marginLeft="22dp"
- android:layout_marginRight="10dp"
- android:inputType="number"
- android:layout_weight="1"/>
- </LinearLayout>
- <?xml version="1.0" encoding="utf-8"?>
- <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_height="match_parent"
- android:layout_width="match_parent"
- xmlns:app="http://schemas.android.com/apk/res-auto">
- <RelativeLayout
- android:id="@+id/rlForAdd"
- android:layout_width="match_parent"
- android:layout_height="wrap_content">
- </RelativeLayout>
- </ScrollView>
- @Override
- public void onClick(View view) {
- LinearLayout linearLayout = new LinearLayout(getApplicationContext());
- linearLayout = findViewById(R.id.layout_add);
- RelativeLayout relativeLayout = findViewById(R.id.rlForAdd);
- switch (view.getId()) {
- case R.id.btnAdd:
- imageViewRemove.setVisibility(View.VISIBLE);
- linearLayoutList.add(linearLayout);
- relativeLayout.addView(linearLayoutList.get(COUNT));//добавляем новый лл из списка
- COUNT++;
- break;
- E/AndroidRuntime: FATAL EXCEPTION: main
- Process: ru.involta.cooklook, PID: 2102
- java.lang.IllegalArgumentException: Cannot add a null child view to a ViewGroup
- at android.view.ViewGroup.addView(ViewGroup.java:3718)
- at android.view.ViewGroup.addView(ViewGroup.java:3700)
- at com.example.a123.project_of_recepts.AddReceipt.onClick(AddReceipt.java:329)
- at android.view.View.performClick(View.java:4780)
- at android.view.View$PerformClick.run(View.java:19866)
- at android.os.Handler.handleCallback(Handler.java:739)
- at android.os.Handler.dispatchMessage(Handler.java:95)
- at android.os.Looper.loop(Looper.java:135)
- at android.app.ActivityThread.main(ActivityThread.java:5254)
- at java.lang.reflect.Method.invoke(Native Method)
- at java.lang.reflect.Method.invoke(Method.java:372)
- at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
- at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
- I/Process: Sending signal. PID: 2102 SIG: 9
Add Comment
Please, Sign In to add comment