के साथ काम करता है मेरे पास एक साधारण गतिविधि है जो केवल दो बटन दिखाती है, और जैसे ही कोई लोडिंग समाप्त हो जाता है, मैं एक और गतिविधि लोड करना चाहता हूं।ऑनक्रेट में एक नई गतिविधि शुरू करने में केवल
@Override
public void onCreate(Bundle savedInstanceState) {
dbg("starting on create");
super.onCreate(savedInstanceState);
dbg("stting content view");
setContentView(R.layout.main);
createDrPopup();
}
private void createDrPopup(){
dbg("created new activity");
startActivityForResult(new Intent(this, DrPopup.class),
DR_POPUP_ACTIVITY_ID);
}
मुझे इस कोड के साथ कोई त्रुटि नहीं है, लेकिन नई गतिविधि ठीक से लोड नहीं होती है। इस तरह मुझे केवल एक ब्लैंक स्क्रीन मिलती है।
लेकिन यदि मैं देरी के साथ नई गतिविधि को कॉल करता हूं, तो सब कुछ ठीक काम करता है।
वहाँ एक गतिविधि लोड हो रहा है समाप्त होने की प्रतीक्षा के लिए किसी भी बेहतर तरीका है:
@Override
public void onCreate(Bundle savedInstanceState) {
dbg("starting on create");
super.onCreate(savedInstanceState);
dbg("stting content view");
setContentView(R.layout.main);
Thread splashTread = new Thread() {
@Override
public void run() {
try {
sleep(500);
} catch(InterruptedException e) {
} finally {
createDrPopup();
}
}
};
splashTread.start();
}
private void createDrPopup(){
dbg("created new activity");
startActivityForResult(new Intent(this, DrPopup.class),
DR_POPUP_ACTIVITY_ID);
}
मेरे सवाल यह है। मैं यह भी सुनिश्चित नहीं कर सकता कि हर बार 500 एमएमएस पर्याप्त होगा।
किसी भी सुझाव के लिए धन्यवाद।
dr_popup के लिए कोड का अनुरोध किया
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
dbg("Created new activity");
setContentView(R.layout.dr_webview);
dbg("web view created");
}
और दोनों लेआउट
मुख्य
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<Button android:text="Button" android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
<Spinner android:layout_height="wrap_content" android:layout_weight="1" android:layout_width="wrap_content" android:id="@+id/spinner1"></Spinner>
</LinearLayout>
पॉपअप
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/dr_popup_webview_layout" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical">
<WebView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/dr_popup_webview" android:layout_width="fill_parent" android:layout_height="100dip"/>
<LinearLayout android:id="@+id/frameLayout1" android:layout_height="100dip" android:layout_width="fill_parent" android:orientation="horizontal">
<EditText android:id="@+id/dr_submit_text" android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_weight="4">
<requestFocus></requestFocus>
</EditText>
<Button android:text="Button" android:id="@+id/dr_submit_button" android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_weight="1"></Button>
</LinearLayout>
</LinearLayout>
संपादित (इस रूप में यह हो जाता है के रूप में सरल है): समस्या से ईएमएस प्रकट लाइन @Android की वजह से करने के लिए किया जा: शैली/Theme.Dialog
<activity android:theme="@android:style/Theme.Dialog"
android:name=".DrPopup"
android:label="@string/dr_popup">
</activity>
अगर मैं हटाने चीजें काम करने लगते हैं कि, है, लेकिन मैं एक समाधान है कि लाइन के साथ भी काम करेगा चाहते हैं।
और एक तस्वीर जो समस्या को दिखाती है। http://i.imgur.com/ZOcyw.png
हाय क्या आप DrPopup के लिए कोड भी प्रदान कर सकते हैं। – Deva
ठीक है, मुझे निश्चित रूप से पता नहीं है, लेकिन शायद गतिविधि प्रबंधक एक नई गतिविधि शुरू करने में संभाल नहीं सकता है जब कोई अन्य गतिविधि अभी भी क्रिएट() जीवन चक्र विधि में है। टाइमर ऑनक्रेट() को पूरा करने के लिए पर्याप्त समय की अनुमति देता है ... –
मैंने कोड और एक्सएमएल फाइलों को भी जोड़ा है, और मुझे जोड़ना चाहिए कि मैं एंड्रॉइड 1.5 – zidarsk8