Example usage for android.widget ScrollView post

List of usage examples for android.widget ScrollView post

Introduction

In this page you can find the example usage for android.widget ScrollView post.

Prototype

public boolean post(Runnable action) 

Source Link

Document

Causes the Runnable to be added to the message queue.

Usage

From source file:Main.java

public static void scrollDown(final ScrollView view) {
    view.post(() -> view.fullScroll(View.FOCUS_DOWN));
}

From source file:Main.java

public static void scrollToBottom(final ScrollView scroll) {
    scroll.post(new Runnable() {
        public void run() {
            scroll.fullScroll(ScrollView.FOCUS_DOWN);
        }/*from w  w  w.  j a va 2s . c o  m*/
    });
}

From source file:Main.java

public static void scrollToBottom(final ScrollView scroll) {
    if (scroll != null) {
        scroll.post(new Runnable() {

            @Override/* w  ww. j  ava  2s.c o  m*/
            public void run() {
                scroll.fullScroll(View.FOCUS_DOWN);
            }
        });
    }
}

From source file:cn.bingoogolapple.refreshlayout.util.BGARefreshScrollingUtil.java

public static void scrollToBottom(final ScrollView scrollView) {
    if (scrollView != null) {
        scrollView.post(new Runnable() {
            @Override//from  w  ww . java 2 s  . c om
            public void run() {
                scrollView.fullScroll(ScrollView.FOCUS_DOWN);
            }
        });
    }
}

From source file:com.lanma.customviewproject.utils.ScrollingUtil.java

/**
 * ScrollView/*from w  ww.jav  a 2s  .c  o  m*/
 */
public static void scrollToBottom(final ScrollView scrollView) {
    if (scrollView != null) {
        scrollView.post(new Runnable() {
            @Override
            public void run() {
                scrollView.fullScroll(ScrollView.FOCUS_DOWN);
            }
        });
    }
}

From source file:com.example.android.google.wearable.app.MainActivity.java

private void scroll(final int scrollDirection) {
    final ScrollView scrollView = (ScrollView) findViewById(R.id.scroll);
    scrollView.post(new Runnable() {
        @Override/*  www . j  ava2s  . c o m*/
        public void run() {
            scrollView.fullScroll(scrollDirection);
        }
    });
}

From source file:org.openoverlayrouter.noroot.logActivity.java

public void refresh() {

    StringBuffer contents = new StringBuffer();

    final StringBuffer fixedContents = contents;

    try {//from www  .j  av  a 2s  . c o  m
        RandomAccessFile logFile = new RandomAccessFile(log_file, "r");
        if (logFile.length() > maxReadBytes) {
            logFile.seek(logFile.length() - maxReadBytes);
        }
        String currentLine = logFile.readLine();
        while (currentLine != null) {

            if (currentLine != null) {
                contents.append(currentLine);
                contents.append('\n');
            }
            currentLine = logFile.readLine();
        }
        try {
            if (logFile != null) {
                logFile.close();
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    } catch (FileNotFoundException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    } finally {

    }

    mHandler.post(new Runnable() {
        public void run() {

            // Put the file contents into the TextView
            TextView log = (TextView) llLayout.findViewById(R.id.logView);
            log.setText(fixedContents);

            // Auto scroll to the bottom
            final ScrollView scroll = (ScrollView) llLayout.findViewById(R.id.scrollView1);
            scroll.post(new Runnable() {
                public void run() {
                    scroll.fullScroll(View.FOCUS_DOWN);
                }
            });
            if (myDialog != null) {
                myDialog.dismiss();
                myDialog = null;
            }
        }
    });
}

From source file:com.kaliturin.blacklist.fragments.AddOrEditContactFragment.java

private void moveScroll() {
    View view = getView();//  ww  w  .ja v  a2  s.c o  m
    if (view != null) {
        final ScrollView scroll = (ScrollView) view.findViewById(R.id.scroll);
        scroll.post(new Runnable() {
            @Override
            public void run() {
                scroll.fullScroll(ScrollView.FOCUS_DOWN);
            }
        });
    }
}

From source file:com.houseofslack.pullscoring.Scoring.java

private void redrawOneSetOfScores(LinearLayout layout, List<Integer> scores, int scoreLayoutId,
        int scrollLayoutId, String teamName, int teamAndScoreId) {
    LayoutInflater inflater = getLayoutInflater();
    layout.removeAllViews();//from   ww w  .  j  a  va 2 s  .  c o  m
    int totalScore = 0;
    for (int score : scores) {
        totalScore += score;
        TextView textView = (TextView) inflater.inflate(scoreLayoutId, null);
        textView.setText(String.valueOf(score));
        layout.addView(textView);
    }
    TextView textView = (TextView) findViewById(teamAndScoreId);
    textView.setText(getString(R.string.total_score, teamName, totalScore));
    // set the scroll view to the bottom of the display
    final ScrollView scrollView = (ScrollView) findViewById(scrollLayoutId);
    scrollView.post(new Runnable() {
        @Override
        public void run() {
            scrollView.fullScroll(ScrollView.FOCUS_DOWN);
        }
    });
}

From source file:org.ros.android.app_chooser.ExchangeActivity.java

public void addTextToTextView(String message) {

    dialog_text.append(message);//from www.j a  v  a  2 s  .  c  o  m

    final ScrollView dialog_scroll = (ScrollView) dialog.findViewById(R.id.dialog_scrollview);
    dialog_scroll.post(new Runnable() {
        @Override
        public void run() {
            dialog_scroll.fullScroll(View.FOCUS_DOWN);
        }
    });
}