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) {
|
ApiRequest req = new ApiRequest(m_context) {
|
||||||
protected void onPostExecute(JsonElement result) {
|
protected void onPostExecute(JsonElement result) {
|
||||||
|
m_apiLevel = 0;
|
||||||
|
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
m_apiLevel = result.getAsJsonObject()
|
try {
|
||||||
.get("level").getAsInt();
|
m_apiLevel = result.getAsJsonObject()
|
||||||
} else {
|
.get("level").getAsInt();
|
||||||
m_apiLevel = 0;
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.d(TAG, "Received API level: " + m_apiLevel);
|
Log.d(TAG, "Received API level: " + m_apiLevel);
|
||||||
|
Loading…
Reference in New Issue
Block a user