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

Does the S9 not support specific Headphone Jack standards?

Hello,

I have a Galaxy S9, headphone jack works fine but I ran into something interesting today. I found my old old wired pair that somehow hasn't got its left earphone inaudible, literally the only pair that has lasted THIS long. But for some reason, it does not work with my Galaxy S9. At first I thought that the pair was dead but I plugged into my computer and it's absolutely fine. So what gives?

Here is a picture of the headphone jack.
20190730_175209.jpg


I'm not really sure what's going on... I tried looking up wiring of a 4-pin headphone jack but I am not sure if there are different standards that have the 4pin jack in common but vary in wiring. Not really experienced in the audio field too much. I am guessing I can solve this issue through a wonderful adapter? Any help is appreciated. Thank you

Before the popularity of smartphones, what are you looking at in the toilet?

Nowadays, the mobile phone and us are inseparable. It can be said that wherever people go, where the mobile phone is brought, even the toilet is not missed.
The thing that could have been done in 3 minutes, since the smartphone was added, the time has been extended to 30 minutes or even longer.
So, before the popularity of smartphones, what are you doing when you go to the toilet?

Copying and Pasting HTML

I have an Android phone that works great, and an Android-powered Samsung Galaxy Tab A. Not sure what number the tablet is. With my phone, I can copy & paste html and it works great, but with my tablet it all comes out as plain text, even though my phone must be about two years older than the tablet. Anyone have any idea if I can change this, and how? I've tried playing around with settings, but have found nothing that works thus far.

Thanks,
Albanate

Input pixels normalization for image recognition app

Hello! I have started my Android app with my custom neural network model saved in .lite format. How can I do a input pixel normalization from 0 to 1 (not from 0 to 255)?
This is my modified ImageClassifier.java from repo: https://github.com/googlecodelabs/tensorflow-for-poets-2
Code:
/** Classifies images with Tensorflow Lite. */
public class ImageClassifier {

  /** Tag for the {@link Log}. */
  private static final String TAG = "TfLiteCameraDemo";

  /** Name of the model file stored in Assets. */
  private static final String MODEL_PATH = "graph.lite";

  /** Name of the label file stored in Assets. */
  private static final String LABEL_PATH = "labels.txt";

  /** Number of results to show in the UI. */
  private static final int RESULTS_TO_SHOW = 1;

  /** Dimensions of inputs. */
  private static final int DIM_BATCH_SIZE = 1;

  private static final int DIM_PIXEL_SIZE = 3;

  static final int DIM_IMG_SIZE_X = 256;
  static final int DIM_IMG_SIZE_Y = 256;

  private static final int IMAGE_MEAN = 128;
  private static final float IMAGE_STD = 128.0f;


  /* Preallocated buffers for storing image data in. */
  private int[] intValues = new int[4*DIM_IMG_SIZE_X * DIM_IMG_SIZE_Y];

  /** An instance of the driver class to run model inference with Tensorflow Lite. */
  private Interpreter tflite;

  /** Labels corresponding to the output of the vision model. */
  private List<String> labelList;

  /** A ByteBuffer to hold image data, to be feed into Tensorflow Lite as inputs. */
  private ByteBuffer imgData = null;

  /** An array to hold inference results, to be feed into Tensorflow Lite as outputs. */
  private float[][] labelProbArray = null;
  /** multi-stage low pass filter **/
  private float[][] filterLabelProbArray = null;
  private static final int FILTER_STAGES = 3;
  private static final float FILTER_FACTOR = 0.4f;

  private PriorityQueue<Map.Entry<String, Float>> sortedLabels =
      new PriorityQueue<>(
          RESULTS_TO_SHOW,
          new Comparator<Map.Entry<String, Float>>() {
            @Override
            public int compare(Map.Entry<String, Float> o1, Map.Entry<String, Float> o2) {
              return (o1.getValue()).compareTo(o2.getValue());
            }
          });

  /** Initializes an {@code ImageClassifier}. */
  ImageClassifier(Activity activity) throws IOException {
    tflite = new Interpreter(loadModelFile(activity));
    labelList = loadLabelList(activity);
    imgData =
        ByteBuffer.allocateDirect(
            4 * DIM_BATCH_SIZE * DIM_IMG_SIZE_X * DIM_IMG_SIZE_Y * DIM_PIXEL_SIZE);
    imgData.order(ByteOrder.nativeOrder());
    labelProbArray = new float[1][labelList.size()];
    filterLabelProbArray = new float[FILTER_STAGES][labelList.size()];
    Log.d(TAG, "Created a Tensorflow Lite Image Classifier.");
  }

