This exception is not coming due to title.clearComposingText().
even this line is not useful ,we can remove this line.
This exception is coming in to title() function because a non UI-Thread is trying to modify view.
so we need to call this function in a UI Thread or Handler.
private void startingUp() {
Thread timer = new Thread() { //new thread
public void run() {
boolean b = true;
try {
do {
counter++;
sleep(1000);
runOnUiThread(new Runnable() {
@Override
public void run() {
title();
//title.clearComposingText();//not useful
}
});
}
while (b == true);
} catch (InterruptedException e) {
e.printStackTrace();
}
finally {
}
};
};
timer.start();
}