Skip to content

Instantly share code, notes, and snippets.

View notedit's full-sized avatar
🎯
Focusing

leeoxiang notedit

🎯
Focusing
View GitHub Profile
@underhilllabs
underhilllabs / FetchWeatherTask.java
Last active January 5, 2023 08:14
example AsyncTask in android
private class FetchWeatherTask extends AsyncTask<Void, Void, Void> {
private final String LOG_TAG = FetchWeatherTask.class.getSimpleName();
// These two need to be declared outside the try/catch
// so that they can be closed in the finally block.
HttpURLConnection urlConnection = null;
BufferedReader reader = null;
// Will contain the raw JSON response as a string.
String forecastJsonStr = null;
@sakrist
sakrist / screenshot.mm
Last active August 28, 2020 06:21
Getting screenshot on iOS OpenGL ES
- (UIImage*) takePicture {
int s = 1;
UIScreen* screen = [UIScreen mainScreen];
if ([screen respondsToSelector:@selector(scale)]) {
s = (int) [screen scale];
}
GLint viewport[4];
glGetIntegerv(GL_VIEWPORT, viewport);