From 3eefd8a2391418ad9b40860811dfc5b8f4742c16 Mon Sep 17 00:00:00 2001 From: gumartinm Date: Wed, 13 Feb 2013 03:23:42 +0100 Subject: [PATCH] Error while launching web brower and no "http://" --- .../src/de/android/mobiads/list/MobiAdsLatestList.java | 8 ++++++-- .../MobiAdsReloaded/src/de/android/mobiads/list/MobiAdsList.java | 9 ++++++--- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/Android/MobiAdsReloaded/src/de/android/mobiads/list/MobiAdsLatestList.java b/Android/MobiAdsReloaded/src/de/android/mobiads/list/MobiAdsLatestList.java index 41455a9..8e2b962 100644 --- a/Android/MobiAdsReloaded/src/de/android/mobiads/list/MobiAdsLatestList.java +++ b/Android/MobiAdsReloaded/src/de/android/mobiads/list/MobiAdsLatestList.java @@ -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(); } diff --git a/Android/MobiAdsReloaded/src/de/android/mobiads/list/MobiAdsList.java b/Android/MobiAdsReloaded/src/de/android/mobiads/list/MobiAdsList.java index 46536aa..f982909 100644 --- a/Android/MobiAdsReloaded/src/de/android/mobiads/list/MobiAdsList.java +++ b/Android/MobiAdsReloaded/src/de/android/mobiads/list/MobiAdsList.java @@ -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) { -- 2.1.4