Is there any way to get this thing done. I'm getting input from another activity to create dynamic editText to get input.
public class GetNames extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.names);
LinearLayout ll = findViewById(R.id.lin);
Bundle bundle = getIntent().getExtras();
String entered_no = bundle.getString("no_of_persons");
for (int i = 0; i < (Integer.valueOf(entered_no)); i++) {
EditText editText = new EditText(GetNames.this);
editText.setId(editText.generateViewId());
ll.addView(editText,0);
editText.setHint(i);
}
}
}
Is there any way to resolve this.
Her is my XML file
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="wrap_content"
android:id="@+id/lin"
android:layout_height="wrap_content"
android:orientation="vertical"></LinearLayout>
Here are error messages
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.abhishakkrmalviya.perfecthalf/com.abhishakkrmalviya.perfecthalf.GetNames}: android.content.res.Resources$NotFoundException: String resource ID #0x0