Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- HttpClient client = new HttpClient(new OnHttpRequestComplete() {
- @Override
- public void onComplete(Response status) {
- if(status.isSuccess()){
- Gson gson = new GsonBuilder().create();
- try {
- JSONObject jsono = new JSONObject(status.getResult());
- // Se llamaría es al UID del usuario, para efectos de esta prueba llamo directamente
- // el uid.
- JSONArray jsonarray = jsono.getJSONArray("Io0TUxDWdNXjdzoaBiXsC8Qh77b2");
- ArrayList<Person> personas = new ArrayList<Person>();
- for (int i = 0; i < jsonarray.length(); i++){
- String person = jsonarray.getString(i);
- System.out.println(person);
- Person p = gson.fromJson(person, Person.class);
- personas.add(p);
- System.err.println(p.getCreatedAt());
- //TextView t = new TextView(mainActivity.this);
- TextView t = new TextView(getBaseContext());
- t.setText(p.getCreatedAt());
- stackContent.addView(t);
- }
- }catch (Exception e){
- System.out.println("Falla Presente");
- e.printStackTrace();
- }
- Toast.makeText(mainActivity.this, status.getResult(), Toast.LENGTH_SHORT);
- }
- }
- });
- client.excecute("https://console.firebase.google.com/u/0/project/akibaap2/database/akibaap2/data/users");
- }
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.menu_main, menu);
- return true;
- }
- @Override
- public boolean onOptionsItemSelected(MenuItem item) {
- // Handle action bar item clicks here. The action bar will
- // automatically handle clicks on the Home/Up button, so long
- // as you specify a parent activity in AndroidManifest.xml.
- int id = item.getItemId();
- //noinspection SimplifiableIfStatement
- if (id == R.id.action_settings) {
- return true;
- }
- return super.onOptionsItemSelected(item);
- }
Add Comment
Please, Sign In to add comment