Advertisement
Guest User

Untitled

a guest
Apr 18th, 2014
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.92 KB | None | 0 0
  1. public class TestActivity extends Activity {
  2.  
  3. public int i;
  4.  
  5. @Override
  6. protected void onCreate(Bundle savedInstanceState) {
  7. super.onCreate(savedInstanceState);
  8. setContentView(R.layout.activity_test);
  9.  
  10. final TextView testQuest = (TextView) findViewById(R.id.questView);
  11. final TextView testNum = (TextView) findViewById(R.id.numbs);
  12. Button getNext = (Button) findViewById(R.id.btnNext);
  13.  
  14. final String[] quesNums = { "Question 1", "Question 2", "Question 3",
  15. "Question 4", "Question 5", "Question 6", "Question 7",
  16. "Question 8", "Question 9", "Question 10", "Question 11",
  17. "Question 12", "Question 13", "Question 14", "Question 15",
  18. "Question 16", "Question 17", "Question 18", "Question 19",
  19. "Question 20", "Question 21", "Question 22", "Question 23",
  20. "Question 24", "Question 25", "Question 26", "Question 27",
  21. "Question 28", "Question 29", "Question 30", "Question 31",
  22. "Question 32", "Question 33" };
  23.  
  24. final String[] questions = {
  25. "I have enough information about the organisation/work area to prepare for my placement.",
  26. "I am clear about what I need to be able to do to be successful in this role.",
  27. "I am clear about the skills and qualities I can offer this organisation/work area.",
  28. "I have a realistic plan to manage financially.",
  29. "I have a realistic plan to travel to and from the organisation/work area.",
  30. "I have set realistic goals for myself to prepare for this experience.",
  31. "I have realistic plan to manage my personal commitments.",
  32. "My commitments to caring for others (E.g. children, parents) will not be affected by this placement.",
  33. "Managing my personal needs (E.g. relating to my health, personal experiences, impairment or disability) so they do not have a negative effect on this placement",
  34. "Overall, I am confident about my preparation for this experience.",
  35. "Working on specific days/dates that are important to you e.g. Christmas Day, Eid, Diwali.",
  36. "Being available for the working patterns of your placement.",
  37. "Being flexible about your personal commitments or needs",
  38. "Taking regular breaks during the day for your personal commitments or needs.",
  39. "Feeling comfortable about discussing your personal commitments or needs with your supervisor on the placement.",
  40. "Using negotiating skills with confidence on your placement.",
  41. "Assessing the feasibility of asking for time off/alternative working arrangements on your placement. As opposed to during a permanent work contract.",
  42. "Discussing any problems around managing this placement successfully with your academic supervisor.",
  43. "Getting to your placement.",
  44. "Getting to your placement on time.",
  45. "Getting around the location.",
  46. "Keeping up with the expected pace of work.",
  47. "Keeping up with paperwork.", "Achieving your outcomes/goals.",
  48. "Coping with deadlines.", "Coping with stress.",
  49. "Coping with personal emergencies.",
  50. "Working with others or in a team.",
  51. "Working with people you don't know.",
  52. "Working with people who are different from you.",
  53. "Following instructions.",
  54. "Using your initiative/ work independently.",
  55. "Managing the hours and schedule of work." };
  56.  
  57. i = 0;
  58.  
  59. getNext.setOnClickListener(new View.OnClickListener() {
  60.  
  61. @Override
  62. public void onClick(View v) {
  63.  
  64. try {
  65.  
  66. if (i <= quesNums.length) {
  67. testNum.setText(quesNums[i]);
  68. testQuest.setText(questions[i]);
  69. i = i + 1;
  70. }
  71. else if (i > quesNums.length){
  72. testNum.setText("End of questions");
  73. testQuest.setText("All done");
  74. }
  75. } finally {
  76. if (i > 33){
  77. testNum.setText(i);
  78. testQuest.setText(i);
  79. }
  80. }
  81. }
  82.  
  83. });
  84. }
  85.  
  86. }
  87.  
  88. 04-14 03:05:33.250: E/AndroidRuntime(1567): java.lang.ArrayIndexOutOfBoundsException: length=33; index=33
  89. 04-14 03:05:33.250: E/AndroidRuntime(1567): at hhs.huddersfield.ppa.TestActivity$1.onClick(TestActivity.java:76)
  90. 04-14 03:05:33.250: E/AndroidRuntime(1567): at android.view.View.performClick(View.java:4091)
  91. 04-14 03:05:33.250: E/AndroidRuntime(1567): at android.view.View$PerformClick.run(View.java:17036)
  92. 04-14 03:05:33.250: E/AndroidRuntime(1567): at android.os.Handler.handleCallback(Handler.java:615)
  93. 04-14 03:05:33.250: E/AndroidRuntime(1567): at android.os.Handler.dispatchMessage(Handler.java:92)
  94. 04-14 03:05:33.250: E/AndroidRuntime(1567): at android.os.Looper.loop(Looper.java:137)
  95. 04-14 03:05:33.250: E/AndroidRuntime(1567): at android.app.ActivityThread.main(ActivityThread.java:5031)
  96. 04-14 03:05:33.250: E/AndroidRuntime(1567): at java.lang.reflect.Method.invokeNative(Native Method)
  97. 04-14 03:05:33.250: E/AndroidRuntime(1567): at java.lang.reflect.Method.invoke(Method.java:511)
  98. 04-14 03:05:33.250: E/AndroidRuntime(1567): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:792)
  99. 04-14 03:05:33.250: E/AndroidRuntime(1567): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:555)
  100. 04-14 03:05:33.250: E/AndroidRuntime(1567): at dalvik.system.NativeStart.main(Native Method)
  101. 04-14 03:05:35.450: E/Trace(1814): error opening trace file: No such file or directory (2)
  102.  
  103. if (i <= quesNums.length) {
  104. testNum.setText(quesNums[i]);
  105. testQuest.setText(questions[i]);
  106. i = i + 1;
  107. }
  108.  
  109. if (i < quesNums.length) {
  110. testNum.setText(quesNums[i]);
  111. testQuest.setText(questions[i]);
  112. i = i + 1;
  113. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement