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

setColor NullPointException #1

Closed
serkandyck opened this issue Dec 13, 2015 · 7 comments
Closed

setColor NullPointException #1

serkandyck opened this issue Dec 13, 2015 · 7 comments

Comments

@serkandyck
Copy link

if i Set Fragment Return
java.lang.IllegalArgumentException: width and height must be > 0

Main Activity Return NullpointException All other cutomization code works setColor Getting error only

@lopspower
Copy link
Owner

It's possible to show your implementation of that?
I think setColor work well because the sample demo app use this.

You need to used setColor with color integer this way :
int color = Color.RED;
or
int color = Color.parseColor("#00ff00")
and
circularFillableLoaders.setColor(color);

@serkandyck
Copy link
Author

@Bind(R.id.loaderCpu)
CircularFillableLoaders  loaderCpu;

@Bind(R.id.loaderRam)
CircularFillableLoaders loaderRam;

@Bind(R.id.loaderSd)
CircularFillableLoaders loaderSd;

private void fillData() {

    long l = AppUtil.getAvailMemory(mContext);
    long y = AppUtil.getTotalMemory(mContext);
    final double x = (((y - l) / (double) y) * 100);
    loaderSd.setProgress((int) x);

    SDCardInfo mSDCardInfo = StorageUtil.getSDCardInfo();
    SDCardInfo mSystemInfo = StorageUtil.getSystemSpaceInfo(mContext);

    long nAvailaBlock;
    long TotalBlocks;
    if (mSDCardInfo != null) {
        nAvailaBlock = mSDCardInfo.free + mSystemInfo.free;
        TotalBlocks = mSDCardInfo.total + mSystemInfo.total;
    } else {
        nAvailaBlock = mSystemInfo.free;
        TotalBlocks = mSystemInfo.total;
    }

    final double percentStore = (((TotalBlocks - nAvailaBlock) / (double) TotalBlocks) * 100);


    capacity.setText(StorageUtil.convertStorage(TotalBlocks - nAvailaBlock) + "/" + StorageUtil.convertStorage(TotalBlocks));
    ram.setText(getUsageMemory() + "/" + getTotalRAM());
    loaderRam.setProgress((int) percentStore);
    loaderCpu.setColor(color);

Can i use all customization border, amplitude, progress but color get java.lang.IllegalArgumentException: width and height must be > 0

@serkandyck
Copy link
Author

at com.mikhaellopez.circularfillableloaders.CircularFillableLoaders.updateWaveShader(CircularFillableLoaders.java:196)
at com.mikhaellopez.circularfillableloaders.CircularFillableLoaders.setColor(CircularFillableLoaders.java:306)
at com.androidcleaner.rambooster.fragment.MainFragment.fillData(MainFragment.java:124)
at com.androidcleaner.rambooster.fragment.MainFragment.onResume(MainFragment.java:80)

Maybe, Problem on Butterknife

@serkandyck
Copy link
Author

if i put only <com.mikhaellopez.circularfillableloaders.CircularFillableLoaders and not any customization java code. Only XML Screenshot: http://prntscr.com/9dqll7 This Fragment Layout.

@serkandyck
Copy link
Author

Problem on executing Code early and view's layout has not yet been measured by Android. i set timer and problem fixed. Sorry

@lopspower
Copy link
Owner

Cool, the goal is that you are a solution 👍

@kiaanpillay
Copy link

I'm having the exact same issue. Please elaborate on how to fix

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