在我的应用上添加指向网站的链接错误

时间:2015-04-29 02:40:40

标签: android hyperlink

尝试在我的应用上添加twitter.com链接。当我点击关注我们链接时,应用程序会运行,但“不幸关闭”。

  

android.content.ActivityNotFoundException:无法找到显式   活动课   {com.holyapp.danshinn.wingman_etiquette / com.holyapp.danshinn.wingman_etiquette.Twitter};   你有没有在AndroidManifest.xml中声明这个活动?               在android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1541)               在android.app.Instrumentation.execStartActivity(Instrumentation.java:1416)               在android.app.Activity.startActivityForResult(Activity.java:3404)               在android.app.Activity.startActivityForResult(Activity.java:3354)               在com.holyapp.danshinn.wingman_etiquette.WingmanListActivity.twitter(WingmanListActivity.java:89)               在com.holyapp.danshinn.wingman_etiquette.WingmanListActivity.onOptionsItemSelected(WingmanListActivity.java:77)               在android.app.Activity.onMenuItemSelected(Activity.java:2570)

我可以看到错误的位置,但我不知道如何修复它。请帮忙。

这是错误指向

的代码
 @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {

            case R.id.action_refresh: {
                updateTipList();
                break;
            }

            case R.id.action_favorites: {
                showFavorites();
                break;
            }

            case R.id.action_new: {
                newTip();
                break;
            }
            case R.id.twitter: {
                twitter();
                break;
                }
            }



        return super.onOptionsItemSelected(item);
    }

    private void twitter() {
        Intent a = new Intent(this, Twitter.class);
        startActivityForResult(a, 0);

    }

1 个答案:

答案 0 :(得分:0)

android.content.ActivityNotFoundException: Unable to find explicit activity class {com.holyapp.danshinn.wingman_etiquette/com.holyapp.danshinn.wingman_etiquette.Twitter}; have you declared this activity in your AndroidManifest.xml?

您应该在AndroidManifest.xml文件中声明您的Twitter类。像这样:

<activity
    android:name="com.holyapp.danshinn.wingman_etiquette.Twitter"></activity>