  /** Classifies a frame from the preview stream. */
  String classifyFrame(Bitmap bitmap) {
    if (tflite == null) {
      Log.e(TAG, "Image classifier has not been initialized; Skipped.");
      return "Uninitialized Classifier.";
    }
    convertBitmapToByteBuffer(bitmap);
    // Here's where the magic happens!!!
    long startTime = SystemClock.uptimeMillis();
    tflite.run(imgData, labelProbArray);
    long endTime = SystemClock.uptimeMillis();
    Log.d(TAG, "Timecost to run model inference: " + Long.toString(endTime - startTime));

    // smooth the results
    applyFilter();

    // print the results
    String textToShow = printTopKLabels();
    textToShow = Long.toString(endTime - startTime) + "ms" + textToShow;
    return textToShow;
  }

  void applyFilter(){
    int num_labels =  labelList.size();

    // Low pass filter `labelProbArray` into the first stage of the filter.
    for(int j=0; j<num_labels; ++j){
      filterLabelProbArray[0][j] += FILTER_FACTOR*(labelProbArray[0][j] -
                                                   filterLabelProbArray[0][j]);
    }
    // Low pass filter each stage into the next.
    for (int i=1; i<FILTER_STAGES; ++i){
      for(int j=0; j<num_labels; ++j){
        filterLabelProbArray[i][j] += FILTER_FACTOR*(
                filterLabelProbArray[i-1][j] -
                filterLabelProbArray[i][j]);

      }
    }

    // Copy the last stage filter output back to `labelProbArray`.
    for(int j=0; j<num_labels; ++j){
      labelProbArray[0][j] = filterLabelProbArray[FILTER_STAGES-1][j];
    }
  }

  /** Closes tflite to release resources. */
  public void close() {
    tflite.close();
    tflite = null;
  }

  /** Reads label list from Assets. */
  private List<String> loadLabelList(Activity activity) throws IOException {
    List<String> labelList = new ArrayList<String>();
    BufferedReader reader =
        new BufferedReader(new InputStreamReader(activity.getAssets().open(LABEL_PATH)));
    String line;
    while ((line = reader.readLine()) != null) {
      labelList.add(line);
    }
    reader.close();
    return labelList;
  }

  /** Memory-map the model file in Assets. */
  private MappedByteBuffer loadModelFile(Activity activity) throws IOException {
    AssetFileDescriptor fileDescriptor = activity.getAssets().openFd(MODEL_PATH);
    FileInputStream inputStream = new FileInputStream(fileDescriptor.getFileDescriptor());
    FileChannel fileChannel = inputStream.getChannel();
    long startOffset = fileDescriptor.getStartOffset();
    long declaredLength = fileDescriptor.getDeclaredLength();
    return fileChannel.map(FileChannel.MapMode.READ_ONLY, startOffset, declaredLength);
  }

  /** Writes Image data into a {@code ByteBuffer}. */
  private void convertBitmapToByteBuffer(Bitmap bitmap) {
    if (imgData == null) {
      return;
    }
    imgData.rewind();
    bitmap.getPixels(intValues, 0, bitmap.getWidth(), 0, 0, bitmap.getWidth(), bitmap.getHeight());
    // Convert the image to floating point.
    int pixel = 0;
    long startTime = SystemClock.uptimeMillis();
    for (int i = 0; i < DIM_IMG_SIZE_X; ++i) {
      for (int j = 0; j < DIM_IMG_SIZE_Y; ++j) {
        final int val = intValues[pixel++];
        imgData.putFloat((((val >> 16) & 0xFF)-IMAGE_MEAN)/IMAGE_STD);
        imgData.putFloat((((val >> 8) & 0xFF)-IMAGE_MEAN)/IMAGE_STD);
        imgData.putFloat((((val) & 0xFF)-IMAGE_MEAN)/IMAGE_STD);
      }
    }
    long endTime = SystemClock.uptimeMillis();
    Log.d(TAG, "Timecost to put values into ByteBuffer: " + Long.toString(endTime - startTime));
  }

