Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6376585
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T01:45:51+00:00 2026-05-25T01:45:51+00:00

I want to run excutable such as ping(or any other which gives continuous output)

  • 0

I want to run excutable such as ping(or any other which gives continuous output) and read its output and print it in my GUI.

I used following method to run my commands:

command=Runtime.getRuntime().exec("ping www.google.com");

and I am reading the output as following:

BufferedReader in = new BufferedReader(new InputStreamReader(command.getInputStream()));

while ((line = in.readLine()) != null) {  
                    System.out.println(line+"\n");
}

this works fine , although display output pretty late compared to time taken when i execute ./excutable using adb -d shell.

As I want to this output(line) in gui so I make a TextView and append the output(line) in it as:

txtview=(TextView)findViewById(R.id.textview);
while ((line = in.readLine()) != null) {  
                    txtview.append(line+"\n");
                    System.out.println(line+"\n");
}

but this crashes my application.
please tell me how to get over this problem.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T01:45:52+00:00Added an answer on May 25, 2026 at 1:45 am

    If your last block of code is being executed in an Activity, then you are probably blocking the UI thread for too long. This will cause Android to force close your application. Try using AsyncTask to get the output and update your GUI.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to run an executable and limit its memory and time usage. Of
I want to run a small PostgreSQL database which runs in memory only, for
I want my Ruby Script File to run as executable from any directory of
I want to run an executable with command line parameters in WiX. How do
I want to run an executable from a ruby rake script, say foo.exe I
In my C program I want to know if my executable is run in
I have an application and executables. I want my application to run my executables.
I want run all script from the directory . Like , The directory contains
I want run a script as follows: runner: ssh 'java program &' ssh 'java
Why this code don't work,when i want run this code vwd 2008 express show

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.