Advertisement
MDRams

Untitled

Nov 9th, 2015
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.95 KB | None | 0 0
  1. As you can see I am composing an arraylist based on which checkboxes are flagged. If I check Checkbox1 it adds the String "newString".
  2. Then, I convert the ArrayList to a String ("X").
  3. Lastly, I create the finish method and set "result" as the string X.
  4.  
  5. Still I get the error from:
  6. -String X = builder.toString().replace("[", "").replace("]", ""); -builder(the Arraylist) is highlighted
  7. -returnIntent.putExtra("result", String.X); -"X" comes as an error-
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17. public class Popup1 extends Activity {
  18.  
  19. private TextView textViewResult;
  20.  
  21. public String newString;
  22.  
  23. public String bestemmia;
  24.  
  25.  
  26.  
  27. @Override
  28. protected void onCreate(Bundle savedInstanceState) {
  29. super.onCreate(savedInstanceState);
  30. setContentView(R.layout.popup3);
  31.  
  32. textViewResult = (TextView) findViewById(R.id.textViewResult);
  33.  
  34. final ArrayList<String> builder = new ArrayList<String>();
  35.  
  36. final CheckBox checkBox1 = (CheckBox) findViewById(R.id.checkBox);
  37. checkBox1.setChecked(false);
  38.  
  39. (...........)
  40. if (checkBox1.isChecked()) {
  41. builder.add((String.valueOf(newString)));
  42. builder.add("\n");
  43. } else {
  44. builder.remove(String.valueOf(newString));
  45. builder.remove("\n");
  46. }
  47. }
  48. });
  49.  
  50. getData();
  51. }
  52.  
  53.  
  54. private void getData() {
  55. (..............)codingcoding
  56. }
  57.  
  58. (coding)
  59. String newString= (String)(.................).toString();
  60. (..............)
  61.  
  62. }
  63.  
  64. String X = builder.toString().replace("[", "").replace("]", "");
  65.  
  66. @Override
  67. public void finish() {
  68.  
  69. // Prepare data intent
  70. Intent returnIntent = new Intent();
  71. returnIntent.putExtra("result", String.X);
  72. setResult(Activity.RESULT_OK, returnIntent);
  73. super.finish();
  74. }
  75.  
  76. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement