package com.apibootstraper.mobile;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.widget.ArrayAdapter;
import android.widget.ListView;

import com.apibootstraper.mobile.core.User;
import com.apibootstraper.mobile.core.util.HTTPResponse;

public class MainActivity extends Activity
{
    private TodoApplication application;

    private ListView listView;

    @Override
    protected void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        
        application = (TodoApplication)getApplication();

        listView = (ListView)findViewById(R.id.todoListView);
        String[] listeStrings = {"My first application","Update my application"};

        listView.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, listeStrings));

        // Try to call WS
        application.showProgressDialog(this);
        User.userAvailability("teste", new HTTPResponse<Boolean>() {

            @Override
            public void onSuccess(Boolean isAvailable) {
                Log.d("WS_CALL", isAvailable ? "YES" : "NO");
            }
            
            @Override
            public void onFailure(Throwable error, String content) {
                Log.d("WS_CALL", error.getMessage());
                Log.d("WS_CALL", content);
            }
            
            @Override
            public void onFinish() {
                application.hideProgressDialog();
            }
        });
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu)
    {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.activity_main, menu);
        return true;
    }

}

@@ -29,16 +29,45 @@
 obile;%0A%0A
+import java.util.ArrayList;%0A%0A
 import a
@@ -233,16 +233,60 @@
 tView;%0A%0A
+import com.apibootstraper.mobile.core.Todo;%0A
 import c
@@ -819,70 +819,25 @@
 list
-eStrings = %7B%22My first application%22,%22Update my application
+ = %7B%22No datas
 %22%7D;%0A
-%0A
     
@@ -936,16 +936,8 @@
 list
-eStrings
 ));%0A
@@ -1230,36 +1230,24 @@
           %7D%0A
-            
 %0A           
@@ -1288,223 +1288,8 @@
  onF
-ailure(Throwable error, String content) %7B%0A                Log.d(%22WS_CALL%22, error.getMessage());%0A                Log.d(%22WS_CALL%22, content);%0A            %7D%0A            %0A            @Override%0A            public void onF
 inis
@@ -1302,32 +1302,50 @@
                 
+MainActivity.this.
 application.hide
@@ -1635,12 +1635,537 @@
 e;%0A    %7D
+%0A    %0A    private void refreshTodos()%0A    %7B%0A        application.showProgressDialog(this);%0A        Todo.findAll(new HTTPResponse%3CArrayList%3CTodo%3E%3E() %7B%0A%0A            @Override%0A            public void onSuccess(ArrayList%3CTodo%3E todos) %7B%0A                %0A                listView.setAdapter(new ArrayAdapter%3CString%3E(this, android.R.layout.todo_list_item, ));%0A            %7D%0A%0A            @Override%0A            public void onFinish() %7B%0A                MainActivity.this.application.hideProgressDialog();%0A            %7D%0A        %7D);%0A    %7D
 %0A%0A%7D%0A

Structure the MainActivity