Rick45 Posted August 8, 2013 at 03:31 PM Report #521234 Posted August 8, 2013 at 03:31 PM Boas pessoal. Eu tenho um objecto json que está acessível em toda a Activity: JSONObject obj = new JSONObject(); // JSON Principal este objecto é composto por um objecto chamado Dados e um array de objectos: dados.put("nome", nome); // objecto dados obj.put("Dados", dados); // Coloco objecto de dados dentro o objecto principal coordsObj.put( "lat", latvalue ); //objecto coords que vai ser colocado dentro de um JSONARRAY coords.put( coordsObj ); // JSONARRAY que contem os objectos coordsObj obj.put( "Coordnadas", coords ); // Coloco o array de coordnadas dentro o objecto principal, o que queria fazer era colocar um butao e ao clicar nele apagava o JSONObject obj. tenho o butao ae tudo a funcionar so que clico nele e nao apaga, já tentei de varias maneiras sem sucesso :S. O que me recomendam para apagar?
KTachyon Posted August 8, 2013 at 08:39 PM Report #521280 Posted August 8, 2013 at 08:39 PM O que estás a fazer para apagar? “There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult.” -- Tony Hoare
Rick45 Posted August 9, 2013 at 04:31 PM Author Report #521369 Posted August 9, 2013 at 04:31 PM (edited) estava a fazer assim. for(int i=0;i<obj.length();i++){ obj.remove("Dados"); obj.remove("Coordnadas"); } Edited August 9, 2013 at 04:32 PM by Rick45
KTachyon Posted August 9, 2013 at 09:17 PM Report #521390 Posted August 9, 2013 at 09:17 PM E se fizeres: obj = new JSONObject(); “There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult.” -- Tony Hoare
Rick45 Posted August 12, 2013 at 01:29 PM Author Report #521513 Posted August 12, 2013 at 01:29 PM ja descobri o problema, essa maneira funcionava, so que estava a esquecer-me de fazer o mesmo ao array, os valores de obj estavam limpos, so que quando punha valores no array e o enviava para o obj os antigos do array ainda la estavem, obrigado
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now