Error while launching web brower and no "http://"
authorgumartinm <gu.martinm@gmail.com>
Wed, 13 Feb 2013 02:23:42 +0000 (03:23 +0100)
committergumartinm <gu.martinm@gmail.com>
Wed, 13 Feb 2013 02:23:42 +0000 (03:23 +0100)
Android/MobiAdsReloaded/src/de/android/mobiads/list/MobiAdsLatestList.java
Android/MobiAdsReloaded/src/de/android/mobiads/list/MobiAdsList.java

index 41455a9..8e2b962 100644 (file)
@@ -85,13 +85,17 @@ public class MobiAdsLatestList extends ListActivity implements LoaderManager.Loa
                 Intent updateDatabase = new Intent("de.android.mobiads.MOBIADSSERVICERECEIVER");
                 sendBroadcast(updateDatabase);
 
-                final Uri uri = Uri.parse(mAdapter.getItem(position).getURL());
                 mAdapter.remove(entry);
                 //Update view lists
                 updateDatabase = new Intent("de.android.mobiads.MOBIADSLISTRECEIVER");
                 sendBroadcast(updateDatabase);
 
-                startActivity(new Intent(Intent.ACTION_VIEW, uri));
+                //Going to web browser.
+                String url = entry.getURL();
+                if (!url.startsWith("http://") && !url.startsWith("https://")) {
+                    url = "http://" + url;
+                }
+                startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
 
                 mAdapter.notifyDataSetChanged();
             }
index 46536aa..f982909 100644 (file)
@@ -423,9 +423,12 @@ public class MobiAdsList extends Activity {
             //This will update our view showing a nice black background for this item in our list :/
             mAdapter.notifyDataSetChanged();
 
-            //Going to open the web navigator whatever it is...
-            final Uri uri = Uri.parse(entry.getURL());
-            startActivity(new Intent(Intent.ACTION_VIEW, uri));
+            //Going to web browser.
+            String url = entry.getURL();
+            if (!url.startsWith("http://") && !url.startsWith("https://")) {
+                url = "http://" + url;
+            }
+            startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
         }
 
         private void setIsReadEntry(final AdsEntry entry) {