• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

What's your favorite YouTube Channels?

hahahaha, my wife hates when I do that. But these work trips I'm all by myself so it's pretty great.

My favorite thing is exploring and getting to know public transportation, and one of the marks of a great trip is if I get an opportunity to give someone directions. That is the ultimate achievement for me (haha). Like, I been here 2 days and I'm handing out directions to tourists liek I'm a local. LOVE it, lol
Same here NightAngel, I always wonder off, my mother hates it but I do not like looking around a room forever :)

Current Location...how do I turn off??

Not using google account with non Chrome browser with no cookies enabled in incognito mode, is great begging. Next step will be to do that from VPN. But sometimes you are still predictable enoght to be tracked is some way or another. So Tor network is the best you can get as privacy. Tor nodes could be hosted by some government controlled entity, like VPNs, so there is not really a way to stay private on public internet.

voicemail notification dot doesn't work

I'm happy that cdysthe replied; this has reminded me that I failed to followup. Here's what I did to resolve my issue:

I installed Action Launcher v46.0
A few times since the dots (with counter inside them) have stopped working. All but once all I had to do was to toggle the dot setting off/on. The other time (last week now running Android 10) that didn't immediately work; after more toggling and rebooting, the dot/counters came back thankfully.

Help Why no push notifications from one specific app?

I think I've figured out what's going on here. I got this answer from the SmartNews support:

"New installs and reinstalls of the SmartNews app may experience a lag of a few days before notifications start coming in."

This was a reinstall on a new phone and my profile was restored in the app. I wonder why there's significant lag before push notifications start coming in? I think they should inform of that within the app. I have wasted a lot of time on this. At least I now know things will be back to normal. This is one of my most used apps.

What is Bitcoin Mining?

Well dude, cryptocurrency mining is really costly, however in case you are smart enough, and you understand how it all works, then it will be rewarding for 100%. In case you do something wrong, like you choose the costliest internet connection, or you don't find cheap electricity then surely it will not be rewarding at all. In case you are not sure about mining, then just go and create a forex Islamic account and start trading. Get a good fbs deposit and get on trading. However, i consider that mining is great, in case you will be doing everything correctly then it will be really rewarding.

Apps Android Studio Beginner: Questions and problems regarding reading data from bluetooth

Hello! I am currently working on acheiving certain tasks depending on the data received from a Bluetooth module using the input buffer. Currently I am trying to play a sound depending on the input using MediaPlayer.Create, but only seems to work when I have the device plugged in and hit "Apply Changes and Restart Activity." It does not seem to work if I were to just open the app and test, only after going through the process stated before. Is there a better way of reading the inputstream and handling that data? Is there also a better way to go about how I am playing a sound in the run() function of the ConnectedThread thread? This is my current code. I am also thinking of switching from MediaPlayer to SoundPool because I would like to play multiple sounds simultaneously, would that also be a good option?

Code:
class ControlActivity: AppCompatActivity() {

   companion object {
       var m_myUUID: UUID = UUID.fromString("00001101-0000-1000-8000-00805F9B34FB")
       var m_bluetoothSocket: BluetoothSocket? = null
       lateinit var m_progress: ProgressDialog
       lateinit var m_bluetoothAdapater: BluetoothAdapter
       var m_isConnected: Boolean = false
       lateinit var  m_address: String
       private const val TAG = "MY_APP_DEBUG_TAG"
       const val MESSAGE_READ: Int = 0
       const val MESSAGE_WRITE: Int = 1
       const val MESSAGE_TOAST: Int = 2
       private lateinit var handler: Handler
   }
   var mMediaPlayer: MediaPlayer? = null
   override fun onCreate(savedInstanceState: Bundle?) {

       super.onCreate(savedInstanceState)
       setContentView(R.layout.control_layout)
       m_address = intent.getStringExtra(SettingsActivity.EXTRA_ADDRESS)!!
       ConnectToDevice(this).execute()

       control_led_on.setOnClickListener { sendCommand("1") }
       control_led_off.setOnClickListener { sendCommand("0") }
       control_led_disconnect.setOnClickListener { disconnect() }
   }

