Android : Unable to add window — token android.os.BinderProxy is not valid; is your activity running?
So I have an app which draws points on a custom imageview when we click the button 'Add Checkpoint'. Everytime a new point is added, two things happen -
1) A line is created joining the just added point and previous added point.
2) The line is divided into 'x' number of points, and the points are drawn over the line. (Look at the screenshot attached)
I basically pass a List to the custom imageview class from which I get the value of 'x'.

Now everytime the value of x exceeds let's say 70 or 80 (any high number), the app crashes and I get the following error -
Unable to add window -- token android.os.BinderProxy is not valid; is your activity running?
My activity is getting finished due to heavy UI operation. Any suggestions?
This is the function in my custom imageview which draws add the point to the List of points to be shown.
public void addMarker(float a, float b, Context ctx, List<SampleModel> mainList) {
DBHelperCSV helperCSV = new DBHelperCSV(ctx);
if (!mainList.isEmpty()) {
for (SampleModel m : mainList) {
System.out.println("Rushi : SSTList : " + m.sst);
}
}
int partsCount = mainList.size();
pointNumber = pointNumber + 1;
matrix.invert(inverse);
float pts = {
a + 45, b + 45
};
inverse.mapPoints(pts);
System.out.println("Rushi : Passed points :" + a + " " + b);
PointF mainPoint = new PointF(pts[0], pts[1]);
float mainSST = -999;
if (!mainList.isEmpty()) {
mainSST = Float.parseFloat(mainList.get(0).getSst());
}
PointModel mainPointModel = new PointModel(mainPoint, mainSST);
markers.add(mainPointModel);
PointF mainConvertedPoint = getConvertedPoint(mainPoint.x, mainPoint.y);
//
//pts[0] and pts[1] is the actual image point which is in markers list
System.out.println("Rushi : Mapped points :" + pts[0] + " " + pts[1]);
PointF convertedPoint = getConvertedPoint(pts[0], pts[1]);
System.out.println("Rushi : Converted points :" + convertedPoint.x + " " + convertedPoint.y);
convertedPoints.add(new PointModel(convertedPoint, mainSST));
invalidate();
Toast.makeText(ctx, "(" + convertedPoint.x + "," + convertedPoint.y + ")", Toast.LENGTH_SHORT).show();
if (markers.size() > 1) {
//Add partsCount-1 points between the markers.size() - 1 and markers.size() - 2
PointF justAddedPoint = markers.get(markers.size() - 1).point;
PointF previousPoint = markers.get(markers.size() - 2).point;
System.out.println("Divide : Previous point - " + "(" + previousPoint.x + "," + previousPoint.y + ")");
System.out.println("Divide : Just added point - " + "(" + justAddedPoint.x + "," + justAddedPoint.y + ")");
//Find d and d/n
if (partsCount > 2 && !((Activity)ctx).isFinishing()) {
double dist = Math.sqrt(((justAddedPoint.x - previousPoint.x) * (justAddedPoint.x - previousPoint.x)) + ((justAddedPoint.y - previousPoint.y) * (justAddedPoint.y - previousPoint.y)));
double tParts = partsCount - 1;
double dN = dist / tParts;
// new BackgroundWorker(ctx, dist, tParts - 1, dN, previousPoint, justAddedPoint, mainList).execute();
for (int i = 0; i < tParts - 1; i++) {
double m = (i + 1) * dN;
double n = dist - ((i + 1) * dN);
PointF point = new PointF();
double x = ((m * justAddedPoint.x + n * previousPoint.x) / dist);
double y = ((m * justAddedPoint.y + n * previousPoint.y) / dist);
point.set((float) x, (float) y);
//Map and add
float pts2 = {(float) x, (float) y};
inverse.mapPoints(pts2);
//Point and value
PointModel pointModel = new PointModel();
float sst = -999;
if (!mainList.isEmpty()) {
sst = Float.parseFloat(mainList.get(i + 1).getSst());
}
pointModel.setPoint(point);
pointModel.setSst(sst);
semiMarkers.add(pointModel);
convertedPoints.add(new PointModel(getConvertedPoint(point.x, point.y), sst));
System.out.println("Divide : Point " + (i + 1) + " - (" + point.x + "," + point.y + ")");
try {
Thread.sleep(4);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}
}
This is my onDraw() function -
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
origWidth = this.getDrawable().getIntrinsicWidth();
origLength = this.getDrawable().getIntrinsicHeight();
if (markers.size() > 1) {
for (int i = 0; i < markers.size() - 1; i++) {
paintLine.setColor(Color.WHITE);
float pts = {markers.get(i).point.x, markers.get(i).point.y, markers.get(i + 1).point.x, markers.get(i + 1).point.y};
matrix.mapPoints(pts);
canvas.drawLine(pts[0], pts[1], pts[2], pts[3], paintLine);
}
}
for (int i = 0; i < markers.size(); i++) {
float pts = {markers.get(i).point.x, markers.get(i).point.y};
float sst = markers.get(i).sst;
matrix.mapPoints(pts);
if (sst <= 0 && sst >= -80) {
paintMain.setColor(Color.RED);
} else if (sst <= -80 && sst >= -90) {
paintMain.setColor(Color.BLUE);
} else if (sst <= -90 && sst >= -100) {
paintMain.setColor(Color.YELLOW);
} else if (sst <= -100 && sst >= -110) {
paintMain.setColor(getResources().getColor(R.color.lightgreen));
} else if (sst <= -110 && sst >= -140) {
paintMain.setColor(Color.GREEN);
} else if (sst == -999) {
paintMain.setColor(Color.BLACK);
}
canvas.drawCircle(pts[0], pts[1], 22, paintMain);
}
for (int i = 0; i < semiMarkers.size(); i++) {
float pts = {semiMarkers.get(i).point.x, semiMarkers.get(i).point.y};
float sst = semiMarkers.get(i).sst;
matrix.mapPoints(pts);
if (sst <= 0 && sst >= -80) {
paintForSemi.setColor(Color.RED);
} else if (sst <= -80 && sst >= -90) {
paintForSemi.setColor(Color.BLUE);
} else if (sst <= -90 && sst >= -100) {
paintForSemi.setColor(Color.YELLOW);
} else if (sst <= -100 && sst >= -110) {
paintForSemi.setColor(getResources().getColor(R.color.lightgreen));
} else if (sst <= -110 && sst >= -140) {
paintForSemi.setColor(Color.GREEN);
} else if (sst == -999) {
paintForSemi.setColor(Color.BLACK);
}
canvas.drawCircle(pts[0], pts[1], 11, paintForSemi);
}
}
add a comment |
So I have an app which draws points on a custom imageview when we click the button 'Add Checkpoint'. Everytime a new point is added, two things happen -
1) A line is created joining the just added point and previous added point.
2) The line is divided into 'x' number of points, and the points are drawn over the line. (Look at the screenshot attached)
I basically pass a List to the custom imageview class from which I get the value of 'x'.

