Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- final RelativeLayout layout = (RelativeLayout) findViewById(R.id.ataque);
- mas.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- EditText extra = new EditText(getApplicationContext());
- int ntext = mispreferencias.getInt("contadortext", 0);
- RelativeLayout.LayoutParams p = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
- extra.setId(ntext);
- final int id_ = extra.getId();
- extra.setLayoutParams(p);
- editor.putInt("extra" + ntext, id_);
- editor.putInt("contadortext", ntext + 1);
- editor.commit();
- layout.addView(extra);
- }
- });
- int ntext = mispreferencias.getInt("contadortext", 0);
- for (int i = 0; i < ntext; i++) {
- int ide = mispreferencias.getInt("extra" + i, 0);
- EditText edi = (EditText) findViewById(ide);
- editor.putString("text" + i, edi.getText().toString());
- }
- java.lang.NullPointerException: Attempt to invoke virtual method 'android.text.Editable android.widget.EditText.getText()' on a null object reference
Add Comment
Please, Sign In to add comment