Latest changes in Android MobiAds.
authorgumartinm <gustavo@gumartinm.name>
Thu, 3 May 2012 00:50:29 +0000 (02:50 +0200)
committergumartinm <gustavo@gumartinm.name>
Thu, 3 May 2012 00:50:29 +0000 (02:50 +0200)
List with the received ads.

14 files changed:
Android/MobiAds/AndroidManifest.xml
Android/MobiAds/gen/de/android/mobiads/R.java
Android/MobiAds/res/layout/mobiadslist.xml [new file with mode: 0644]
Android/MobiAds/res/layout/mobiadsmain.xml
Android/MobiAds/res/layout/news_entry_list_item.xml [new file with mode: 0644]
Android/MobiAds/res/values/strings.xml
Android/MobiAds/src/de/android/mobiads/MobiAdsMainActivity.java
Android/MobiAds/src/de/android/mobiads/batch/MobiAdsBatch.java
Android/MobiAds/src/de/android/mobiads/list/AdsEntry.java [new file with mode: 0644]
Android/MobiAds/src/de/android/mobiads/list/AdsEntryAdapter.java [new file with mode: 0644]
Android/MobiAds/src/de/android/mobiads/list/MobiAdsListActivity.java [new file with mode: 0644]
Android/MobiAds/src/de/android/mobiads/provider/Indexer.java
Android/MobiAds/src/de/android/mobiads/provider/IndexerOpenHelper.java
Android/MobiAds/src/de/android/mobiads/provider/IndexerProvider.java

index af81fea..a6b0675 100644 (file)
@@ -2,7 +2,8 @@
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
     package="de.android.mobiads"
     android:versionCode="1"
-    android:versionName="1.0" android:installLocation="internalOnly">
+    android:versionName="1.0" 
+    android:installLocation="internalOnly">
 
     <uses-sdk android:minSdkVersion="14" />
     <uses-permission android:name="android.permission.INTERNET"/>
             </intent-filter>
                </activity>
                
+        <activity
+            android:label="@string/app_name"
+            android:name=".list.MobiAdsListActivity"
+            android:theme="@android:style/Theme.Black" 
+            android:screenOrientation="portrait"
+            android:configChanges="touchscreen|keyboard" >
+            <intent-filter>
+                <action android:name="android.intent.action.MOBIADSLIST" />
+                <category android:name="android.intent.category.DEFAULT" />
+            </intent-filter>
+        </activity>
+               
         <service
                    android:name=".MobiAdsService"
                android:process=":mobiadsservice" >
index 93833a5..e3278a0 100644 (file)
@@ -15,39 +15,55 @@ public final class R {
         public static final int ic_launcher=0x7f020001;
     }
     public static final class id {
+        public static final int ads_entry_icon=0x7f05000f;
+        public static final int ads_entry_text=0x7f050011;
+        public static final int ads_entry_title=0x7f050010;
+        public static final int button_bind=0x7f050007;
+        public static final int button_lislocalads=0x7f05000e;
+        public static final int button_startservice=0x7f05000c;
+        public static final int button_stopservice=0x7f05000a;
+        public static final int button_unbind=0x7f050008;
         public static final int cancel_button=0x7f050005;
         public static final int frameLayout1=0x7f050000;
         public static final int frameLayout2=0x7f050003;
+        public static final int frameLayout3=0x7f050009;
+        public static final int frameLayout4=0x7f05000b;
+        public static final int frameLayout5=0x7f05000d;
+        public static final int list=0x7f050006;
         public static final int login_button=0x7f050004;
         public static final int password=0x7f050002;
         public static final int username=0x7f050001;
     }
     public static final class layout {
         public static final int main=0x7f030000;
-        public static final int mobiadsmain=0x7f030001;
+        public static final int mobiadslist=0x7f030001;
+        public static final int mobiadsmain=0x7f030002;
+        public static final int news_entry_list_item=0x7f030003;
     }
     public static final class string {
         public static final int alert_dialog_cancel=0x7f040003;
         public static final int app_description=0x7f040002;
         public static final int app_name=0x7f040001;
-        public static final int button_cancel=0x7f04000e;
+        public static final int button_cancel=0x7f04000f;
         public static final int button_login=0x7f040008;
         public static final int button_messagebind=0x7f040009;
+        public static final int button_messagelistlocalads=0x7f04000d;
         public static final int button_messagestartservice=0x7f04000c;
         public static final int button_messagestopservice=0x7f04000b;
         public static final int button_messageunbind=0x7f04000a;
-        public static final int button_ok=0x7f04000d;
-        public static final int encoded_web_service=0x7f040015;
+        public static final int button_ok=0x7f04000e;
+        public static final int desc=0x7f040017;
+        public static final int encoded_web_service=0x7f040016;
         public static final int error_dialog_connection_error=0x7f040004;
         public static final int error_dialog_userpwd_error=0x7f040005;
         public static final int hello=0x7f040000;
         public static final int password=0x7f040007;
-        public static final int remote_service_label=0x7f040011;
-        public static final int remote_service_started=0x7f04000f;
-        public static final int remote_service_stopped=0x7f040010;
-        public static final int url_login_web_service=0x7f040012;
-        public static final int url_web=0x7f040013;
-        public static final int user_agent_web_service=0x7f040014;
+        public static final int remote_service_label=0x7f040012;
+        public static final int remote_service_started=0x7f040010;
+        public static final int remote_service_stopped=0x7f040011;
+        public static final int url_login_web_service=0x7f040013;
+        public static final int url_web=0x7f040014;
+        public static final int user_agent_web_service=0x7f040015;
         public static final int username=0x7f040006;
     }
 }
