Back to project page weather.
The source code is released under:
MIT License
If you think the Android project weather listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package au.com.codeka.weather; /*w w w. j a va 2 s. com*/ import com.google.gson.Gson; import com.google.gson.GsonBuilder; import android.app.Activity; import android.os.Bundle; import android.util.Base64; import android.webkit.WebView; /** Debug activity is used to display the raw JSON we have store, for debugging. */ public class DebugActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getActionBar().setDisplayHomeAsUpEnabled(true); setContentView(R.layout.debug_activity); WeatherInfo weatherInfo = WeatherManager.i.getCurrentWeather(this); StringBuilder sb = new StringBuilder(); Gson gson = new GsonBuilder().setPrettyPrinting().create(); sb.append("<html><body><pre>"); sb.append(String.format("Location: %f, %f\n", weatherInfo.getLat(), weatherInfo.getLng())); sb.append("\n----------------------------------------\n\n"); sb.append(gson.toJson(weatherInfo.getGeocodeInfo(), GeocodeInfo.class)); sb.append("\n----------------------------------------\n\n"); sb.append(gson.toJson(weatherInfo.getWeather(), OpenWeatherMapInfo.class)); sb.append("</pre></body></html>"); WebView debugInfo = (WebView) findViewById(R.id.debug_info); debugInfo.setVerticalScrollBarEnabled(true); debugInfo.setHorizontalScrollBarEnabled(true); String data = Base64.encodeToString(sb.toString().getBytes(), Base64.DEFAULT); debugInfo.loadData(data, "text/html", "base64"); } }