我正在按照步骤从linkedin中获取数据.但我得到了错误:
04-25 15:19:09.516 3078-3078 / app.plusconnect.com.linkedindummy E / AndroidRuntime:致命异常:主要
androID.content.res.Resources $NotFoundException:资源ID#0x0
public class MainActivity extends ActionBaractivity {//declarationSocialAuthAdapter adapter;button linkedin_button;@OverrIDeprotected 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 one rror(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 one rror(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 0x0000000004-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: mainandroID.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.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都需要可绘制文件夹中的图像.
您可能没有这些图像,并且在尝试加载图像时,SocialAuth会崩溃.要解决此问题,只需将要使用的每个服务的图像(例如linkedin.png、twitter.png、facebook.png)放入可绘制文件夹中.
总结以上是内存溢出为你收集整理的android.content.res.Resources $NotFoundException:资源ID#0x0全部内容,希望文章能够帮你解决android.content.res.Resources $NotFoundException:资源ID#0x0所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)