Topic Text   Topic Comments (1)   Topic Properties   Topic Information kevinthesunwy@gma...
Topic title: TestInClass Saturday April 23, 2016 00:32:00

Download topic text | View in monospace font | Tab width set to 8 (change to 4)

Files in topic:  
[Jump to] MainActivity_new.java   {+8,-12}

[Add General Comment] to topic.

File MainActivity_new.java (Revision 0.1) [Add File Comment] [Top]
 
Line 39 Line 39
39 39
40 public class MainActivity extends AppCompatActivity { 40 public class MainActivity extends AppCompatActivity {
41 41
42 int a = 0, b = 1;
42 //Button and text field elements 43 //Button and text field elements
43 EditText street, city; 44 EditText street, city;
44 Spinner state; 45 Spinner state;
 
 
Line 57 Line 58
57 city = (EditText) findViewById(R.id.CityInput); 58 city = (EditText) findViewById(R.id.CityInput);
58 state = (Spinner) findViewById(R.id.StateInput); 59 state = (Spinner) findViewById(R.id.StateInput);
59 degree = (RadioGroup) findViewById(R.id.DegreeRadio); 60 degree = (RadioGroup) findViewById(R.id.DegreeRadio);
60 search = (Button) findViewById(R.id.SearchButton);
61 clear = (Button) findViewById(R.id.ClearButton);
62 about = (Button) findViewById(R.id.AboutButton);
63 emtError = (TextView) findViewById(R.id.EmtError);
64 link = (TextView) findViewById(R.id.PowerLinkText);
65 61
66 //Link to forecast.io 62 //Link to forecast.io
67 link.setMovementMethod(LinkMovementMethod.getInstance()); 63 link.setMovementMethod(LinkMovementMethod.getInstance());
 
 
Line 129 Line 125
129 @Override 125 @Override
130 public void onClick(View v) { 126 public void onClick(View v) {
131 //Clear input field and return to default value 127 //Clear input field and return to default value
132 street.setText("");
133 city.setText("");
134 String defaultVal = "Select";
135 ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(MainActivity.this, R.array.us_states, android.R.layout.simple_spinner_item); 128 ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(MainActivity.this, R.array.us_states, android.R.layout.simple_spinner_item);
136 int defaultPos = adapter.getPosition(defaultVal); 129 int defaultPos = adapter.getPosition(defaultVal);
137 state.setSelection(defaultPos); 130 state.setSelection(defaultPos);
 
 
Line 153 Line 146
153 URL url; 146 URL url;
154 HttpURLConnection urlConnection = null; 147 HttpURLConnection urlConnection = null;
155 JSONObject response = new JSONObject(); 148 JSONObject response = new JSONObject();
149 street.setText("");
150 city.setText("");
151 String defaultVal = "Select";
156 152
157 try { 153 try {
158 url = new URL(params[0]); 154 url = new URL(params[0]);
 
 
Line 182 Line 178
182 //Get result JSON data and render new activity screen 178 //Get result JSON data and render new activity screen
183 Intent intent = new Intent(MainActivity.this, MainResult.class); 179 Intent intent = new Intent(MainActivity.this, MainResult.class);
184 intent.putExtra("result", result.toString()); 180 intent.putExtra("result", result.toString());
185 intent.putExtra("city", passCity); 181 intent.putExtra("city", passCity1);
186 intent.putExtra("state", passState); 182 intent.putExtra("state", passState2);
187 intent.putExtra("degree", passDegree); 183 intent.putExtra("degree", passDegree);
188 MainActivity.this.startActivity(intent); 184 MainActivity.this.startActivity(intent);
189 } 185 }
 
 
Line 219 Line 215
219 } 215 }
220 216
221 public void updateDrawState(TextPaint p_DrawState) { 217 public void updateDrawState(TextPaint p_DrawState) {
222 super.updateDrawState(p_DrawState); 218 super.updateDrawState(p_DrawState2);
223 p_DrawState.setUnderlineText(false); 219 p_DrawState.setUnderlineText(false2);
224 } 220 }
225 } 221 }
226 222
 
  
Legend:
Removed 
Changed
 Added

[Add General Comment] to topic.