2012-05-08 38 views
0

我有這樣的代碼:Android - 如何向我的應用發送意圖stoare崩潰?

Button give_review = (Button)findViewById(R.id.give_review); 
give_review.setOnClickListener(new Button.OnClickListener() 
{ 
    public void onClick(View v) 
    { 
     Intent intent = new Intent(Intent.ACTION_VIEW); 
     intent.setData(Uri.parse("market://details?id=com.problemio")); 
     startActivity(intent);     
    } 
}); 

和當按鈕被點擊後,系統崩潰某種原因。

我的應用程序的URL是這樣的:store/apps/details?id=com.problemio

和我的Class位於此目錄中:

src/com/problemio/content/MyClassNameActivity 

什麼可能導致崩潰?我在我的應用程序的其他部分使用此代碼,並且它可以工作,儘管其他類在src/com/problemio目錄內的一個目錄較低。

這裏是堆棧跟蹤:

android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=market://details?id=com.problemio } 
at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1512) 
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1384) 
at android.app.Activity.startActivityForResult(Activity.java:3190) 
at android.app.Activity.startActivity(Activity.java:3297) 
at com.problemio.content.BusinessIdeasActivity$5.onClick(BusinessIdeasActivity.java:105) 
at android.view.View.performClick(View.java:3511) 
at android.view.View$PerformClick.run(View.java:14105) 
at android.os.Handler.handleCallback(Handler.java:605) 
at android.os.Handler.dispatchMessage(Handler.java:92) 
at android.os.Looper.loop(Looper.java:137) 
at android.app.ActivityThread.main(ActivityThread.java:4424) 
at java.lang.reflect.Method.invokeNative(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:511) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551) 
at dalvik.system.NativeStart.main(Native Method) 

感謝您的建議, 亞歷

+0

和logcat輸出? –

+0

那麼不會有logcat輸出我猜是因爲在模擬器中沒有應用商店網址......對吧? – Genadinik

+0

與上面的代碼網址工作fine.did你嘗試設備?請上傳logcat輸出。 – Hassy31

回答

2

有沒有市場在模擬器,你找到一個ActivityNotFoundException這樣的:

05-07 22:20:46.702: E/AndroidRuntime(580): Caused by: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=market://details?id=com.problemio } 
05-07 22:20:46.702: E/AndroidRuntime(580): at ... 
05-07 22:20:46.702: E/AndroidRuntime(580): ... 11 more 

沒有其他Activity可以處理這個意圖。

+0

我在現場設備中得到這個:) – Genadinik

+0

適用於我的設備 –

+0

你試過我的應用程序在你的設備上? – Genadinik