#StackBounty: #android #android-layout #android-viewpager #android-tabs #android-tablayout how to use tabContentStart to start content …

Bounty: 50

I am using TabLayout and ViewPager

<android.support.v4.view.ViewPager
        android:id="@+id/view_pager_social_profiles"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_behavior="@string/appbar_scrolling_view_behavior"></android.support.v4.view.ViewPager>

<android.support.design.widget.TabLayout
        android:id="@+id/tab_layout_social_profiles"
        android:layout_width="match_parent"
        android:layout_height="112dp"
        app:tabContentStart="72dp"
        app:tabGravity="center"
        app:tabIndicatorHeight="0dp"
        app:tabMode="scrollable"></android.support.design.widget.TabLayout>

I want to start tab content from the middle of screen so if there is only one tab it will be aligned exactly center of screen (horizontally) and also selected tab will be always in center.


Get this bounty!!!

#StackBounty: #ubuntu #compiling #gcc #android Swift for Android: `ld` cannot find `-lgcc` in swift for android compilation linking step

Bounty: 100

I’m trying to compile Swift code on Ubuntu 16.04 LTS, following these instructions fairly closely. I was able to download the NDK r14 okay, download the libicu tools and build them, and download the swift source and build that against the libicu tools. I get all the way down to compiling actual swift code and get this:

#build.sh 
#(I symlinked the androideabi ld.gold to /usr/bin/ld.armv7, based on a swift bug ticket's advice. Thats the only thing different from the instructions)

/home/mike/workspace/swift-source/build/Ninja-ReleaseAssert/swift-linux-x86_64/bin/swiftc 
-use-ld=armv7 
-tools-directory /home/mike/workspace/android-ndk-r14/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/arm-linux-androideabi/bin 
-target armv7-none-linux-androideabi 
-sdk /home/mike/workspace/android-ndk-r14/platforms/android-21/arch-arm 
-L /home/mike/workspace/android-ndk-r14/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a 
-L /home/mike/workspace/android-ndk-r14/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/lib/gcc/arm-linux-androideabi/4.9 
hello.swift


#output
mike@mike-VirtualBox:~/workspace/HelloSwift$ ./build.sh 
/usr/bin/ld.armv7: error: cannot find -lgcc
/usr/bin/ld.armv7: error: cannot find -lgcc
/usr/bin/ld.armv7: error: cannot find -lgcc
/usr/bin/ld.armv7: error: cannot find -lgcc

I don’t have a ton of experience being this far down the toolchain, but I deeeefinitely have gcc installed, and gcc-multilib, and LD_LIBRARY_PATH set to help ld find gcc, and I’ve rebuild the ld cache with ldconfig.


Get this bounty!!!

#StackBounty: #c# #android #visual-studio #mono #xamarin.android Pinging IP or HOSTNAME with Xamarin not working as expected

Bounty: 50

I’m trying this code and it returns always TTL Expired even if the ip or hostname is unreachable , timeout or any other diferrent problem :

using System.Net.NetworkInformation;

PingReply Reply = await pingo.SendPingAsync(text_ip.Text, 4000, buffer, options);
        Toast.MakeText(Activity, Reply.Status.ToString(), ToastLength.Long).Show();
        switch (Reply.Status)
        {
            case IPStatus.Success:

                Toast.MakeText(Activity, Reply.Status.ToString(), ToastLength.Long).Show();
                break;

            case IPStatus.TimedOut:

                Toast.MakeText(Activity, Reply.Status.ToString(), ToastLength.Long).Show();
                break;

            case IPStatus.TimeExceeded:

                Toast.MakeText(Activity, Reply.Status.ToString(), ToastLength.Long).Show();
                break;

            case IPStatus.DestinationHostUnreachable:


               Toast.MakeText(Activity, Reply.Status.ToString(), ToastLength.Long).Show();
                break;

            case IPStatus.DestinationNetworkUnreachable:

                Toast.MakeText(Activity, Reply.Status.ToString(), ToastLength.Long).Show();
                break;

            case IPStatus.DestinationUnreachable:

                Toast.MakeText(Activity, Reply.Status.ToString(), ToastLength.Long).Show();
                break;
        }

I found a bug at https://github.com/mono/mono/blob/master/mcs/class/System/System.Net.NetworkInformation/Ping.cs (line 339)
That calls the system ping command and checks the exit code:

if (!ping.WaitForExit (timeout) || (ping.HasExited && ping.ExitCode == 2))
    status = IPStatus.TimedOut;
else if (ping.ExitCode == 0)
    status = IPStatus.Success;
else if (ping.ExitCode == 1)
    status = IPStatus.TtlExpired;

So TTL expired is set when there was no timeout, no error or success (exit code 2 or 0), and the exit code was 1.

If ping does not receive any reply packets at all it will exit with code 1. If a packet count and deadline are both specified, and fewer than count packets are received by the time the deadline has arrived, it will also exit with code 1. On other error it exits with code 2. Otherwise it exits with code 0. This makes it possible to use the exit code to see if a host is alive or not.

So a return value of 1 indicates that no response has been received (for various reasons) and the Mono implementation sets the TTL expired status in this case. I would expect that a time out status would be returned in such cases. But it seems that the timeout detection of the Mono implementation is not triggered here (e.g. because the ping command exits upon on it’s own timeout before).

So there is other possible solutions:

To treat a TTL expired as host not alive (but this will then ignore real TTL expired detections)

Anyway can somebody show another way to do this with a example of Ping request with exec from Java.Lang.Process and to get from the reply time, info , statistics or other values ?


Get this bounty!!!

