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

Creating windows with WindowManager is slow

I have to create several windows in AccessibilityService. I'm doing it now with next code:
WindowManager wm = (WindowManager) getSystemService(WINDOW_SERVICE); wm.addView(view,params);
But the creating\removing windows needs 800-1000ms for creating simple window for now. I've already tried adding WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED, but it didn't help.
Maybe there is some tips\tools to make it faster?

Cannot get actual file path from downloads category of File Chooser

I have created an Android Media Player and I have run into a dilemma. I have created a file picker for the mediaplayer but the File chooser intent built into android does not allow me to get actual file path in such format "/storage/emulated/0/etc./" instead it returns the URI path to the file being played. I have created a function to get the real file path for files chosen through file chooser intent which is list below. The short of it is that any file chosen from the recent tab or downloads section of the File Chooser intent it will not get the real file path for any file chosen from those categories within the File Chooser. Is there any way to get the real file path for files chosen from the File Chooser instead of URI's?

Code:
 public static String removableStoragePath;
    public static String sdPath, sdCardLabel;
    public static boolean sdCardPathDetection;
    public static int dirCounterSD;
    public static ArrayList<Integer> iterationCounterLocationsSD = new ArrayList<Integer>();

    @SuppressLint("NewApi")
    public static String getPath(Context context, Uri uri) {
        final boolean needToCheckUri = Build.VERSION.SDK_INT >= 19;
        String selection = null;
        System.out.println("URI SCHEME: " + uri.getScheme() + "getDocumentId: " + DocumentsContract.getDocumentId(uri));
        String[] selectionArgs = null;
        // Uri is different in versions after KITKAT (Android 4.4), we need to
        // deal with different Uris.
        if (DocumentsContract.isDocumentUri(context.getApplicationContext(), uri)) {
            if (isExternalStorageDocument(uri)) {
                final String docId = DocumentsContract.getDocumentId(uri);
                final String[] split = docId.split(":");
                final String type = split[0];
                File fileList[] = new File("/storage/").listFiles();
                for (File file : fileList) {
                    if (!file.toString().contains("self") && !file.toString().contains("emulated")) {
                        sdPath = file.toString();
                        System.out.println("SD PATH SUCCESSFULLY IDENTIFIED!: " + sdPath);
                    }
                    sdCheck(uri);
                }
                System.out.println(removableStoragePath);
                return removableStoragePath + "/" + split[1];

            } else {
                if (isMediaDocument(uri)) {
                    String pathUtil = uri.getPath();
                    System.out.println("Media document: " + pathUtil);
                    final String docId = DocumentsContract.getDocumentId(uri);
                    final String[] split = docId.split(":");
                    File fileList[] = new File("/storage/").listFiles();
                    for (File file : fileList) {
                        if (file.toString().contains("self") || file.toString().contains("emulated")) {
                            sdPath = file.toString();
                            System.out.println("SD PATH SUCCESSFULLY IDENTIFIED!: " + sdPath);
                        }
                        sdCheck(uri);
                    }
                    System.out.println(removableStoragePath);
                    return removableStoragePath + "/" + split[1];
                }
            }
        }
        if ("content".equalsIgnoreCase(uri.getScheme())) {
            String[] projection = {MediaStore.Images.Media.DATA};
            Cursor cursor = null;
            try {
                cursor = context.getContentResolver().query(uri, projection, selection, selectionArgs, null);
                int column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
                if (cursor.moveToFirst()) {
                    return cursor.getString(column_index);
                }
            } catch (Exception e) {
            }
        } else if ("file".equalsIgnoreCase(uri.getScheme())) {
            return uri.getPath();
        }
        return null;
    }

    public static void sdCheck(Uri uri) {
        System.out.println("SD CHECK IS WORKING!");
        for (int i = 0; i < uri.toString().length(); i++) {
            char c = uri.toString().charAt(i);
            //Process char
            if (c == '/') {
                dirCounterSD += 1;
                iterationCounterLocationsSD.add(i);
            }
        }
        Object iterationArraySD[] = iterationCounterLocationsSD.toArray();
        int lastIndexPathSD = iterationArraySD.length;
        int lastIndexSlashSD = (int) iterationArraySD[lastIndexPathSD - 1];
        System.out.println("# Slashes: " + lastIndexPathSD + " Slash index: "
                + iterationArraySD[lastIndexPathSD - 1].toString());

        sdCardLabel = uri.toString().substring(lastIndexSlashSD + 1, lastIndexSlashSD + 10);
        if (sdCardLabel.toCharArray()[4] == "-".toCharArray()[0]) {
            sdCardPathDetection = true;
            removableStoragePath = sdPath;
        } else {
            removableStoragePath = Environment.getExternalStorageDirectory().getAbsolutePath();
        }
        System.out.println("SD Card Label: " + sdCardLabel);

    }

    /**
     * @param uri The Uri to check.
     * @return Whether the Uri authority is ExternalStorageProvider.
     */
    public static boolean isExternalStorageDocument(Uri uri) {
        return "com.android.externalstorage.documents".equals(uri.getAuthority());
    }

    /**
     * @param uri The Uri to check.
     * @return Whether the Uri authority is DownloadsProvider.
     */
    public static boolean isDownloadsDocument(Uri uri) {
        return "com.android.providers.downloads.documents".equals(uri.getAuthority());
    }

    /**
     * @param uri The Uri to check.
     * @return Whether the Uri authority is MediaProvider.
     */
    public static boolean isMediaDocument(Uri uri) {
        return "com.android.providers.media.documents".equals(uri.getAuthority());
    }
}

