How do I use JSONObject in Android
<p>I have the following Android java code:</p>

<pre><code>String json = "{\"Name_1\":1,\"Name_2\":0,\"Name_3\":0}";
JSONObject object = new JSONObject(json);
String[] propertyNames = JSONObject.getNames(object);
values = new String[propertyNames.length];
for (int i = 0; i &lt; propertyNames.length; i++) {
  values[i] = String.valueOf(object.get(propertyNames[i]));
}
</code></pre>

<p>but I am getting the following error: The method <code>getNames(JSONObject)</code> is undefined for the type <code>JSONObject</code>.
What can I do to get the <code>propertyNames</code>?</p>
