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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T09:54:24+00:00 2026-06-17T09:54:24+00:00

I want to print the text file from my application in android 8 through

  • 0

I want to print the text file from my application in android 8 through Bluetooth or WiFi. Please suggest me the solution.

  • 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-17T09:54:25+00:00Added an answer on June 17, 2026 at 9:54 am

    this is a sample

    package com.example.untitled2;
    
    import android.app.Activity;
    import android.bluetooth.BluetoothAdapter;
    import android.bluetooth.BluetoothDevice;
    import android.bluetooth.BluetoothSocket;
    import android.content.Intent;
    import android.os.Bundle;
    import android.view.View;
    import android.widget.Button;
    import android.widget.Toast;
    
    import java.io.IOException;
    import java.io.OutputStream;
    import java.util.Set;
    import java.util.UUID;
    
    public class MyActivity extends Activity {
        private static final UUID MY_UUID = UUID.fromString("00001101-0000-1000-8000-00805F9B34FB");
    
        /**
         * Called when the activity is first created.
         */
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.main);
            Button btn = (Button) findViewById(R.id.button);
            btn.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
                    if (mBluetoothAdapter == null) {
                        Toast.makeText(MyActivity.this, "no device", Toast.LENGTH_LONG).show();
                    }
                    if (!mBluetoothAdapter.isEnabled()) {
                        mBluetoothAdapter.enable();
                    }
                    Set<BluetoothDevice> bluetoothDevices = mBluetoothAdapter.getBondedDevices();
                    if (bluetoothDevices.size() == 0)
                        return;
                    OutputStream mmOutStream;
                    BluetoothDevice device = bluetoothDevices.iterator().next();
                    try {
                        BluetoothSocket socket = device.createRfcommSocketToServiceRecord(MY_UUID);
                        socket.connect();
                        mmOutStream = socket.getOutputStream();
                        /*String textPrint = ""+(char) 27 + (char)116 + (char) 27;*/
                        String textPrint = "this is example text"+(char)10;
                        mmOutStream.flush();
                        mmOutStream.write(textPrint.getBytes());
                        mmOutStream.flush();
                        for (int i = 0; i < 10; i++) {
                            mmOutStream.write(textPrint.getBytes());
                        }
                        mmOutStream.flush();
                        //mmOutStream.wait();
                        mmOutStream.close();
                        socket.close();
                    } catch (IOException e) {
                        Toast.makeText(MyActivity.this, e.getMessage(), Toast.LENGTH_LONG).show();
                    }
    
                }
            });
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to print a text from file in C#(Visual Studio 2010), but file
i make Android application that can communicate to bluetooth printer for printing some text,
I want to print simple text file (no style, formatting ) ,such that it
I want to print any text without using system.out.println() in java? It is possible
I want to print the ID of the comment (eg. 10151828637085391_33268745 ) from this
I am developing an Android application. I am calling a Perl file on a
I have a .NET 4.0 application and I need to take the text from
I am looking to pass a list of variables from a text file into
My question is quite simple, I want to read in a text file and
I have a file and i want to print ou the contents of it

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.