diff --git a/Android/MobiAds/res/layout/mobiadslist.xml b/Android/MobiAds/res/layout/mobiadslist.xml
new file mode 100644 (file)
index 0000000..dd5ea07
--- /dev/null
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="fill_parent"
+    android:layout_height="fill_parent"
+    android:orientation="vertical" >
+
+    <TextView
+        android:layout_width="fill_parent"
+        android:layout_height="wrap_content"
+        android:text="@string/hello" />
+    
+    <ListView android:id="@+id/list"
+        android:layout_width="fill_parent"
+        android:layout_height="fill_parent" />
+
+</LinearLayout>
\ No newline at end of file
index 552d337..962752c 100644 (file)
        android:layout_height="30dp">
     </FrameLayout>
     <Button
-               android:id="@+id/login_button"
+               android:id="@+id/button_bind"
                android:onClick="onClickBind"
            android:layout_height="wrap_content" 
            android:text="@string/button_messagebind" 
            android:layout_width="match_parent" 
            android:layout_gravity="center"/>
     <FrameLayout 
-       android:id="@+id/frameLayout1
+       android:id="@+id/frameLayout2
        android:layout_width="match_parent" 
        android:layout_height="30dp">
     </FrameLayout>
     <Button
-               android:id="@+id/login_button"
+               android:id="@+id/button_unbind"
                android:onClick="onClickUnBind"
            android:layout_height="wrap_content" 
            android:text="@string/button_messageunbind" 
            android:layout_width="match_parent" 
            android:layout_gravity="center"/>
     <FrameLayout 
-       android:id="@+id/frameLayout1
+       android:id="@+id/frameLayout3
        android:layout_width="match_parent" 
        android:layout_height="30dp">
     </FrameLayout>
     <Button
-               android:id="@+id/login_button"
+               android:id="@+id/button_stopservice"
                android:onClick="onClickStopService"
            android:layout_height="wrap_content" 
            android:text="@string/button_messagestopservice" 
            android:layout_width="match_parent" 
            android:layout_gravity="center"/>
     <FrameLayout 
-       android:id="@+id/frameLayout1
+       android:id="@+id/frameLayout4
        android:layout_width="match_parent" 
        android:layout_height="30dp">
     </FrameLayout>
     <Button
-               android:id="@+id/login_button"
+               android:id="@+id/button_startservice"
                android:onClick="onClickStartService"
            android:layout_height="wrap_content" 
            android:text="@string/button_messagestartservice" 
            android:layout_width="match_parent" 
