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
java.lang.IllegalArgumentException: width and height must be > 0 #351
Comments
I tried thinking of a way to get the chart added once things have been fully inflated and have their dimensions set. Unfortunately, I think I'm misunderstanding something pretty crucial to getting these charts to work. I managed to create a menu item on the @Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == R.id.action_add_chart) {
initializeChartObjects();
return true;
}
return super.onOptionsItemSelected(item);
} public void initializeChartObjects() {
LinearLayout linearLayout = (LinearLayout) getActivity().findViewById(R.id.fragment_sensor_linear_layout);
mChart = new LineChart(getActivity());
ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT);
mChart.setLayoutParams(params);
linearLayout.addView(mChart);
// mChart = (LineChart) getActivity().findViewById(R.id.chart);
int valueCountForSensor = Utility.getValueCountForSensor(mSensor.getType());
mVals = new ArrayList<ArrayList<Entry>>(valueCountForSensor);
for (int i = 0; i < valueCountForSensor; i++) {
mVals.add(new ArrayList<Entry>());
}
} |
Wait a minute, why was this closed? |
Because the bug was fixed, but is not releasesd yet. |
Hello,
I've noticed that this same exception has happened to a few before me. But the ones with reproducible solutions have not provided the same success for me, unfortunately.
Here is my fragment layout:
... and the parent activity's layout:
In the SensorsActivity.java class, I
@Override
several methods, two of which handle the creation and inflation of the fragment, differently, depending on the size of the device:I'm not sure what I need to do to avoid this exception when the bitmap is being created. The rest of this issue report is my exception trace. I appreciate any and all help! Thanks!
The text was updated successfully, but these errors were encountered: