2012-08-13 35 views
-1

我有一個tabhost包含4 activities無需單擊tabhost啓動活動

1===>>show my appointments 

2===>>set Appointment 

3===>>Block calender 

4===>>other. 

1.I need to launch the set appointment from the show my appointment by passing some data (but tabhost should be remains)

2. From the dash board if want to open set appointment in tabhost but internally its executing all activities in tabhost how can I avoid this if I am coming from the dash board to tabhost

我用tabHost.setCurrentTab(SetAppointment);

但其內部的execeuing其他活動的同時,但不應該發生的。

public class ShowMyAppointments extends Activity implements OnClickListener 
    { 

//  in list selection the below code 

    else if(showItems[selectedPosition].equals("ReSchedule")){ 

           String appointmentId = String.valueOf(appointmentsList.get(SELECTED_PATIENT).getId()); 
           String statusCode = Constants.STATUS_CANCLEED_DOCTOR;    

           new SatusAsunc(ShowMyAppointments.this ,appointmentId , statusCode).execute(); 

           HomeGridViewActivity.value=1;       
           Constants.CONSUMER_ID=appointmentsList.get(SELECTED_PATIENT).getConsumerID();       
           Constants.CONTACT_NO=appointmentsList.get(SELECTED_PATIENT).getConsumerContact(); 
           Constants.PATIENT_NAME=appointmentsList.get(SELECTED_PATIENT).getConsumerName();      
           Intent intent = new Intent(ShowMyAppointments.this , BaseActivity.class);      
           startActivity(intent); 
          } 

回答

0

如果你想故意發送一些數據,那麼試試這個

Intent intent=new Intent(); 
     intent.putExtra(name, value); 
    _parentActivity.startActivityFromChild(childActivity, intent, requestCode); //childActivity =show my appointment requestCode=0 or any thing else 
+0

方法請來電顯示我的約會活動這兩個方法調用設置約會活動

TabActivity _parentActivity=(TabActivity) getParent(); _parentActivity.getTabHost().setCurrentTab(1); //index of set appointments _parentActivity.onTabChanged("set appointment"); //Please provide tabSpaceName here of set appointment name 

onTabChanged (字符串)是未定義的類型TabActivity我收到此錯誤 – Sri 2012-08-13 07:12:59

+0

請在「顯示我的約會活動」中調用此方法,因爲它是您的標籤主機的子活動 – 2012-08-13 07:32:23

+0

請發佈您的「顯示我的約會活動」 – 2012-08-13 07:33:13