2017-03-08 2 views
-2

Comment transmettre des paramètres entre les onglets J'ai ce code ActivityMain. Et je voudrais passer les mots de passe de imbox, à la boîte d'envoi MerciPour passer des paramètres avec Tabhost

+0

Pouvez-vous nous montrer votre code, ou nous donner plus des informations sur ce que vous voulez faire s'il vous plaît? –

+0

créer une interface –

+0

voir http://stackoverflow.com/help/how-to-ask – SMR

Répondre

0

Ceci est mon code

@Override 
    public void onCreate(Bundle savedInstanceState) { 
      super.onCreate(savedInstanceState); 
      setContentView(R.layout.main); 

      TabHost tabHost = getTabHost(); 

      // Inbox Tab 
      TabSpec inboxSpec = tabHost.newTabSpec(INBOX_SPEC); 
      // Tab Icon 
      inboxSpec.setIndicator(INBOX_SPEC, getResources().getDrawable(R.drawable.huevo)); 

      Intent inboxIntent = new Intent(this, InboxActivity.class); 

      startActivity(inboxIntent); 
      // Tab Content 
      inboxSpec.setContent(inboxIntent); 

      // Outbox Tab 
      TabSpec outboxSpec = tabHost.newTabSpec(OUTBOX_SPEC); 
      outboxSpec.setIndicator(OUTBOX_SPEC, getResources().getDrawable(R.drawable.huevodos)); 
      Intent outboxIntent = new Intent(this, OutboxActivity.class); 
      outboxSpec.setContent(outboxIntent); 

      // Profile Tab 
      TabSpec profileSpec = tabHost.newTabSpec(PROFILE_SPEC); 
      profileSpec.setIndicator(PROFILE_SPEC, getResources().getDrawable(R.drawable.lock)); 
      Intent profileIntent = new Intent(this, ProfileActivity.class); 
      profileSpec.setContent(profileIntent); 

      // Adding all TabSpec to TabHost 
      tabHost.addTab(inboxSpec); // Adding Inbox tab 
      tabHost.addTab(outboxSpec); // Adding Outbox tab 
      tabHost.addTab(profileSpec); // Adding Profile tab 
    } 

}

import android.app.ListActivity; 
import android.os.Bundle; 

public class InboxActivity extends ListActivity { 
    public void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
     setContentView(R.layout.inbox_list); 

    } 
}