- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我正在按照步骤从 Linkedin 获取数据。但是我收到错误:
04-25 15:19:09.516 3078-3078/app.plusconnect.com.linkedindummy E/AndroidRuntime:致命异常:main android.content.res.Resources$NotFoundException: 资源 ID #0x0
public class MainActivity extends ActionBarActivity {
//declaration
SocialAuthAdapter adapter;
Button linkedin_button;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
adapter = new SocialAuthAdapter(new ResponseListener());
linkedin_button = (Button)findViewById(R.id.SubmitButton);
linkedin_button.setBackgroundResource(R.mipmap.linkedin);
linkedin_button.setOnClickListener(new View.OnClickListener()
{
public void onClick(View v)
{
adapter.authorize(MainActivity.this, Provider.LINKEDIN);
}
});
}
public class ResponseListener implements DialogListener {
@Override
public void onComplete(Bundle bundle) {
adapter.getUserProfileAsync(new ProfileDataListener());
}
@Override
public void onError(SocialAuthError socialAuthError) {
}
@Override
public void onCancel() {
}
@Override
public void onBack() {
}
}
public class ProfileDataListener implements SocialAuthListener<Profile> {
@Override
public void onExecute(String s, Profile profile) {
Log.d("Custom-UI", "Receiving Data");
Profile profileMap = profile;
Log.d("Custom-UI", "Validate ID = " + profileMap.getValidatedId());
Log.d("Custom-UI", "First Name = " + profileMap.getFirstName());
Log.d("Custom-UI", "Last Name = " + profileMap.getLastName());
Log.d("Custom-UI", "Email = " + profileMap.getEmail());
Log.d("Custom-UI", "Country = " + profileMap.getCountry());
Log.d("Custom-UI", "Language = " + profileMap.getLanguage());
Log.d("Custom-UI", "Location = " + profileMap.getLocation());
Log.d("Custom-UI", "Profile Image URL = " + profileMap.getProfileImageURL());
}
@Override
public void onError(SocialAuthError socialAuthError) {
}
}
}
这是布局文件
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity">
<TextView
android:id="@+id/textMessage"
android:padding="20dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:text="Test Connect application like to fetch Profile details from LinkedIn Account."/>
<!-- Submit button -->
<Button
android:id="@+id/SubmitButton"
android:layout_width="200dp"
android:layout_height="40dp"
android:layout_marginBottom="20dp"
android:background="@android:color/holo_blue_dark"
android:text="Fetch from LinkedIn"
android:textColor="@android:color/white"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"/>
我在 logcat 中收到以下错误:
04-25 15:19:09.456 3078-3078/app.plusconnect.com.linkedindummy W/ResourceType﹕ No package identifier when getting value for resource number 0x00000000
04-25 15:19:09.477 3078-3078/app.plusconnect.com.linkedindummy W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0x409c01f8)
04-25 15:19:09.516 3078-3078/app.plusconnect.com.linkedindummy E/AndroidRuntime﹕ FATAL EXCEPTION: main
android.content.res.Resources$NotFoundException: Resource ID #0x0
at android.content.res.Resources.getValue(Resources.java:1018)
at android.content.res.Resources.getDrawable(Resources.java:663)
at org.brickred.socialauth.android.SocialAuthDialog.setUpTitle(SocialAuthDialog.java:191)
at org.brickred.socialauth.android.SocialAuthDialog.onCreate(SocialAuthDialog.java:146)
at android.app.Dialog.dispatchOnCreate(Dialog.java:353)
at android.app.Dialog.show(Dialog.java:257)
at org.brickred.socialauth.android.SocialAuthAdapter$4$1.run(SocialAuthAdapter.java:649)
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)
问题出在哪里?有人可以帮忙吗?
最佳答案
SocialAuth
需要在 drawable
文件夹中为您要集成的每个服务提供一个图像。
您可能没有这些图片,SocialAuth
在尝试加载图片时崩溃。要解决此问题,只需将您要使用的每项服务的图像(例如 linkedin.png、twitter.png、facebook.png)放入 drawable
文件夹。
关于安卓.content.res.Resources$NotFoundException : Resource ID #0x0,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29863719/
什么是 SASS 方法要求干燥这样的东西: .content p, .content ul, .content li, .content a 最佳答案 这 4 个元素都有共同的样式吗? .conten
我正在评估 Contentful.com 作为 Angular SPA 的内容引擎。 我面临的问题是按内容类型检索条目(例如,获取“博客”类型的所有条目)。如 documentation exampl
在我编辑的主 wiki 上有一个名为 Item: 的自定义命名空间,提示是该命名空间内的每个页面都显示为 Item:This_item - - Item:That_item -- Item:Foo_i
我正在尝试编写一个Python脚本,可以将图片和pdf上传到WordPress。我希望图像上传到文件夹‘/wp-Content/Uploads/’,将pdf文件上传到文件夹‘/wp-Content/U
是否可以监控进行了多少次 Contentful API 调用,并理想地在即将超过配额时收到通知? 谢谢 最佳答案 当然,您可以在右侧用户配置文件的下拉菜单 > Organizations and Bi
我在尝试在 IE8 中下载带有分号的文件名时遇到问题。 Response.AddHeader("Content-Disposition", "attachment; filename=\"" + at
我在 Contentful Delivery API 中运行查询以返回基于它的 slug 的特定页面项目。这个查询还设置了语言环境,以便它只返回我需要呈现的语言的数据。 但是,我还需要设置页面的 hr
我有兴趣使用 Gatsby建一个Netlify使用来自 Contentful 的内容的静态网站 Netlify 有这个不错的 Gatsby 入门指南: https://www.netlify.com/
目标是提交一个 git 分支。分支的“git status”的输出是: On branch zeromq_new Your branch is up to date with 'origin/zero
我目前正在学习在 ASP.NET 3.5 和 C# 中使用 MasterPages 和 ContentPlaceHolders - 现在,我正在拼命尝试通过我的编程代码编辑 asp:Content-C
很难说出这里要问什么。这个问题模棱两可、含糊不清、不完整、过于宽泛或夸夸其谈,无法以目前的形式得到合理的回答。如需帮助澄清此问题以便重新打开,visit the help center . 关闭 1
我使用 bootstrap 3 作为我的网格框架和 CSS 来创建一个具有一个倾斜/倾斜边缘的半透明区域,但由于分层不透明度,我的元素遇到了问题。 期望是中心是倾斜的,但右侧仍然是正方形。 有没有更好
IllegalArgumentException: 未知 URL 内容:// ^ 对上述内容做了噩梦。我检查了我的变量和路径,但看不出问题是什么?非常感谢任何指点! 这是我的痕迹。 java.lan
我有两个元素:一个是 元素,另一个是 元素。 populated-drop-down extends drop-down ,但是,正如您可能已经猜到的那样,它会尝试使用一些选项预先填充它。假设我可以简
我想我也有同样的问题。 Using multiple yields to insert content 我尝试了这个解决方案。我试过 在我的 application.html.erb 中有 conte
此链接 ( https://css-tricks.com/snippets/css/a-guide-to-flexbox/ ) 表示 justify-content 和 align-content 的
我现在正在探索绑定(bind),并且有一个 NSPopUpButton - 它为我提供了一些值选择下的绑定(bind)选项 - Content , Content Objects , Content
正在尝试在内容页面中加载内容 View 。当我运行代码时,它不会出现在我的内容 View 中。我正在从我的内容页面分配两个可绑定(bind)参数。 内容页面: 内容 View :
我想从我的 :before 标签中获取 content。我知道有些人会说它不是真正的(伪)元素,但在 JS 中有一种方法,但有人可以帮助我在 JQ 中做到这一点,因为我有多个标签并且我想用 $.eac
我创建了一个.sh脚本,并将结果记录在一个文件中,执行后我会尝试将文件内容作为mail正文发送。 这是我运行的命令: sh update.sh >> update.$(date +"%Y-%m-%d:
我是一名优秀的程序员,十分优秀!