Orby TV anyone?

Crappy signal when you get incliment weather....
Oh, I know all about inclement weather--I had the misfortune of living in Tornado Alley for years. :rolleyes:

But now I'm going to count how many times, since moving home to SoCal in 2006, 'rain fade' [losing the signal] has happened on DirecTV. Ready? Okay, here we go: 1...2... Yep, a whopping TWO times! And neither time caused a full outage, just a few moments of choppy play. The other 99.99% of the time? Rock-solid service with crystal-clear pictures. I'm happy--other than its price. :)

Sync problem on exchange email on moto x

AND NEVERMIND -- it has cleared up on its own. I don't understand, but my emails are coming through again.
When something like that happens, it's very likely due to an update at the server's end. "Oops! That screwed things up! Here let's fix it!--FAST!" as angry users flood their support channels. :o I'm sure you weren't alone. I'm glad it's resolved! :)

Nokia 8.3/AndroidOne v Pixel 3a/stock Android

Having had a Pixel 3a for just over 5 months, I'm still very pleased with it. Moving from HTC after 9 years, ending with the 10, which was 32GB but does cater for an SD card (I had a 16GB card) but had plenty of storage space on both internal shared and the card so I knew that the 64GB Pixel 3a would meet my needs.

I just hope I get better battery life than I had with my HTC M9 and the 10 which both started to fail after two years use.

Only time will tell, but for now I'm more than happy with the Pixel 3a, as is my wife, we had one each.

:)

Tell me

always do your research over at xda developers forum. its a developers forum where the devs hangout and publish their goodies.

here i found this for you:
https://forum.xda-developers.com/re...de-unlocking-bootloader-twrp-rooting-t4031831

please read, read, read, and then read some more before attemping to root your phone. if you have the time you should read all the posts within the thread. sometimes there are good tips and troubleshooting that will help you to root your phone.

good luck and keep us posted.

Help How to Record calls

Ok but if its because of newer android versions why does the A10, A20, A30 and A50 models CAN record calls?

I have no idea.
I do not have any of those devices, or know anything of them.

All I know of this subject is what I have already told you.

There are other forums where this subject was discussed in great depth, and the response from Google was that this feature has been depricated in more recent OS.

I posted the solution that works for me and it is quite simple, and free.

Help Is it possible the whatsapp chat of previous owner appearing in a used phone?

Shouldn't be possible. WhatsApp uses the phone number to sign in, and different SIM = different phone number.
I'm just tossing this out there, even though there's a big, fundamental difference. But it may help someone figure something out. :)

When I activated my WhatsApp account, my oft-cursed lack of a signal in my house prevented me from receiving the activation code via text. But! I provided my landline number, the code was spoken to me via a voice call, I activated WA, and that was that.

Until I bought a new smartphone and tried setting up WA on it.

By then, I had long forgotten any of that. I knew WA was backing up every night--I could *see* its file online, for heaven's sake! The file's name--the part of the name I could see in portrait on my phone--certainly looked right. I tried all sorts of things, to no avail, as I tried to get WA working on my new phone.

Oh, did I mention that the new phone did get a signal in my house? Not much, but good enough to momentarily connect to activate the account. Which kept failing... I'd try restoring its backup, it would say it didn't exist, and I'd cuss out loud "what the *%@)&! do you mean it doesn't exist? I'm LOOKING RIGHT AT IT!" :o :mad:

Then I thought, hmmm...I wonder what that backup file's name looks like in its entirety... :thinking: ...switched to landscape... OMFG! It's my landline's phone number! At first I was just baffled: why the hell did I use that?! Then it all came flooding back...

So the moral of the story is, well, I'm not really sure! :D But I do know that one WA account can have two phone numbers associated with it. And you can use a landline number to register.

Filter

Back
Top Bottom