make API level request less crashy
This commit is contained in:
parent
48751a0071
commit
80a234cc15
@ -1212,11 +1212,15 @@ public class MainActivity extends FragmentActivity implements OnlineServices {
|
||||
|
||||
ApiRequest req = new ApiRequest(m_context) {
|
||||
protected void onPostExecute(JsonElement result) {
|
||||
m_apiLevel = 0;
|
||||
|
||||
if (result != null) {
|
||||
try {
|
||||
m_apiLevel = result.getAsJsonObject()
|
||||
.get("level").getAsInt();
|
||||
} else {
|
||||
m_apiLevel = 0;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
Log.d(TAG, "Received API level: " + m_apiLevel);
|
||||
|
Loading…
Reference in New Issue
Block a user