在我的應用程序我m顯示列表中的Tabview,在一個選項卡時,我試圖啓動一個新的活動onclick列表視圖觸摸事件。我想在網頁視圖中開始一項新活動。錯誤開始新的活動
showNewsListView.setAdapter(listAdapter);
showNewsListView.setOnItemClickListener(new OnItemClickListener(){
public void onItemClick(AdapterView<?> arg0, View arg1, int position,
long arg3) {
Log.v("status ","tab on position"+position);
Intent myIntent = new Intent(BizTab.this, MainView.class);
startActivity(myIntent);
}
});
getUrlData(baseUrl);
}
,如果我跑這麼多的代碼的應用程序崩潰,所以我剛剛找到自己的解決方案,我應該在asyncrouniously開始一個新的活動所以現在即時通訊做這個
showNewsListView.setAdapter(listAdapter);
showNewsListView.setOnItemClickListener(new OnItemClickListener(){
public void onItemClick(AdapterView arg0, View arg1, int position, long arg3) { Log.v("status ","tab on position"+position);
new ShowFullNews().execute();
}
});
getUrlData(baseUrl);
}`
`showNewsListView.setAdapter(listAdapter);
showNewsListView.setOnItemClickListener(new OnItemClickListener(){
public void onItemClick(AdapterView<?> arg0, View arg1, int position,
long arg3) {
Log.v("status ","tab on position"+position);
new ShowFullNews().execute();
}
});
getUrlData(baseUrl);
}`
然後還我的代碼崩潰和不給錯誤只是給這兩個警告
如果我在兩個地方開始一個新的活動onTouch和後執行然後我的代碼是woking,但在這裏它首先顯示屏幕,然後它自動去刷新屏幕,這不看起來不錯。所以如何避免它。請幫我和plese忽略語法錯誤我的工作代碼是
public void onItemClick(AdapterView<?> arg0, View arg1, int position,
long arg3) {
Log.v("status ","tab on position"+position);
//set bundle to send data into other activity
b.putInt("total", 10);
b.putInt("position",position);
b.putStringArray("allurls", allsNewsUrls);
b.putString("returnname", "BizTab");
b.putString("footertext","Biz");
b.putInt("tabid", 3);
Intent myIntent = new Intent(BizTab.this, MainView.class);
myIntent.putExtras(b);
startActivity(myIntent);
new ShowFullNews().execute();
}
});
protected void onPostExecute(Long result) { try {
Intent myIntent2 = new Intent(BizTab.this, MainView.class);
startActivity(myIntent2);
} catch (Exception e) {
Log.v("error","error in starting new activity");
e.printStackTrace();
}
}`
日誌生成和我的應用程序正在自動關閉。
12-07 11:55:18.684: WARN/InputManagerService(72): Window already focused, ignoring focus gain of: [email protected]
12-07 11:55:20.792: VERBOSE/status(419): tab on position0
12-07 11:55:20.814: INFO/ActivityManager(72): Starting activity: Intent { cmp=org.nuvus/.MainView (has extras) }
12-07 11:55:20.872: DEBUG/PhoneWindow(419): couldn't save which view has focus because the focused view [email protected] has no id.
12-07 11:55:21.023: VERBOSE/status(419): mainView oncreate called
12-07 11:55:21.452: VERBOSE/status(419): onStartcalled
12-07 11:55:21.962: INFO/ActivityManager(72): Displayed activity org.nuvus/.MainView: 1072 ms (total 1072 ms)
12-07 11:55:22.082: INFO/AndroidRuntime(419): AndroidRuntime onExit calling exit(0)
12-07 11:55:22.173: INFO/ActivityManager(72): Process org.nuvus (pid 419) has died.
12-07 11:55:22.183: INFO/WindowManager(72): WIN DEATH: Window{43fe6f30 org.nuvus/org.nuvus.Main paused=true}
12-07 11:55:22.202: INFO/WindowManager(72): WIN DEATH: Window{440f9620 org.nuvus/org.nuvus.MainView paused=false}
12-07 11:55:22.283: INFO/UsageStats(72): Unexpected resume of com.android.launcher while already resumed in org.nuvus
12-07 11:55:22.303: WARN/InputManagerService(72): Got RemoteException sending setActive(false) notification to pid 419 uid 10032
請幫我...
你有沒有解決這個問題? – coder 2011-11-29 16:46:20