-           android:layout_gravity="center"/>  
+           android:layout_gravity="center"/>
+    <FrameLayout 
+        android:id="@+id/frameLayout5" 
+        android:layout_width="match_parent" 
+        android:layout_height="30dp">
+    </FrameLayout>
+    <Button
+        android:id="@+id/button_lislocalads"
+        android:onClick="onClickListLocalAds"
+        android:layout_height="wrap_content" 
+        android:text="@string/button_messagelistlocalads" 
+        android:layout_width="match_parent" 
+        android:layout_gravity="center"/>
 </LinearLayout>
\ No newline at end of file
diff --git a/Android/MobiAds/res/layout/news_entry_list_item.xml b/Android/MobiAds/res/layout/news_entry_list_item.xml
new file mode 100644 (file)
index 0000000..13a01c3
--- /dev/null
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!-- Layout for individual ads entries in a list -->
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="fill_parent"
+    android:layout_height="fill_parent"
+    android:orientation="vertical">
+    
+    <!-- Icon shown next to the title/text -->
+    <ImageView
+        android:id="@+id/ads_entry_icon"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_alignParentTop="true"
+        android:layout_alignParentLeft="true"
+        android:padding="3dp"
+        android:orientation="vertical"
+        android:contentDescription="@string/desc"/>
+    
+    <!-- Title of the ads entry -->
+    <TextView
+        android:id="@+id/ads_entry_title"
+        android:layout_width="fill_parent"
+        android:layout_height="wrap_content"
+        android:layout_toRightOf="@id/ads_entry_icon"
+        android:layout_alignTop="@id/ads_entry_icon"
+           android:layout_margin="5dp"
+        android:textSize="14sp"
+        android:textStyle="bold" />
+    
+    <!-- Text of our entry -->
+    <TextView
+        android:id="@+id/ads_entry_text"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_alignLeft="@id/ads_entry_title"
+        android:layout_below="@id/ads_entry_title" 
+        android:textSize="12sp" />
+
+</RelativeLayout>
\ No newline at end of file
index a81ec01..83f2cf0 100644 (file)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <resources>
 
-    <string name="hello">MobiAdsActivity!</string>
+    <string name="hello">Android MobiAds!</string>
     <string name="app_name">MobiAds</string>
     <string name="app_description">Receive notifications about offers and discounts.</string>
     <string name="alert_dialog_cancel">Do you really want to close the application?</string>
@@ -14,6 +14,7 @@
     <string name="button_messageunbind">Unbind Service</string>
     <string name="button_messagestopservice">Stop Application</string>
     <string name="button_messagestartservice">Start Application</string>
+    <string name="button_messagelistlocalads">List Your Ads</string>
     <string name="button_ok">OK</string>
     <string name="button_cancel">Cancel</string>
     <string name="remote_service_started">MobiAds Service Started</string>
@@ -23,5 +24,5 @@
     <string name="url_web">users.mobiads.gumartinm.name</string>
     <string name="user_agent_web_service">MobieAds/1.0</string>
     <string name="encoded_web_service">UTF-8</string>
-
+    <string name="desc">description</string>
 </resources>
\ No newline at end of file
index ab56d67..3fbeaa7 100644 (file)
@@ -35,7 +35,28 @@ public class MobiAdsMainActivity extends Activity {
         }
         super.onCreate(savedInstanceState);
         setContentView(R.layout.mobiadsmain);
-    }    
+    }
+    
+    @Override
+    public void onPause() {
+       super.onPause();
+    }
+    
+    @Override
+    public void onStop() {
+       super.onStop();
+    }
+    
+    @Override
+    public void onDestroy() {
+       this.stopService(new Intent(MobiAdsMainActivity.this, MobiAdsService.class));
+       super.onDestroy();
+    }
+    
+    @Override
+    public void onResume() {
+       super.onResume();
+    }
     
     /**
      * Handler of incoming messages from service.
@@ -123,4 +144,10 @@ public class MobiAdsMainActivity extends Activity {
         intent.putExtra("cookie", MobiAdsMainActivity.cookie);
        this.startService(intent);
     }
+    
+    public void onClickListLocalAds(View v) {
+       Intent intent = new Intent("android.intent.action.MOBIADSLIST").
+                               setComponent(new ComponentName("de.android.mobiads", "de.android.mobiads.list.MobiAdsListActivity"));
+               this.startActivity(intent);
+    }
 }
index 025ab32..0268bec 100644 (file)
@@ -6,6 +6,7 @@ import java.io.IOException;
 import java.io.InputStreamReader;
 import java.io.OutputStream;
 import java.io.UnsupportedEncodingException;
+import java.lang.reflect.UndeclaredThrowableException;
 import java.net.MalformedURLException;
 import java.net.URISyntaxException;
 import java.net.URL;
@@ -55,8 +56,8 @@ public class MobiAdsBatch {
        
        final String latitude = Double.toString(location.getLatitude());
        final String longitude = Double.toString(location.getLongitude());
-       final String latitudeReplace = latitude.replace(".", ",");
-       final String longitudeReplace = longitude.replace(".", ",");
+       final String latitudeReplace = /*latitude.replace(".", ",")*/ "40,5129";
+       final String longitudeReplace = /*longitude.replace(".", ",")*/"-3,3492";
        final String URLAuth = "http://users.mobiads.gumartinm.name/userfront.php/api/" + latitudeReplace + "/" + longitudeReplace + "/gpsads.json";
        URL url = null;
        
