SORU
20 NİSAN 2009, PAZARTESİ


Bir Paket startActivity geçen()?

Geçerli bir başlatıldı etkinliği için bir paket geçiş için doğru yolu nedir? Paylaşılan özellikleri?

CEVAP
4 Mayıs 2009, PAZARTESİ


Birkaç seçeneğiniz vardır:

1) Intent: Bundle Kullanın

Intent mIntent = new Intent(this, Example.class);
Bundle extras = mIntent.getExtras();
extras.putString(key, value);  

2) yeni bir Paket Oluşturun

Intent mIntent = new Intent(this, Example.class);
Bundle mBundle = new Bundle();
mBundle.putString(key, value);
mIntent.putExtras(mBundle);

3) Niyet putExtra() kısayol yöntemi Kullanın

Intent mIntent = new Intent(this, Example.class);
mIntent.putExtra(key, value);

String value = getIntent().getExtras().getString(key)

NOT:Demetleri "" ve "put" ilkel türler, Parcelables ve Serializables tüm yöntemleri. Ben sadece demonstrational amaçlar için kullanılan Dizeler.

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

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • ChasesAndCrashes

    ChasesAndCra

    31 Temmuz 2009
  • Cole Rolland

    Cole Rolland

    23 Kasım 2008
  • MovieZoneET

    MovieZoneET

    22 Aralık 2009