0

この活動から価値を発信したい

public class HomeActivity extends android.app.TabActivity
{
    String uid;
protected void onCreate(Bundle savedInstanceState) 
      {
     super.onCreate(savedInstanceState);
     setContentView(R.layout.activity_home);
     TabHost tabHost = getTabHost();
     Intent intent = getIntent();
     uid = intent.getStringExtra("uid");  
     // Tab for ActivityOne
     TabSpec photospec = tabHost.newTabSpec("Home");
     photospec.setIndicator("Home", getResources().getDrawable(R.drawable.one));
     Intent photosIntent = new Intent(this, TabhomeActivity.class);
     photosIntent.putExtra("uid", uid);
     // startActivityForResult(photosIntent,0);
     photospec.setContent(photosIntent);

     // Tab for ActivitySecond
     TabSpec songspec = tabHost.newTabSpec("Today's Meeting");
     // setting Title and Icon for the Tab
     songspec.setIndicator("Today's Meeting",
                                          getResources().getDrawable(R.drawable.one));
     Intent songsIntent = new Intent(this,TodaysmeetingActivity.class);
     songspec.setContent(songsIntent);
     // Adding all TabSpec to TabHost
     tabHost.addTab(photospec); // Adding photos tab
     tabHost.addTab(songspec); // Adding songs tab  
    }
 }

この活動に..

public class TabhomeActivity extends Activity {

Button button1;
Button button2;
Button button3;
TextView txtview,shwname;
String uid;

@Override
public void onCreate(Bundle savedInstanceState) 
{ 

    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_tabhome);
    Intent intent = getParent().getIntent();
    uid = intent.getStringExtra("uid");
    shwname=(TextView)findViewById(R.id.textView3);
    shwname.setText("Hi\t"+uid);
 }

誰でも私を助けることができますか?? お願いします。前もって感謝します。

4

2 に答える 2

0

以下を試してください。

Intent intent = getIntent();
Bundle extras = intent.getExtras();
uid = getIntent().getExtras().getString(YOUR_KEY);  

同様に、データを意図的な使用に設定する場合

extras.putString(YOUR_KEY, YOUR_VALUE);
于 2013-04-26T09:43:14.293 に答える