#StackBounty: #android #cordova #apk Manipulating the UI of existing native applications at runtime

Bounty: 100

I know this sounds “hacky” but I would like to personalize some UIs of the applications I have already installed in my Android. E.g. Using the same fonts, colors, etc. I know this sounds weird but I’m not thinking in creating an app for others but me, so it is not a problem if I have to root my phone or have it in debug mode. Any clue?

PS: I already saw some answers suggesting to decompress/compress the apk, but I don’t want to modify the applications’ sources, just injecting some style (as Stylish extension do it for Web applications) at runtime.

PS2: As Cordova apps are built with Web technologies, it may be possible to have a DOM to manipulate but how to do it from the outside?

Thanks in advance!


Get this bounty!!!

#StackBounty: #laptop #android Unable to connect to websites which don't start with www

Bounty: 100

I have created hotspot from my Andriod mobile and using Internet on laptop Windows 7 but I’m unable to connect to websites which don’t start with www..

The error:

If your computer or network is protected by a firewall or proxy, make sure that Firefox is permitted to access the Web

Should the settings be done on mobile or laptop? What should I change?

Note I am using mobile data. Websites starting with www. are working fine. The problem doesn’t occur on my phone. Also everything is OK when my laptop uses LAN.


Get this bounty!!!

#StackBounty: #laptop #android Unable to connect to websites which don't start with www

Bounty: 100

I have created hotspot from my Andriod mobile and using Internet on laptop Windows 7 but I’m unable to connect to websites which don’t start with www..

The error:

If your computer or network is protected by a firewall or proxy, make sure that Firefox is permitted to access the Web

Should the settings be done on mobile or laptop? What should I change?

Note I am using mobile data. Websites starting with www. are working fine. The problem doesn’t occur on my phone. Also everything is OK when my laptop uses LAN.


Get this bounty!!!

#StackBounty: #laptop #android Unable to connect to websites which don't start with www

Bounty: 100

I have created hotspot from my Andriod mobile and using Internet on laptop Windows 7 but I’m unable to connect to websites which don’t start with www..

The error:

If your computer or network is protected by a firewall or proxy, make sure that Firefox is permitted to access the Web

Should the settings be done on mobile or laptop? What should I change?

Note I am using mobile data. Websites starting with www. are working fine. The problem doesn’t occur on my phone. Also everything is OK when my laptop uses LAN.


Get this bounty!!!

#StackBounty: #laptop #android Unable to connect to websites which don't start with www

Bounty: 100

I have created hotspot from my Andriod mobile and using Internet on laptop Windows 7 but I’m unable to connect to websites which don’t start with www..

The error:

If your computer or network is protected by a firewall or proxy, make sure that Firefox is permitted to access the Web

Should the settings be done on mobile or laptop? What should I change?

Note I am using mobile data. Websites starting with www. are working fine. The problem doesn’t occur on my phone. Also everything is OK when my laptop uses LAN.


Get this bounty!!!

#StackBounty: #android #android-n WindowManager addView – Android 7.1.1

Bounty: 50

I’m adding a small TextView at the bottom of my app when the app goes offline. So I have a BroadcastReceiver that monitors network connectivity changes and in the onReceive, I show the banner. Here is the banner class which adds the TextView on top of the existing view:

public static void show() {
        if (!isShowing && !isAppBackgrounded()) {
            MyApplication app = MyApplication.getInstance();
            WindowManager windowManager = (WindowManager) app.getSystemService(Context.WINDOW_SERVICE);
            Resources res = app.getResources();
            TextView offlineTv = app.getOfflineTv();

            if (offlineTv.getWindowToken() != null) {
                return;
            }

            offlineTv.setText("Offline");
            offlineTv.setTextColor(ContextCompat.getColor(app, R.color.yellow));
            offlineTv.setGravity(Gravity.CENTER);
            offlineTv.setBackgroundColor(ContextCompat.getColor(app, R.color.dark_grey));
            offlineTv.setTextSize(TypedValue.COMPLEX_UNIT_SP, app.getResources().getInteger(R.integer.offline_banner_text_size));

            WindowManager.LayoutParams params = createLayoutParams(WindowManager.LayoutParams.TYPE_TOAST, null);
            windowManager.addView(offlineTv, params);
            isShowing = true;
        }
    }

Here is the createLayoutParams method

 private static WindowManager.LayoutParams createLayoutParams(int type, @Nullable IBinder windowToken) {
        WindowManager.LayoutParams layoutParams = new WindowManager.LayoutParams();
        layoutParams.format = PixelFormat.TRANSLUCENT;
        layoutParams.width = WindowManager.LayoutParams.MATCH_PARENT;
        layoutParams.height = 25;
        layoutParams.gravity = GravityCompat.getAbsoluteGravity(Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM, ViewCompat.LAYOUT_DIRECTION_LTR);
        layoutParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
        layoutParams.type = type;
        layoutParams.token = windowToken;
        layoutParams.windowAnimations = android.R.style.Animation_Toast;

        return layoutParams;
    }

This code works fine on all the devices but 7.1.1 devices. In 7.1.1 device, the TextView shows for a while and then disappears. There is just a blank white space instead of the TextView on 7.1.1 devices. Any idea why is it happening?


Get this bounty!!!

#StackBounty: #android #fingerprint #android-fingerprint-api #huawei Huawei P9 lite fingerprint support

Bounty: 150

Do you know if Huawei P9 lite does support Fingerprint?
Is it possible to use Android 6.0 Fingerprint API or is it supported through some custom proprietary API (Huawei SDK)?

We are evaluating to buy some smartphones and we would like to know how this feature is supported on this specific device.


Get this bounty!!!