  /** Prints top-K labels, to be shown in UI as the results. */
  private String printTopKLabels() {
    for (int i = 0; i < labelList.size(); ++i) {
      sortedLabels.add(
          new AbstractMap.SimpleEntry<>(labelList.get(i), labelProbArray[0][i]));
      if (sortedLabels.size() > RESULTS_TO_SHOW) {
        sortedLabels.poll();
      }
    }
    String textToShow = "";
    final int size = sortedLabels.size();
    for (int i = 0; i < size; ++i) {
      Map.Entry<String, Float> label = sortedLabels.poll();
      textToShow = String.format("\n%s: %4.2f",label.getKey(),label.getValue()) + textToShow;
    }
    return textToShow;
  }
}
Where do I need to add normalization option?

Help White bar blocks half of my notifications

Hello everyone

I have a (to me) very annoying problem. When I receive a notification on my Motorola One Vision, a white bar blocks about half of it, including the action shortcuts.

Does somebody have a solution for this? I have uploaded a screenshot of the problem.

I am running android pie and Nova launcher.

Thanks a lot in advance!

Attachments

  • Screenshot_20190730-114811~2.png
    Screenshot_20190730-114811~2.png
    177.9 KB · Views: 179

Need valid blank flash file or MMCBLK0.img

I hard bricked my moto g6 xt1925-6 a month ago. Actually there was an OTA update in my device and i was so excited about it. Without noticing battery percentage i started update process and now devices is dead. It means no any sign of life only white light blinks after connectin charger and is detected as Qualcomm HS-USB Qloader 9008. So I searched for blank flash file and found in https://mirrors.lolinet.com/firmware/moto/ali/blankflash/ but is not valid. It didnt work at all and gives some error. If any guys have valid working blank flash file than provide me or provide me working device mmcblk0.img so that i can boot it from sd card. Help me please :( :( :(

Help Chrome for Android and facebook.com integration

When I type in A tag name for my friends that are tagged in the reply it start the drop down menues for taging and when I choose the person it types his last name with the last two letters repeated instead of "Barakat" it type his last name adding the first two letters "Babarkat" With out the underlines that some one has been tagged in this post.... Can you have explaintion or reason for that to happen?

  • Poll Poll
Listview Images are getting Cut of at Borders

Listview Images are getting Cut of at Borders in only OnePlus all Devices

  • This Might be issue with Library?

    Votes: 0 0.0%
  • This might issue with OnePlue Devices?

    Votes: 0 0.0%

Hi Team,
I am Android App Developer, I facing an Issue only in One Plus Devices.
Issue: In Listview I have placed an ImageView in it, we are using Library (WrapContentDraweeView) to fetch the Image url and displaying on the Screen. While showing the Images on the Screen Images are cut of for 1 DP (Top, Bottom, Right, Left) on all the sides. Tried to replicate the issue in Other devices, but we can't able to reproduce this issue in other Devices.

I am attaching OnePlus Screenshot and Other mobile Screenshot, Please check the marked area.

May I know the reason why it is happening.

Attachments

  • OnePlus.jpeg
    OnePlus.jpeg
    218.6 KB · Views: 256
  • Other.png
    Other.png
    1.2 MB · Views: 279

Check for null not working

I have the following method.

Java:
    public void delete(String name, Context x) {
        String msg;
        // Check if anything input
        if (name == null) {
            msg = "No input";
        } else {
            // Count the number of rows
            String query = "SELECT COUNT(*) FROM " + TABLE_NA +
                    " WHERE " +
                    NA_NAME + " = '" + name + "';";
            Cursor c = mDB.rawQuery(query, null);
            int count = 0;
            if (null != c)
                if (c.getCount() > 0) {
                    c.moveToFirst();
                    count = c.getInt(0);
                }
            c.close();
            // Now run the delete
            query = "DELETE FROM " + TABLE_NA +
                    " WHERE " +
                    NA_NAME + " = '" + name + "';";

            Log.i("delete() = ", query);
            mDB.execSQL(query);
            msg = count + " record(s) deleted";
        }
        makeToast(msg, x);
    }

The delete process works fine but I have added the check at the beginning to see if the input is empty, and it's not working. If I try to delete a row with empty input, the Toast message is "0 record(s) deleted" rather than "No input".

The log is reporting

I/delete() =: DELETE FROM names_and_addresses WHERE name = '';

From the delete point of view the result is the same, but I plan to put a similar check in the input method as I don't want my db table filled will null records.