   private fun sendCommand(input: String){
       if (m_bluetoothSocket != null){
           try {
               m_bluetoothSocket!!.outputStream.write(input.toByteArray())
               Log.i("data", "sending..")
           } catch (e: IOException) {
               e.printStackTrace()
               Log.i("data", "couldn't send")
               }
               return

           }

   }
   private fun disconnect(){
       if (m_bluetoothSocket != null){
           try {
               m_bluetoothSocket!!.close()
               m_bluetoothSocket = null
               m_isConnected = false
           } catch (e: IOException) {
               e.printStackTrace()
           }
       }
       finish()
   }

   private class ConnectedThread(private val mmSocket: BluetoothSocket?, c : Context) : Thread() {
       private val mmBuffer: ByteArray = ByteArray(10) // mmBuffer store for the stream
       var mMediaPlayer: MediaPlayer? = null
       var context: Context
       init{
           this.context = c
       }
       override fun run() {
           var numBytes: Int = 0// bytes returned from read()
           //var begin: Int = 0
           // Keep listening to the InputStream until an exception occurs.
           while (true) {
               // Read from the InputStream.
               try {
                   numBytes =
                       mmSocket!!.inputStream.read(mmBuffer, numBytes, mmBuffer.size - numBytes)


               } catch (e: IOException) {
                   Log.d(TAG, "Input stream was disconnected", e)
                   break
               }

               playNote(context)

               println(numBytes)
               println(String(mmBuffer))





           }
       }
       fun playNote(c: Context) {
           if (mMediaPlayer == null) {
               mMediaPlayer = MediaPlayer.create(c, R.raw.c3)
               mMediaPlayer!!.start()
           } else if (mMediaPlayer != null) {
               mMediaPlayer!!.stop()
               mMediaPlayer!!.release()
               mMediaPlayer = null
           } else mMediaPlayer!!.start()
       }

   }




   private class ConnectToDevice(c: Context) : AsyncTask<Void, Void, String>(){
       private var connectSuccess: Boolean = true
       private val context: Context

       init {
           this.context = c
       }
       override fun onPreExecute() {
           super.onPreExecute()
           m_progress = ProgressDialog.show(context, "Connecting...", "please wait")
       }
       override fun doInBackground(vararg p0: Void?) : String? {
           try {
               if (m_bluetoothSocket == null || !m_isConnected){
                   m_bluetoothAdapater = BluetoothAdapter.getDefaultAdapter()
                   val device: BluetoothDevice = m_bluetoothAdapater.getRemoteDevice(m_address)
                   m_bluetoothSocket = device.createInsecureRfcommSocketToServiceRecord(m_myUUID)
                   BluetoothAdapter.getDefaultAdapter().cancelDiscovery()
                   m_bluetoothSocket!!.connect()

               }
           } catch (e: IOException){
               connectSuccess = false
               e.printStackTrace()
           }
           return null
       }
       override fun onPostExecute(result: String?) {
           super.onPostExecute(result)
           if(!connectSuccess){
               Log.i("data", "couldn't connect")
           } else {
               m_isConnected = true
               var connectedthread= ConnectedThread(m_bluetoothSocket, context)
               connectedthread.start()
               Log.i("data", "connected")
           }
           m_progress.dismiss()


       }

   }
}

I feel like the problem I have might be the way I am passing the context to the MediaPlayer in the ConnectedThread thread, but I'm honestly not too sure because i just started learning kotlin. What other options do I have for evaluating the bytearray being sent from the Bluetooth?

Returning a bitmap from a video properly

Using:

Code:
 static int i=0;

int index = 4 * ( x + width * y );
unsigned char red = pixelsp[i]>>16 ;
unsigned char green = pixelsp[i]>>8;
unsigned char blue = pixelsp[i];
unsigned char alpha = pixelsp[i] >> 24;

pixelsp[index]=red;
pixelsp[index+1]=green;
pixelsp[index+2]=blue;
pixelsp[index+3]=alpha;

i++;

instead of:

Code:
int index = 4 * ( x + width * y );
            unsigned char red = pixelsp[index]>>16 ;
            unsigned char green = pixelsp[index+1 ]>>8;
            unsigned char blue = pixelsp[index+2];
            unsigned char alpha = pixelsp[index+3] >> 24;
            bitmap[index]=red;
            bitmap[index+1]=green;
            bitmap[index+2]=blue;
            bitmap[index+3]=alpha;


solved the problem.

Filter

Back
Top Bottom