我有兩個活動撥號盤和電話。在撥號盤活動中有一個編輯框和按鈕來撥打號碼,在電話活動中有5條線路要打電話。當你選擇線路1時,撥號活動打開等等。我面臨的問題是第一次我從電話活動中選擇任何線路,撥號活動的onCreate功能爲cal,當我返回到電話活動並選擇其他線路時,不會調用撥號活動的onCreate()功能。撥號活動的onStart()函數是cal,我想調用onCreate()函數.plz幫助我解決這個問題。當我返回第一個活動時,第二個活動的onCreate()函數不會在第二次調用
public class DialPad extends Activity
{
private TextView m_objStatus;
private Button m_objBtnDial;
int m_nLineNo = -1;
boolean m_objContactFlag;
public static Phone m_objPhone;
private static String[] m_objPhoneNum = new String[VaxSIPUserAgent.TOTAL_LINE_COUNT];
public void onCreate(Bundle savedInstanceState)
{
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
Phone.m_objDialPad = this;
Intent intent = getIntent();
int nIntentExtraLineNo = intent.getIntExtra("LineNo", 1);
m_nLineNo = nIntentExtraLineNo;
final int [] aLineArray = new int[VaxSIPUserAgent.TOTAL_LINE_COUNT - 1];
int nIndex = 0;
for (int nLineNo = 0; nLineNo < VaxSIPUserAgent.TOTAL_LINE_COUNT; nLineNo++)
{
if(m_nLineNo == nLineNo)
continue;
aLineArray[nIndex] = nLineNo + 1;
nIndex++;
}
String sLineStatus = VaxStatus.m_objVaxStatus.GetLineStatus(m_nLineNo);
OnStatusPhone(sLineStatus);
String sPhoneNo = intent.getStringExtra("PhoneNo");
if(sPhoneNo != null)
{
m_objPhoneNum[nIntentExtraLineNo] = sPhoneNo;
}
m_objEditDialscreen.setText(m_objPhoneNum[nIntentExtraLineNo]);
}
@Override
protected void onStart()
{
UpdateDialBtn();
if(m_objContactFlag == false)
m_objEditDialscreen.setText(m_objPhoneNum[m_nLineNo]);
IncommingCallSlider.m_objCallSlider.SetActiveActivity(this, R.id.dialpad);
IncommingCallRing.m_objIncommingCallRing.SetActiveActivity(this);
DialCallTone.m_objDialCallTone.SetActiveActivity(this);
super.onStart();
}
@Override
protected void onStop()
{
m_objPhoneNum[m_nLineNo] = m_objEditDialscreen.getText().toString();
super.onStop();
}
}
我想CAL在第2條第二時間,但在onStart()函數被調用的getIntent()函數。 – user3136235
oncreate()只會被調用一次...您可以在每次返回電話活動時完成撥號活動。 – Vikram