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 9003371
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:42:12+00:00 2026-06-16T00:42:12+00:00

I’m using two libraries in an android app I’m trying to make. New to

  • 0

I’m using two libraries in an android app I’m trying to make. New to android. The app is for connecting to serial devices and controlling their console via a terminal.

One library is for setting up a serial connection, setting baud rate etc and can also write read/data over serial.. The other is for creating a terminal session. I have no problem running these libraries to get simple separate examples up and running. Eg, with the first library I can set up a serial connection with a router and send/receive data via textboxes which looks like this:

https://lh5.ggpht.com/R4CAJXY9ZPDVsgt8jUZg5hc-v81aa70sctiegIGDjzv2lyvuG6OZyYas_4I-h_es-4Aq

With the second library I am able to set up local terminal on a tablet and look at the directories etc. My problem lies in incorporating both of these together to have a terminal that is connected to a serial device and with the layout/passing of data.

In the terminal library I need to supply an InputStream and OutputStream to provide input and output to the terminal. So I have to call setTermIn(java.io.InputStream) and setTermOut(java.io.OutputStream) to connect the input and output streams to the emulator.

In the serial library however there are two methods for sending and receiving and these deal with arrays of bytes.
sendData(byte[] data) for sending data and a dataListener for receiving data. I have to implement this and code the method onDataReceived(int id, byte[] data) with id being the name of the device.

So my question is, how do I hook these up? Do I create java.io.InputStream/OutputStream implementations on top of sendData and OnDataReceived, just convert the arrays to streams and call the setTermIn/Out methods?

For OnDataReceived I suppose all I do is receive the byte[] data and convert it to a stream inside the method and send this to the terminalActivity?
but what about sendData, I am not implementing this, I just send an array of bytes, how do I send it as a stream instead to setTermIn?

I am also very confused about having these things happening in different activities and how that works. Because I have the serial stuff happening in one activity, so I hit connect, it reads the relevant baud rate etc and connects to the serial device, then a terminal is opened in a new terminalActivity which is currently connected to nothing, just looks like a blank terminal. I’m not sure how everything should be laid out. Like if I hit the enter key in a terminal, should the implementation for sending data over serial not be in that same activity, not the one I am initially in where I am connecting to a serial device? But to know if I am connected to a serial device in the first place I need to send/receive data…should there be implementations of these methods in both activities?! Or maybe I should simplify it and add the connection options and the terminal to the same activity?

Should I be combining these both in one activity maybe?

  • 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-06-16T00:42:13+00:00Added an answer on June 16, 2026 at 12:42 am

    Simplest way was to combine into one activity.

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

Sidebar

Related Questions

I'm new to using the Perl treebuilder module for HTML parsing and can't figure
We're building an app, our first using Rails 3, and we're having to build
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I am using Paperclip to handle profile photo uploads in my app. They upload
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to understand how to use SyndicationItem to display feed which is
I am trying to render a haml file in a javascript response like so:
I am using the SimpleRSS gem to parse a WordPress RSS feed. The only
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and

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.