@@ -138,7 +139,7 @@ public class MobiAdsBatch {
                                                                        throw (IOException) e1;
                                                                }
                                                                //throwing Throwable. At least the original exception is not lost :/
-                                                               throw e1;
+                                                               throw new UndeclaredThrowableException(e1);
                                                        }
                                                }
                                                
@@ -246,7 +247,7 @@ public class MobiAdsBatch {
                                                        entity.consumeContent();
                                                }
                                        }
-                               } catch (Throwable e) {
+                               } catch (IOException e) {
                                        // Log this exception. The original exception (if there is one) is more
                                        // important and will be thrown to the caller. See: {@link AbstractHttpClient}
                                        Log.w("Error consuming content after an exception.", e);
diff --git a/Android/MobiAds/src/de/android/mobiads/list/AdsEntry.java b/Android/MobiAds/src/de/android/mobiads/list/AdsEntry.java
new file mode 100644 (file)
index 0000000..30cb3c3
--- /dev/null
@@ -0,0 +1,42 @@
+package de.android.mobiads.list;
+
+import android.graphics.Bitmap;
+
+
+/**
+ * Encapsulates information about an ads entry
+ */
+public final class AdsEntry {
+       
+       private final String title;
+       private final String text;
+       private final Bitmap icon;
+
+       public AdsEntry(final String title, final String text, final Bitmap icon) {
+               this.title = title;
+               this.text = text;
+               this.icon = icon;
+       }
+
+       /**
+        * @return Title of ads entry
+        */
+       public String getTitle() {
+               return title;
+       }
+
+       /**
+        * @return Text of ads entry
+        */
+       public String getText() {
+               return text;
+       }
+
+       /**
+        * @return Icon of this ads entry
+        */
+       public Bitmap getIcon() {
+               return icon;
+       }
+
+}
diff --git a/Android/MobiAds/src/de/android/mobiads/list/AdsEntryAdapter.java b/Android/MobiAds/src/de/android/mobiads/list/AdsEntryAdapter.java
new file mode 100644 (file)
index 0000000..26990ad
--- /dev/null
@@ -0,0 +1,94 @@
+package de.android.mobiads.list;
+
+import android.widget.ArrayAdapter;
+import de.android.mobiads.R;
+import android.content.Context;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+/**
+ * Adapts AdsEntry objects onto views for lists
+ */
+public final class AdsEntryAdapter extends ArrayAdapter<AdsEntry> {
+
+       private final int newsItemLayoutResource;
+
+       public AdsEntryAdapter(final Context context, final int newsItemLayoutResource) {
+               super(context, 0);
+               this.newsItemLayoutResource = newsItemLayoutResource;
+       }
+
+       @Override
+       public View getView(final int position, final View convertView, final ViewGroup parent) {
+               
+               // We need to get the best view (re-used if possible) and then
+               // retrieve its corresponding ViewHolder, which optimizes lookup efficiency
+               final View view = getWorkingView(convertView);
+               final ViewHolder viewHolder = getViewHolder(view);
+               final AdsEntry entry = getItem(position);
+               
+               // Setting the text view
+               viewHolder.titleView.setText(entry.getTitle());
+               
+               viewHolder.textView.setText(entry.getText());
+               
+               // Setting image view
+               viewHolder.imageView.setImageBitmap(entry.getIcon());
+               
+               return view;
+       }
+
+       private View getWorkingView(final View convertView) {
+               // The workingView is basically just the convertView re-used if possible
+               // or inflated new if not possible
+               View workingView = null;
+               
+               if(null == convertView) {
+                       final Context context = getContext();
+                       final LayoutInflater inflater = (LayoutInflater)context.getSystemService
+                     (Context.LAYOUT_INFLATER_SERVICE);
+                       
+                       workingView = inflater.inflate(newsItemLayoutResource, null);
+               } else {
+                       workingView = convertView;
+               }
+               
+               return workingView;
+       }
+       
+       private ViewHolder getViewHolder(final View workingView) {
+               // The viewHolder allows us to avoid re-looking up view references
+               // Since views are recycled, these references will never change
+               final Object tag = workingView.getTag();
+               ViewHolder viewHolder = null;
+               
+               
+               if(null == tag || !(tag instanceof ViewHolder)) {
+                       viewHolder = new ViewHolder();
+                       
+                       viewHolder.titleView = (TextView) workingView.findViewById(R.id.ads_entry_title);
+                       viewHolder.textView = (TextView) workingView.findViewById(R.id.ads_entry_text);
+                       viewHolder.imageView = (ImageView) workingView.findViewById(R.id.ads_entry_icon);
+                       
+                       workingView.setTag(viewHolder);
+                       
+               } else {
+                       viewHolder = (ViewHolder) tag;
+               }
+               
+               return viewHolder;
+       }
+       
+       /**
+        * ViewHolder allows us to avoid re-looking up view references
+        * Since views are recycled, these references will never change
+        */
+       private static class ViewHolder {
+               public TextView titleView;
+               public TextView textView;
+               public ImageView imageView;
+       }
+}
diff --git a/Android/MobiAds/src/de/android/mobiads/list/MobiAdsListActivity.java b/Android/MobiAds/src/de/android/mobiads/list/MobiAdsListActivity.java
new file mode 100644 (file)
index 0000000..0c6d929
--- /dev/null
@@ -0,0 +1,74 @@
+package de.android.mobiads.list;
+
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import de.android.mobiads.R;
+import de.android.mobiads.provider.Indexer;
+import android.app.Activity;
+import android.database.Cursor;
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
+import android.net.Uri;
+import android.os.Bundle;
+import android.util.Log;
+import android.widget.ListView;
+
+public class MobiAdsListActivity extends Activity {
+       private static final String TAG = "MobiAdsListActivity";
+       
+    /** Called when the activity is first created. */
+    @Override
+    public void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.mobiadslist);
+        
+        // Setup the list view
+        final ListView newsEntryListView = (ListView) findViewById(R.id.list);
+        final AdsEntryAdapter newsEntryAdapter = new AdsEntryAdapter(this, R.layout.news_entry_list_item);
+        newsEntryListView.setAdapter(newsEntryAdapter);
+        
+        // Populate the list, through the adapter. Should I populate the whole list right now? I do not think so...
+        // Find out a way to populate this list just when it is required... :/
+        for(final AdsEntry entry : getAdsEntries()) {
+               newsEntryAdapter.add(entry);
+        }
+    }
+    
+    private List<AdsEntry> getAdsEntries() {
+       final List<AdsEntry> entries = new ArrayList<AdsEntry>();
+       final Uri uri = Uri.parse("content://" + "de.android.mobiads.provider" + "/" + "indexer");
+       
+       Cursor cursor = this.getContentResolver().query(uri, null, null, null, null);
+       try {
+                       if (cursor.moveToFirst()) {
+                               do {
+                                       Bitmap bitMap = null;
+                                       FileInputStream file = null;
+                                       try {
+                                               file = this.openFileInput(cursor.getString(cursor.getColumnIndexOrThrow(Indexer.Index.COLUMN_NAME_PATH)));
+                                               bitMap = BitmapFactory.decodeStream(file);
+                                       } catch (FileNotFoundException e) {
+                                       } catch (IllegalArgumentException e) {
+                                               continue;
+                                       }
+                                       finally {
+                                               try {
+                                                       file.close();
+                                               } catch (IOException e) {
+                                                       Log.w(TAG, "Error while closing image file.");
+                                               }
+                                       }
+                                       entries.add(new AdsEntry(cursor.getString(cursor.getColumnIndexOrThrow(Indexer.Index.COLUMN_NAME_URL)), 
+                                                       cursor.getString(cursor.getColumnIndexOrThrow(Indexer.Index.COLUMN_NAME_TEXT)), bitMap));
+                               }while (cursor.moveToNext());
+                       } 
+       }finally {
+                               cursor.close();
+               }
+       
+       return entries;
+    }
+}
\ No newline at end of file
index 623e503..fb4cd4f 100644 (file)
@@ -36,6 +36,18 @@ public final class Indexer {
         public static final String COLUMN_NAME_ID_AD = "idad";
         
         /**
+         * Column name for the ad's text.
+         * <P>Type: TEXT</P>
+         */
+        public static final String COLUMN_NAME_TEXT = "text";
+        
+        /**
+         * Column name for the ad's URL.
+         * <P>Type: TEXT</P>
+         */
+        public static final String COLUMN_NAME_URL = "url";
+        
+        /**
          * The default sort order for this table
          */
         public static final String DEFAULT_SORT_ORDER = Index._ID;
index ab42ba0..acaaaff 100644 (file)
@@ -25,11 +25,12 @@ public class IndexerOpenHelper extends SQLiteOpenHelper {
      */
     @Override
        public void onCreate(SQLiteDatabase db) {
-       Log.i("IndexerOpenHelper", "onCreate");
                db.execSQL("CREATE TABLE " + Indexer.Index.TABLE_NAME + " ("
-                               + Indexer.Index._ID + "  INTEGER PRIMARY KEY, "
-                               + Indexer.Index.COLUMN_NAME_ID_AD + " INTEGER" + " UNIQUE" + " NOT NULL,"
-                               + Indexer.Index.COLUMN_NAME_PATH + " TEXT(15)" + " UNIQUE" + " NOT NULL"
+                               + Indexer.Index._ID + " INTEGER PRIMARY KEY, "
+                               + Indexer.Index.COLUMN_NAME_ID_AD + " INTEGER" + " UNIQUE" + " NOT NULL, "
+                               + Indexer.Index.COLUMN_NAME_PATH + " TEXT(15)" + " UNIQUE" + " NOT NULL, "
+                               + Indexer.Index.COLUMN_NAME_URL + " TEXT(2000)" + " NOT NULL, "
+                               + Indexer.Index.COLUMN_NAME_TEXT + " TEXT(255)" + " NOT NULL"
                                + ");");
        }
 
index d616500..272aff0 100644 (file)
@@ -72,6 +72,10 @@ public class IndexerProvider extends ContentProvider {
 
         // Maps "path" to "path"
         sIndexerProjectionMap.put(Indexer.Index.COLUMN_NAME_PATH, Indexer.Index.COLUMN_NAME_PATH);
+        
+        sIndexerProjectionMap.put(Indexer.Index.COLUMN_NAME_TEXT, Indexer.Index.COLUMN_NAME_TEXT);
+        
+        sIndexerProjectionMap.put(Indexer.Index.COLUMN_NAME_URL, Indexer.Index.COLUMN_NAME_URL);
     }
  
     
@@ -84,8 +88,6 @@ public class IndexerProvider extends ContentProvider {
         */
        @Override
        public boolean onCreate() {
-               Log.i("IndexerProvider", "onCreate");
-               
       // Creates a new helper object. Note that the database itself isn't opened until
       // something tries to access it, and it's only created if it doesn't already exist.
       mOpenHelper = new IndexerOpenHelper(getContext());
@@ -223,6 +225,8 @@ public class IndexerProvider extends ContentProvider {
                SQLiteDatabase db = mOpenHelper.getWritableDatabase();
                
                // Performs the insert and returns the ID of the new index.
+               values.put(Indexer.Index.COLUMN_NAME_TEXT, "Texto de prueba");
+               values.put(Indexer.Index.COLUMN_NAME_URL, "http://gumartinm.name");
         long rowId = db.insert(
                Indexer.Index.TABLE_NAME, // The table to insert into.
             null,                                        // A hack, SQLite sets this column value to null if values is empty.