本文介绍了机器人:showquickcontact()上的升级Froyo的伟大工程,而不是闪电,它抛出一个ActivityNotFound异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经做了很多谷歌上搜索过几天,我一直没能把这个问题解决了。我正在写一个应用程序和窗口小部件中,我想,当用户点击 ImageView的显示或其他视图元素通过调用快速联系人对话框 QuickContact.showQuickContact()。出于某种原因,每次我试图在埃克莱尔,我得到以下错误抛出:

I've done a lot of googling over the days and I haven't been able to get this problem solved. I'm writing an app and a widget in which I want the quick contact dialog displayed when the user clicks on an ImageView or some other view element by calling QuickContact.showQuickContact(). For some reason, every time I try on Eclair, I get the following error thrown:

01-02 17:51:28.869:ERROR / AndroidRuntime(657):  java.lang.RuntimeException的:无法启动的活动  ComponentInfo {com.sx.favwidget / com.sx.favwidget.PopupActivity}:  android.content.ActivityNotFoundException:无活动处理  意向{行为= com.android.contacts.action.QUICK_CONTACT  DAT =内容://com.android.contacts/contacts/lookup/0n4D29415739  FLG = 0x14200000(有额外)

(我离开了的logcat的休息,但我可以把它放回去,如果你们需要它)

(I left out the rest of the logcat, but I can put it back if you guys need it)

当我尝试升级Froyo完全相同的code,它只是工作。我不想让我的应用程序的目标只为Froyo的用户 - 我针对2.1的最低OS级别。我发现一些人对堆栈溢出挣扎着越来越QuickContacts显示。

When I try the exact same code on Froyo, it just works. I don't want to have my app targeted only for Froyo users - I'm targeting 2.1 as the minimum OS level. I've found some other people on Stack Overflow struggling with getting QuickContacts to display.

我可以用一个QuickContactBadge,而且确实在Eclair的工作,但我不会允许QuickContactBadge在AppWidget,所以我必须这样做,而不是。我挖通过Android的源$ C ​​$ c和发现相关的XML文件和$ C $下创建的布局,但我不能就这么轻易编译它自己,因为这是一个巨大的头痛与所有的私人API调用。

I could use a QuickContactBadge, and that does work on Eclair, but I'm not allowed a QuickContactBadge in an AppWidget, so I have do this instead. I dug through Android's source code and found the relevant XML files and code for creating the layout but I can't just easily compile it myself because it's a huge headache with all the private API calls.

下面是我的code。这很简单。

Here is my code. It's simple.

grid.setOnItemClickListener(new OnItemClickListener() {

    public void onItemClick(AdapterView<?> parent, View v, int position, long id) {

        String name = ((TextView)v.findViewById(R.id.grid_item_label)).getText().toString();

        Cursor sc = getContentResolver().query(Contacts.CONTENT_URI, new String[] {Contacts.LOOKUP_KEY,   Contacts._ID}, Contacts.DISPLAY_NAME + "= ?", new String[] {name}, null);

        sc.moveToFirst();          

        String lookup_key = sc.getString(sc.getColumnIndex(Contacts.LOOKUP_KEY));

        Uri uri = Uri.withAppendedPath(ContactsContract.Contacts.CONTENT_LOOKUP_URI, lookup_key);

        QuickContact.showQuickContact(getApplicationContext(), v, uri, QuickContact.MODE_SMALL, null);

        }
}

这只是这么奇怪的是,它可以在升级Froyo,不是巧克力慕斯蛋糕,但由于Android 2.0的API调用一直存在。任何人都可以帮助我在这里?

It's just so strange that it works on Froyo, not Eclair, but the API call has been there since Android 2.0. Can anyone help me here??

太感谢了!

推荐答案

我前一段时间解决了这个问题,以及,但忘了后怎么样。我所做的就是启动那是透明的一个新的活动,我从它的意图推出的矩形。本次活动只有一个QuickContactBadge元素,所以我定位是使用矩形,并在其上​​自动执行点击动作。一旦被显示出来,我完成了该活动 - 但徽章仍然存在。因此,当人点击了QuickContactBadge,他们会是右后卫,他们开始了。

I solved this as well some time ago but forgot to post how. What I did was launch a new activity that was transparent, and I got the rectangle from which the intent was launched. This activity had only a QuickContactBadge element, so I positioned it using the rectangle and performed a click action automatically on it. Once this was displayed, I finished the activity - but the badge remains. Therefore, when the person clicked out of the QuickContactBadge, they'd be right back to where they started.

我没能有机会下彻底地细读你的(OMEGAMON)$ C $ - ?是你的方法类似地雷

I didn't get a chance to peruse your (Omegamon) code thoroughly - is your method similar to mine?

这篇关于机器人:showquickcontact()上的升级Froyo的伟大工程,而不是闪电,它抛出一个ActivityNotFound异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-01 11:47