2010-10-29 37 views
0

請幫我 在我的項目時,即時通訊開始新的活動導致崩潰概率在開始新的活動

public void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    setContentView(R.layout.shortnews); 
    showNewsListView = (ListView)findViewById(R.id.shortnewslistview); 
    ShortNewsListAdapter listAdapter = new ShortNewsListAdapter(this); 
    showNewsListView.setAdapter(listAdapter); 
    showNewsListView.setOnItemClickListener(new OnItemClickListener(){ 

    public void onItemClick(AdapterView<?> arg0, View arg1, int position, 
    long arg3) { 
    newspostion = position; 
    Log.v("status ","tab on position"+position); 
     //showProgressDialog(true); 
    try { 
    Intent myIntent = new Intent(FirstTab.this, NewsWebView.class); 
    FirstTab.this.startActivity(myIntent); 

    } catch (Exception e) { 
    Log.v("error","error in starting new activity"); 
    e.printStackTrace(); 
    } 

    } 
    }); 
    getUrlData(baseUrl); 
    } 

和IM增加這部分manifiest文件還

<activity android:name="NewsWebView" android:label="WebView"> 
      <intent-filter> 
       <action android:name="android.intent.action.MAIN" /> 
       <category android:name="android.intent.category.LAUNCHER" /> 
      </intent-filter> 
</activity> 

這是Web視圖我想展示

public void onCreate(Bundle icicle) { 
    super.onCreate(icicle); 

    setContentView(R.layout.webview); 

    final String mimeType = "text/html"; 
    final String encoding = "utf-8"; 

    WebView wv; 

    wv = (WebView) findViewById(R.id.wv1); 
    wv.loadData("www.gmail.com", mimeType, encoding); 

} 

日誌

10-29 13:10:15.784: VERBOSE/status(203): tab on position0 
10-29 13:10:15.784: INFO/ActivityManager(53): Starting activity: Intent { cmp=org.nuvus/.NewsWebView } 
10-29 13:10:15.814: DEBUG/PhoneWindow(203): couldn't save which view has focus because the focused view [email protected] has no id. 
10-29 13:10:16.764: INFO/ActivityManager(53): Displayed activity org.nuvus/.NewsWebView: 925 ms (total 925 ms) 
10-29 13:10:16.794: INFO/AndroidRuntime(203): AndroidRuntime onExit calling exit(0) 
10-29 13:10:16.904: INFO/ActivityManager(53): Process org.nuvus (pid 203) has died. 
10-29 13:10:16.924: INFO/WindowManager(53): WIN DEATH: Window{438425d8 org.nuvus/org.nuvus.Main paused=true} 
10-29 13:10:16.924: INFO/WindowManager(53): WIN DEATH: Window{438e15c8 org.nuvus/org.nuvus.NewsWebView paused=false} 
10-29 13:10:17.064: WARN/UsageStats(53): Unexpected resume of com.android.launcher while already resumed in org.nuvus 
10-29 13:10:17.144: WARN/InputManagerService(53): Got RemoteException sending setActive(false) notification to pid 203 uid 10027 
10-29 13:13:45.264: DEBUG/dalvikvm(102): GC freed 7488 objects/406792 bytes in 313ms 
10-29 13:10:16.794: INFO/AndroidRuntime(203): AndroidRuntime onExit calling exit(0) 
+0

是你在你的應用程序中使用TabHost – 2010-10-29 08:23:43

+0

是的即時通訊使用TabHost和我希望如果我點擊在標籤即時通訊顯示列表視圖和列表視圖我想要顯示webview – neeraj 2010-10-29 08:31:43

回答

0

上面的代碼太混亂了。無法正確理解。 您必須提及您嘗試在Manifest.xml中打開的新活動。所以首先檢查一下你有沒有提到它?

+0

編輯(至少有點)爲你,如果你仍然想回答它。但留意日期,差不多一年了。 – 2011-09-21 20:27:27