0

How can i add numbered list for particular line when i press button. I want to try Bullet and Numbered list both, somehow i have completed with Bullet span but i am not getting how to implement Numbered listing in android. Can any one suggest me how can i implement Numbered listing in android edit-text.

Below is my Code for Bullet-text.

private void makeTextBullet() {
        try {
            String strBullet = (Html.fromHtml("&#8226").toString());
            mSpannable = edtNoteDescription.getText();
            StringBuilder sbTemp = new StringBuilder();
            AppHtml.withinHtml(sbTemp, mSpannable);
            String multiLines = sbTemp.toString();
            String[] streets;
            String delimiter = "<br>";
            streets = multiLines.split(delimiter);
            ArrayList<String> arrayList = new ArrayList<String>(Arrays.asList(streets));
            int pos = getCurrentCursorLine(edtNoteDescription);
            if (arrayList.get(pos).indexOf("&#8226;") != -1 ) {
                stackUndo.push("BULLET");
                arrayList.set(pos, arrayList.get(pos).replace("&#8226;", ""));
                String listString = "";
                for (String s : arrayList) {
                    listString += s + "<br>";
                }
                edtNoteDescription.setText(AppHtml.fromHtml(listString));
            } else {
                arrayList.set(pos, strBullet + " " + arrayList.get(pos));
                String listString = "";
                for (String s : arrayList) {
                    listString += s + "<br>";
                }
                edtNoteDescription.setText(AppHtml.fromHtml(listString));
                edtNoteDescription.setSelection(edtNoteDescription.getText().length());
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

So with above code i am successfully able to add bullet at particular line, now i want to add Numbered list, So please can anyone suggest me some link or example through which i can add numbered list to my edit-text.

I have already searched in Google and also tried with so many examples but didn't get success.

InnocentKiller
  • 5,234
  • 7
  • 36
  • 84
  • possible solution at [Ordered lists inside an Android TextView](http://stackoverflow.com/questions/2196499/ordered-lists-inside-an-android-textview) – Alberto Malagoli Dec 22 '14 at 09:08
  • some more information at [How to add bulleted list to android application ?](http://stackoverflow.com/questions/4992794/how-to-add-bulleted-list-to-android-application) – Alberto Malagoli Dec 22 '14 at 09:08
  • @albemala, I have already checked those link, but in first link i am not getting what "content" and "list" stands for, and in second link i don't get any example for Numbered list i can only check for bulleted list, and i don't want bullet span. – InnocentKiller Dec 22 '14 at 10:06
  • As I understand, in the first link "content" is the actual content of the TextView and "list" is a list of items which is intended to be inserted in the "content" as a numbered list. – Alberto Malagoli Dec 22 '14 at 13:33
  • @albemala, Still i didn't get any perfect solution, Can you please help me to understand this code or may be any other example. Thank you. – InnocentKiller Dec 24 '14 at 12:03

0 Answers0