i need to edit text which is draw using canvas.drawtext.
You cannot do this directly. You would need an EditText view somehere, change the text, erase the old text and draw the new text.
also i need to clear a selected part of line drawn by canvas.drawline.
You already got an answer
here and you didn't even answer !?
All this depends on what and how you are or you intend doing it. Basicly when a canvas draws on a bitmap it changes the pixels of this bitmap. Any line, text or other figure is not known as an object or something else. It's not vector drawing. If you want to do kind of vector drawing you need to memorise your objects (line, text, circle, rectangle etc.) with their coordinates, color and other properties yourself.
Best regards.