Now everytime the value of x exceeds let's say 70 or 80 (any high number), the app crashes and I get the following error -
Unable to add window -- token android.os.BinderProxy is not valid; is your activity running?
My activity is getting finished due to heavy UI operation. Any suggestions?
This is the function in my custom imageview which draws add the point to the List of points to be shown.
public void addMarker(float a, float b, Context ctx, List<SampleModel> mainList) {
DBHelperCSV helperCSV = new DBHelperCSV(ctx);
if (!mainList.isEmpty()) {
for (SampleModel m : mainList) {
System.out.println("Rushi : SSTList : " + m.sst);
}
}
int partsCount = mainList.size();
pointNumber = pointNumber + 1;
matrix.invert(inverse);
float pts = {
a + 45, b + 45
};
inverse.mapPoints(pts);
System.out.println("Rushi : Passed points :" + a + " " + b);
PointF mainPoint = new PointF(pts[0], pts[1]);
float mainSST = -999;
if (!mainList.isEmpty()) {
mainSST = Float.parseFloat(mainList.get(0).getSst());
}
PointModel mainPointModel = new PointModel(mainPoint, mainSST);
markers.add(mainPointModel);
PointF mainConvertedPoint = getConvertedPoint(mainPoint.x, mainPoint.y);
//
//pts[0] and pts[1] is the actual image point which is in markers list
System.out.println("Rushi : Mapped points :" + pts[0] + " " + pts[1]);
PointF convertedPoint = getConvertedPoint(pts[0], pts[1]);
System.out.println("Rushi : Converted points :" + convertedPoint.x + " " + convertedPoint.y);
convertedPoints.add(new PointModel(convertedPoint, mainSST));
invalidate();
Toast.makeText(ctx, "(" + convertedPoint.x + "," + convertedPoint.y + ")", Toast.LENGTH_SHORT).show();
if (markers.size() > 1) {
//Add partsCount-1 points between the markers.size() - 1 and markers.size() - 2
PointF justAddedPoint = markers.get(markers.size() - 1).point;
PointF previousPoint = markers.get(markers.size() - 2).point;
System.out.println("Divide : Previous point - " + "(" + previousPoint.x + "," + previousPoint.y + ")");
System.out.println("Divide : Just added point - " + "(" + justAddedPoint.x + "," + justAddedPoint.y + ")");
//Find d and d/n
if (partsCount > 2 && !((Activity)ctx).isFinishing()) {
double dist = Math.sqrt(((justAddedPoint.x - previousPoint.x) * (justAddedPoint.x - previousPoint.x)) + ((justAddedPoint.y - previousPoint.y) * (justAddedPoint.y - previousPoint.y)));
double tParts = partsCount - 1;
double dN = dist / tParts;
// new BackgroundWorker(ctx, dist, tParts - 1, dN, previousPoint, justAddedPoint, mainList).execute();
for (int i = 0; i < tParts - 1; i++) {
double m = (i + 1) * dN;
double n = dist - ((i + 1) * dN);
PointF point = new PointF();
double x = ((m * justAddedPoint.x + n * previousPoint.x) / dist);
double y = ((m * justAddedPoint.y + n * previousPoint.y) / dist);
point.set((float) x, (float) y);
//Map and add
float pts2 = {(float) x, (float) y};
inverse.mapPoints(pts2);
//Point and value
PointModel pointModel = new PointModel();
float sst = -999;
if (!mainList.isEmpty()) {
sst = Float.parseFloat(mainList.get(i + 1).getSst());
}
pointModel.setPoint(point);
pointModel.setSst(sst);
semiMarkers.add(pointModel);
convertedPoints.add(new PointModel(getConvertedPoint(point.x, point.y), sst));
System.out.println("Divide : Point " + (i + 1) + " - (" + point.x + "," + point.y + ")");
try {
Thread.sleep(4);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}
}
This is my onDraw() function -
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
origWidth = this.getDrawable().getIntrinsicWidth();
origLength = this.getDrawable().getIntrinsicHeight();
if (markers.size() > 1) {
for (int i = 0; i < markers.size() - 1; i++) {
paintLine.setColor(Color.WHITE);
float pts = {markers.get(i).point.x, markers.get(i).point.y, markers.get(i + 1).point.x, markers.get(i + 1).point.y};
matrix.mapPoints(pts);
canvas.drawLine(pts[0], pts[1], pts[2], pts[3], paintLine);
}
}
for (int i = 0; i < markers.size(); i++) {
float pts = {markers.get(i).point.x, markers.get(i).point.y};
float sst = markers.get(i).sst;
matrix.mapPoints(pts);
if (sst <= 0 && sst >= -80) {
paintMain.setColor(Color.RED);
} else if (sst <= -80 && sst >= -90) {
paintMain.setColor(Color.BLUE);
} else if (sst <= -90 && sst >= -100) {
paintMain.setColor(Color.YELLOW);
} else if (sst <= -100 && sst >= -110) {
paintMain.setColor(getResources().getColor(R.color.lightgreen));
} else if (sst <= -110 && sst >= -140) {
paintMain.setColor(Color.GREEN);
} else if (sst == -999) {
paintMain.setColor(Color.BLACK);
}
canvas.drawCircle(pts[0], pts[1], 22, paintMain);
}
for (int i = 0; i < semiMarkers.size(); i++) {
float pts = {semiMarkers.get(i).point.x, semiMarkers.get(i).point.y};
float sst = semiMarkers.get(i).sst;
matrix.mapPoints(pts);
if (sst <= 0 && sst >= -80) {
paintForSemi.setColor(Color.RED);
} else if (sst <= -80 && sst >= -90) {
paintForSemi.setColor(Color.BLUE);
} else if (sst <= -90 && sst >= -100) {
paintForSemi.setColor(Color.YELLOW);
} else if (sst <= -100 && sst >= -110) {
paintForSemi.setColor(getResources().getColor(R.color.lightgreen));
} else if (sst <= -110 && sst >= -140) {
paintForSemi.setColor(Color.GREEN);
} else if (sst == -999) {
paintForSemi.setColor(Color.BLACK);
}
canvas.drawCircle(pts[0], pts[1], 11, paintForSemi);
}
}
add a comment |
So I have an app which draws points on a custom imageview when we click the button 'Add Checkpoint'. Everytime a new point is added, two things happen -
1) A line is created joining the just added point and previous added point.
2) The line is divided into 'x' number of points, and the points are drawn over the line. (Look at the screenshot attached)
I basically pass a List to the custom imageview class from which I get the value of 'x'.

