2014-01-24 27 views
-1

我想篩選任務以顯示用戶在複選框中選擇的內容,但是當我運行此代碼時出現錯誤。 這是過濾器活動中的功能如何篩選活動中的listView

enter code here 
protected void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    setContentView(R.layout.activity_filter); 
    INITIALIZE(); 
    DONE(); 
} 

public void INITIALIZE() 
    { 

Go=(Button)findViewById(R.id.go); 
ProH=(CheckBox)findViewById(R.id.pro1); 
ProM=(CheckBox)findViewById(R.id.pro2); 
ProL=(CheckBox)findViewById(R.id.pro3); 
Finished=(CheckBox)findViewById(R.id.finished); 
NotFinished=(CheckBox)findViewById(R.id.notfinished); 
Past=(CheckBox)findViewById(R.id.past); 
Future=(CheckBox)findViewById(R.id.future); 

} 
public void DONE() 
{ 
final AlertDialog.Builder alertbox = new AlertDialog.Builder(this); 
Go.setOnClickListener(new View.OnClickListener() { 

    @Override 
    public void onClick(View arg0) { 
     // TODO Auto-generated method stub 

     if((proH==1&&proM==1)||(proM==1&&proL==1)||(proH==1&&proL==1)) 
     { 
      alertbox.setTitle("Error!"); 
      alertbox.setMessage("Please Choose one Priority"); 
      alertbox.setNeutralButton("ok",new DialogInterface.OnClickListener() { 
       @Override 
       public void onClick(DialogInterface dialog, int which) { 
        // TODO Auto-generated method stub 
       } 
      }); 
      alertbox.show(); 
      ProH.setChecked(false); 
      ProM.setChecked(false); 
      ProL.setChecked(false); 
     } 
    } 
});}} 

這是什麼錯誤?

+0

你應該分享你看到的錯誤。 logcat說什麼? – Matt

+0

01-24 21:51:33.931:E/AndroidRuntime(309):致命例外:main 01-24 21:51:33.931:E/AndroidRuntime(309):android.content.ActivityNotFoundException:找不到處理Intent的活動{act = com.example.todolist.FILTER} 01-24 21:51:33.931:E/AndroidRuntime(309):\t at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1408) 01-24 21: 51:33.931:E/AndroidRuntime(309):\t at android.app.Instrumentation.execStartActivity(Instrumentation.java:1378) 01-24 21:51:33.931:E/AndroidRuntime(309):\t at android.app。 Activity.startActivityForResult(Activity.java:2817) – user3190285

+0

這是錯誤的一部分,但是當我點擊l主要活動中的過濾按鈕來打開這個活動時,它就退出 – user3190285

回答

0

根據評論中的錯誤判斷,問題在於您使用的是未被任何意圖過濾器捕獲的Intent。

「無活動處理意向{行動= com.example.todolist.FILTER}」

修正你的意圖過濾器,或啓動您的FilterActivity不同的方式。

可以明確的東西推出活動,如

Intent intent = new Intent(context, FilterActivity.class); 
context.startActivity(intent); 

在哪裏「語境」可能是你的活動(本)

+0

如何以不同的方式啓動我的FilterActivity。 – user3190285

+0

這裏有一個很好的頁面來閱讀: http://developer.android.com/guide/components/intents-filters.html – Matt