Can anyone see where I'm going wrong?

Adapter for dual SIM plus SD card for a single SIM G6?

Hi, I have a US model single SIM Moto G6 and want to get an adapter/converter to be able to use 2 SIM's plus the SD card in my phone. I see some out there om eBay and Amazon but without a slot for your SD card, where the longer adapter sticks out of the SIM slot and kept in place around the back of the phone by a good case. Some allow you 3 SIM cards. Know of any that allow 2 SIMs and the SD card? Just got an upgrade to 9/Pie if that matters.Thanks.

How to keep Firestick 4K alive when watching another TV input?

Hi, I have the newer Firestick 4K, plugged into one of my TV's HDMI ports. I also have an OTG cable with a thumbdrive in line with the Firestick so I can have it record thru an app what's streaming to watch later on my PC while I'm using something else on another HDMI input on my TV, usually my PC. When I go check, the Firestick is completely off, blank screen, and find out only a few minutes recorded, This happens whether I use the OTG/thumbdrive, or just have a normal connection of the Firestick into an HDMI port. If I have something on the Firestick, then go to another HDMI port to watch something briefly, then go back to the Firestick, it's still working. If longer, the Firestick shuts off. I tried looking for settings to keep ot awake, and nothing. I even side loaded a Stay Awake type app, and that doesn't help. How do I keep the Firesick awake and active? Thanks.

Factory reset wiped SD card?

My son tried to enter my phone's pass code too many times yesterday and it wiped the device and did a factory reset. I didn't know that was a thing, but now I do! I have no cloud backup.
My question is, I'm trying to recover at least just photos from the SD card (I tried DiskDigger), but it's blank. Does that make sense? Did the factory reset actually wipe the card clean? Any other suggestions or am I just out of luck? Thank you :(

Help with game development

So I have started making a game in Android Studios. So far, all it does is when you click a button, it generates 2 random cards. If you click it again, it generates 2 more random cards replacing where the first ones were. However, even though this seems simple enough, I am getting messages that it skipped 30 frames and is doing too much work on the main thread. How do I fix this? This is also my first time using android forums so is it appropriate to ask questions concerning topics like this?

Barclays Mobile Banking App

Hello, I have a Samsung Tab A 10.1, and I am trying to install Barclays Mobile Banking on it, problem is the app is apparently “not supported”, I found an APK on APKmirror, and it installed and the app worked, but another problem, a phishing tool was attached to the app, where you entered the pin, so I don't know what to do now. Can anyone help me on this problem please.

Always rebuilding

This is something new.

Since I had a recent problem where I had to clean & rebuild, I now have to rebuild every time I make any code change.

Previously, I could make a change, then click the "play" icon (top right), and my changes would be applied.

Now, nothing gets applied. I've checked this by adding obvious log messages where they couldn't be missed, and they don't show up. I have to do Build->Rebuild Project to get my changes to register.

I'm guessing there may be a setting somewhere I messed up, or something like that? How do I get the previous behavior back?

(BTW this is only happening on one of my projects. Others work like they used to)

Using images/hardware profiles: Emulator

When it comes to testing on emulators, how common is for developers to test on different AVDs (actual emulators) build with "different images" and "hardware profiles"? I am referring to `emulator avd create` as in this link http://www.androiddocs.com/tools/devices/managing-avds-cmdline.html#AVDCmdLine (The link is a bit old but it shows the command). Right now all my testing has been focused on a single image/API. What is your testing strategy? Is emulators even in your testing plan?

I am also using this as a reference: http://www.androiddocs.com/tools/devices/index.html

This is probably a better link as it is associated to official documentation:
https://developer.android.com/studio/run/emulator#android_virtual_devices

One of the challenges on using different platform during testing is that, from what I understand, the platform also depends on the build-tools version. I have had issues of platform/build-tools compatibility before but the root cause issue is not 100% clear to me... yet.

Any comments or if you don't mind sharing your experiences. Thank you,

Apps No Device Compatibility

I am seeking to publish an app. I tested the app using my own phone, on which it ran just fine. But in the Google Play Console its not listing any "SUPPORTED DEVICES" in the "Device catalog".

What did I do wrong? How can I fix this?

I have the compile and target SDK version set to 28
The minimum SDK version is set to 19

I was trying to use a bundle instead of an APK

any help would be appreciated
Walt Williams

Filter

Back
Top Bottom