Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

使用xutils3的injectView注入获取控件,on a null object reference #49

Closed
Kerwin92 opened this issue Apr 22, 2016 · 7 comments
Closed

Comments

@Kerwin92
Copy link

获取SwipeToLoadLayout的内部及自身控件,比如com.aspsine.swipetoloadlayout.SwipeToLoadLayout,RecyclerView等都会null

@Aspsine
Copy link
Owner

Aspsine commented Apr 22, 2016

you must use specified ids
please look over step 3 in the link below
https://github.com/Aspsine/SwipeToLoadLayout/wiki/Quick-Setup

<?xml version="1.0" encoding="utf-8"?>
<com.aspsine.swipetoloadlayout.SwipeToLoadLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/swipeToLoadLayout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.aspsine.swipetoloadlayoutdemo.MainActivity">

    <com.aspsine.swipetoloadlayoutdemo.RefreshHeaderView
        android:id="@id/swipe_refresh_header"
        android:layout_width="match_parent"
        android:gravity="center"
        android:layout_height="100dp" />

    <ListView
        android:id="@id/swipe_target"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

    <com.aspsine.swipetoloadlayoutdemo.LoadMoreFooterView
        android:id="@id/swipe_load_more_footer"
        android:layout_width="match_parent"
        android:gravity="center"
        android:layout_height="100dp" />

</com.aspsine.swipetoloadlayout.SwipeToLoadLayout>
  • refresh header view
    android:id="@id/swipe_refresh_header"
  • target view
    android:id="@id/swipe_target"
  • load more footer view
    android:id="@id/swipe_load_more_footer"

also see #45

@Kerwin92
Copy link
Author

@Aspsine thanks ,you are really appreciated
I have seen #45 and checked my SwipeToLoadLayout and RefreshHeaderView ,I just copied the code from sample.
They run right with "findviewbyid" ,but "on a null object reference" when used with xUtils
@ViewInject(R.id.swipeToLoadLayout)

@Aspsine
Copy link
Owner

Aspsine commented Apr 23, 2016

It's maybe a bug of XUtils. I'm not sure.

@Aspsine Aspsine closed this as completed Apr 23, 2016
@Kerwin92
Copy link
Author

@Aspsine
ok tks

@bruce3x
Copy link

bruce3x commented Dec 27, 2016

@Aspsine Please highlight these view ids in Quick-Setup.

refresh header view
android:id="@id/swipe_refresh_header"
target view
android:id="@id/swipe_target"
load more footer view
android:id="@id/swipe_load_more_footer"

@Aspsine
Copy link
Owner

Aspsine commented Dec 27, 2016

@BruceZZ Added.

@bruce3x
Copy link

bruce3x commented Dec 28, 2016

@Aspsine Thanks for your nice library 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants