Giter VIP home page Giter VIP logo

Comments (4)

kky5201314y avatar kky5201314y commented on July 16, 2024

At Last , i use "public static BluetoothSPP bt;" to made it work on deffrent Activitys.

But , i want to know any other solution.

from bluetoothspplibrary.

phillip-toone avatar phillip-toone commented on July 16, 2024

Thank you for the update of your original post. I would like to use this library across two different activities. I would like each activity to have its own behavior and its own "setOnDataReceivedListener". This seems to be giving me problems that I can't resolve. I am new to android programming. Should I just have one instance of "setOnDataReceivedListener" and pass the information between activities? Or something else? Any help here would be appreciated. Thanks in advance.

from bluetoothspplibrary.

phillip-toone avatar phillip-toone commented on July 16, 2024

Okay, I think I've figures this out for myself and thought I would post what I have learned here for others to learn from. (Or correct me if I am wrong.)

When starting a new activity a method can be overridden. In this case I am overriding the "setOnDataReceivedListener" method to do something different in the new activity. When the user pressed the back button to return to the previous activity the overridden method exists and should be restored. This can be done in one of two ways:

  1. Using onDestroy() in the second activity.
  2. Using OnResume() in the original activity.

from bluetoothspplibrary.

youssefghandour avatar youssefghandour commented on July 16, 2024

please help i have same issue but i don't understand what have you done

from bluetoothspplibrary.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.