Now everytime the value of x exceeds let's say 70 or 80 (any high number), the app crashes and I get the following error -
Unable to add window -- token android.os.BinderProxy is not valid; is your activity running?
My activity is getting finished due to heavy UI operation. Any suggestions?
This is the function in my custom imageview which draws add the point to the List of points to be shown.
public void addMarker(float a, float b, Context ctx, List<SampleModel> mainList) {
DBHelperCSV helperCSV = new DBHelperCSV(ctx);
if (!mainList.isEmpty()) {
for (SampleModel m : mainList) {
System.out.println("Rushi : SSTList : " + m.sst);
}
}
int partsCount = mainList.size();
pointNumber = pointNumber + 1;
matrix.invert(inverse);
float pts = {
a + 45, b + 45
};
inverse.mapPoints(pts);
System.out.println("Rushi : Passed points :" + a + " " + b);
PointF mainPoint = new PointF(pts[0], pts[1]);
float mainSST = -999;
if (!mainList.isEmpty()) {
mainSST = Float.parseFloat(mainList.get(0).getSst());
}
PointModel mainPointModel = new PointModel(mainPoint, mainSST);
markers.add(mainPointModel);
PointF mainConvertedPoint = getConvertedPoint(mainPoint.x, mainPoint.y);
//
//pts[0] and pts[1] is the actual image point which is in markers list
System.out.println("Rushi : Mapped points :" + pts[0] + " " + pts[1]);
PointF convertedPoint = getConvertedPoint(pts[0], pts[1]);
System.out.println("Rushi : Converted points :" + convertedPoint.x + " " + convertedPoint.y);
convertedPoints.add(new PointModel(convertedPoint, mainSST));
invalidate();
Toast.makeText(ctx, "(" + convertedPoint.x + "," + convertedPoint.y + ")", Toast.LENGTH_SHORT).show();
if (markers.size() > 1) {
//Add partsCount-1 points between the markers.size() - 1 and markers.size() - 2
PointF justAddedPoint = markers.get(markers.size() - 1).point;
PointF previousPoint = markers.get(markers.size() - 2).point;
System.out.println("Divide : Previous point - " + "(" + previousPoint.x + "," + previousPoint.y + ")");
System.out.println("Divide : Just added point - " + "(" + justAddedPoint.x + "," + justAddedPoint.y + ")");
//Find d and d/n
if (partsCount > 2 && !((Activity)ctx).isFinishing()) {
double dist = Math.sqrt(((justAddedPoint.x - previousPoint.x) * (justAddedPoint.x - previousPoint.x)) + ((justAddedPoint.y - previousPoint.y) * (justAddedPoint.y - previousPoint.y)));
double tParts = partsCount - 1;
double dN = dist / tParts;
// new BackgroundWorker(ctx, dist, tParts - 1, dN, previousPoint, justAddedPoint, mainList).execute();
for (int i = 0; i < tParts - 1; i++) {
double m = (i + 1) * dN;
double n = dist - ((i + 1) * dN);
PointF point = new PointF();
double x = ((m * justAddedPoint.x + n * previousPoint.x) / dist);
double y = ((m * justAddedPoint.y + n * previousPoint.y) / dist);
point.set((float) x, (float) y);
//Map and add
float pts2 = {(float) x, (float) y};
inverse.mapPoints(pts2);
//Point and value
PointModel pointModel = new PointModel();
float sst = -999;
if (!mainList.isEmpty()) {
sst = Float.parseFloat(mainList.get(i + 1).getSst());
}
pointModel.setPoint(point);
pointModel.setSst(sst);
semiMarkers.add(pointModel);
convertedPoints.add(new PointModel(getConvertedPoint(point.x, point.y), sst));
System.out.println("Divide : Point " + (i + 1) + " - (" + point.x + "," + point.y + ")");
try {
Thread.sleep(4);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}
}
This is my onDraw() function -
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
origWidth = this.getDrawable().getIntrinsicWidth();
origLength = this.getDrawable().getIntrinsicHeight();
if (markers.size() > 1) {
for (int i = 0; i < markers.size() - 1; i++) {
paintLine.setColor(Color.WHITE);
float pts = {markers.get(i).point.x, markers.get(i).point.y, markers.get(i + 1).point.x, markers.get(i + 1).point.y};
matrix.mapPoints(pts);
canvas.drawLine(pts[0], pts[1], pts[2], pts[3], paintLine);
}
}
for (int i = 0; i < markers.size(); i++) {
float pts = {markers.get(i).point.x, markers.get(i).point.y};
float sst = markers.get(i).sst;
matrix.mapPoints(pts);
if (sst <= 0 && sst >= -80) {
paintMain.setColor(Color.RED);
} else if (sst <= -80 && sst >= -90) {
paintMain.setColor(Color.BLUE);
} else if (sst <= -90 && sst >= -100) {
paintMain.setColor(Color.YELLOW);
} else if (sst <= -100 && sst >= -110) {
paintMain.setColor(getResources().getColor(R.color.lightgreen));
} else if (sst <= -110 && sst >= -140) {
paintMain.setColor(Color.GREEN);
} else if (sst == -999) {
paintMain.setColor(Color.BLACK);
}
canvas.drawCircle(pts[0], pts[1], 22, paintMain);
}
for (int i = 0; i < semiMarkers.size(); i++) {
float pts = {semiMarkers.get(i).point.x, semiMarkers.get(i).point.y};
float sst = semiMarkers.get(i).sst;
matrix.mapPoints(pts);
if (sst <= 0 && sst >= -80) {
paintForSemi.setColor(Color.RED);
} else if (sst <= -80 && sst >= -90) {
paintForSemi.setColor(Color.BLUE);
} else if (sst <= -90 && sst >= -100) {
paintForSemi.setColor(Color.YELLOW);
} else if (sst <= -100 && sst >= -110) {
paintForSemi.setColor(getResources().getColor(R.color.lightgreen));
} else if (sst <= -110 && sst >= -140) {
paintForSemi.setColor(Color.GREEN);
} else if (sst == -999) {
paintForSemi.setColor(Color.BLACK);
}
canvas.drawCircle(pts[0], pts[1], 11, paintForSemi);
}
}
So I have an app which draws points on a custom imageview when we click the button 'Add Checkpoint'. Everytime a new point is added, two things happen -
1) A line is created joining the just added point and previous added point.
2) The line is divided into 'x' number of points, and the points are drawn over the line. (Look at the screenshot attached)
I basically pass a List to the custom imageview class from which I get the value of 'x'.

