SORU
4 ŞUBAT 2010, PERŞEMBE


Nasıl Android bir URL açmak'benim uygulama web tarayıcı s miyim?

Nasıl dahili web tarayıcı kodu bir URL açmak yerine benim uygulama içinde?

Bunu denedim:

try {
    Intent myIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(download_link));
    startActivity(myIntent);
} catch (ActivityNotFoundException e) {
    Toast.makeText(this, "No application can handle this request."
          " Please install a webbrowser",  Toast.LENGTH_LONG).show();
    e.printStackTrace();
}

ama bir İstisna var:

No activity found to handle Intent{action=android.intent.action.VIEW data =www.google.com

CEVAP
4 ŞUBAT 2010, PERŞEMBE


Bunu deneyin:

Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.google.com"));
startActivity(browserIntent);

Bu benim için gayet iyi çalışıyor.

Kayıp "://" böyle bir şey yapardım: . http gelince

if (!url.startsWith("http://") && !url.startsWith("https://"))
   url = "http://"   url;

Ayrıca muhtemelen kullanıcı bir URL yazma-önceden doldur senin EditText isterim "http://".

Bunu Paylaş:
  • Google+
  • E-Posta
Etiketler:

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • Joshua Benedict

    Joshua Bened

    26 EKİM 2013
  • pissengehen

    pissengehen

    26 EYLÜL 2006
  • SoundHound

    SoundHound

    8 Mart 2006