I have found a way and will share here. If you want more of the code, use the link to my Stackoverflow answer that I also linked in my question.
I guess I wasn't setting up the correct code, or at lease all of it, until now.
DrawView.java
package com.example.floatingicon;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.view.View;
public class DrawView extends View{
Paint paint = new Paint();
public DrawView(Context context){
super(context);
paint.setColor(Color.BLACK);
}
@Override
public void onDraw(Canvas canvas){
canvas.drawLine(240, 0, 240, 620, paint);
canvas.drawLine(0, 200, 480, 200, paint);
}
}
This will draw a cross on the screen
MainService.java
import com.example.floatingicon.DrawView;
public class MainService extends Service
{
private DrawView drawView;
@Override
public void onCreate()
{
drawView = new DrawView(this);
final WindowManager.LayoutParams paramsDraw = new WindowManager.LayoutParams(
WindowManager.LayoutParams.WRAP_CONTENT,
WindowManager.LayoutParams.WRAP_CONTENT,
WindowManager.LayoutParams.TYPE_PHONE,
WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE,
PixelFormat.TRANSLUCENT);
paramsDraw.gravity = Gravity.TOP | Gravity.LEFT;
paramsDraw.x=0;
paramsDraw.y=0;
winManager.addView(drawView, paramsDraw);
}
}
If you add that to the already existing code, it should work just fine.