Now everytime the value of x exceeds let's say 70 or 80 (any high number), the app crashes and I get the following error -
Unable to add window -- token android.os.BinderProxy is not valid; is your activity running?
My activity is getting finished due to heavy UI operation. Any suggestions?
This is the function in my custom imageview which draws add the point to the List of points to be shown.
public void addMarker(float a, float b, Context ctx, List<SampleModel> mainList) {
DBHelperCSV helperCSV = new DBHelperCSV(ctx);
if (!mainList.isEmpty()) {
for (SampleModel m : mainList) {
System.out.println("Rushi : SSTList : " + m.sst);
}
}
int partsCount = mainList.size();
pointNumber = pointNumber + 1;
matrix.invert(inverse);
float pts = {
a + 45, b + 45
};
inverse.mapPoints(pts);
System.out.println("Rushi : Passed points :" + a + " " + b);
PointF mainPoint = new PointF(pts[0], pts[1]);
float mainSST = -999;
if (!mainList.isEmpty()) {
mainSST = Float.parseFloat(mainList.get(0).getSst());
}
PointModel mainPointModel = new PointModel(mainPoint, mainSST);
markers.add(mainPointModel);
PointF mainConvertedPoint = getConvertedPoint(mainPoint.x, mainPoint.y);
//
//pts[0] and pts[1] is the actual image point which is in markers list
System.out.println("Rushi : Mapped points :" + pts[0] + " " + pts[1]);
PointF convertedPoint = getConvertedPoint(pts[0], pts[1]);
System.out.println("Rushi : Converted points :" + convertedPoint.x + " " + convertedPoint.y);
convertedPoints.add(new PointModel(convertedPoint, mainSST));
invalidate();
Toast.makeText(ctx, "(" + convertedPoint.x + "," + convertedPoint.y + ")", Toast.LENGTH_SHORT).show();
if (markers.size() > 1) {
//Add partsCount-1 points between the markers.size() - 1 and markers.size() - 2
PointF justAddedPoint = markers.get(markers.size() - 1).point;
PointF previousPoint = markers.get(markers.size() - 2).point;
System.out.println("Divide : Previous point - " + "(" + previousPoint.x + "," + previousPoint.y + ")");
System.out.println("Divide : Just added point - " + "(" + justAddedPoint.x + "," + justAddedPoint.y + ")");
//Find d and d/n
if (partsCount > 2 && !((Activity)ctx).isFinishing()) {
double dist = Math.sqrt(((justAddedPoint.x - previousPoint.x) * (justAddedPoint.x - previousPoint.x)) + ((justAddedPoint.y - previousPoint.y) * (justAddedPoint.y - previousPoint.y)));
double tParts = partsCount - 1;
double dN = dist / tParts;
// new BackgroundWorker(ctx, dist, tParts - 1, dN, previousPoint, justAddedPoint, mainList).execute();
for (int i = 0; i < tParts - 1; i++) {
double m = (i + 1) * dN;
double n = dist - ((i + 1) * dN);
PointF point = new PointF();
double x = ((m * justAddedPoint.x + n * previousPoint.x) / dist);
double y = ((m * justAddedPoint.y + n * previousPoint.y) / dist);
point.set((float) x, (float) y);
//Map and add
float pts2 = {(float) x, (float) y};
inverse.mapPoints(pts2);
//Point and value
PointModel pointModel = new PointModel();
float sst = -999;
if (!mainList.isEmpty()) {
sst = Float.parseFloat(mainList.get(i + 1).getSst());
}
pointModel.setPoint(point);
pointModel.setSst(sst);
semiMarkers.add(pointModel);
convertedPoints.add(new PointModel(getConvertedPoint(point.x, point.y), sst));
System.out.println("Divide : Point " + (i + 1) + " - (" + point.x + "," + point.y + ")");
try {
Thread.sleep(4);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}
}
This is my onDraw() function -
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
origWidth = this.getDrawable().getIntrinsicWidth();
origLength = this.getDrawable().getIntrinsicHeight();
if (markers.size() > 1) {
for (int i = 0; i < markers.size() - 1; i++) {
paintLine.setColor(Color.WHITE);
float pts = {markers.get(i).point.x, markers.get(i).point.y, markers.get(i + 1).point.x, markers.get(i + 1).point.y};
matrix.mapPoints(pts);
canvas.drawLine(pts[0], pts[1], pts[2], pts[3], paintLine);
}
}
for (int i = 0; i < markers.size(); i++) {
float pts = {markers.get(i).point.x, markers.get(i).point.y};
float sst = markers.get(i).sst;
matrix.mapPoints(pts);
if (sst <= 0 && sst >= -80) {
paintMain.setColor(Color.RED);
} else if (sst <= -80 && sst >= -90) {
paintMain.setColor(Color.BLUE);
} else if (sst <= -90 && sst >= -100) {
paintMain.setColor(Color.YELLOW);
} else if (sst <= -100 && sst >= -110) {
paintMain.setColor(getResources().getColor(R.color.lightgreen));
} else if (sst <= -110 && sst >= -140) {
paintMain.setColor(Color.GREEN);
} else if (sst == -999) {
paintMain.setColor(Color.BLACK);
}
canvas.drawCircle(pts[0], pts[1], 22, paintMain);
}
for (int i = 0; i < semiMarkers.size(); i++) {
float pts = {semiMarkers.get(i).point.x, semiMarkers.get(i).point.y};
float sst = semiMarkers.get(i).sst;
matrix.mapPoints(pts);
if (sst <= 0 && sst >= -80) {
paintForSemi.setColor(Color.RED);
} else if (sst <= -80 && sst >= -90) {
paintForSemi.setColor(Color.BLUE);
} else if (sst <= -90 && sst >= -100) {
paintForSemi.setColor(Color.YELLOW);
} else if (sst <= -100 && sst >= -110) {
paintForSemi.setColor(getResources().getColor(R.color.lightgreen));
} else if (sst <= -110 && sst >= -140) {
paintForSemi.setColor(Color.GREEN);
} else if (sst == -999) {
paintForSemi.setColor(Color.BLACK);
}
canvas.drawCircle(pts[0], pts[1], 11, paintForSemi);
}
}
asked Nov 26 '18 at 11:17
Rushi DesaiRushi Desai
136
136
add a comment |
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53479958%2fandroid-unable-to-add-window-token-android-os-binderproxy-is-not-valid-is%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53479958%2fandroid-unable-to-add-window-token-android-os-binderproxy-is-not-valid-is%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown