Posted on Leave a comment

Android ImageView not displaying image in few phones only

Issue:

Android ImageView was not displaying image on Redmi Note Prime, when tested. But the same code when used in Redmi 4A shows image. 

Image which was being used

Solutions tried:

  1. Setting Image using XML
    Used: 
    android:src
  2. Setting image using Java code
    Used: 
    ImageView img;
    img = (ImageView) findViewById(R.id.startscreen);
    img.setImageResource(R.drawable.startimage);
  3. Setting background to different colour
    Used:
    android:background
  4. Changing the background colour of image
  5. Using AppCompat
    Used: 
    app:srcCompat

Solution that worked:

After googling all possible methods, we came across a comment where ‘Resizing the image’ was an option.

Initially, our image had a resolution of 1587 x 2245. We reduced the pixels by half (50%). And then tried without changing the code. Changing the image resolution did the trick for us !

In case you are stuck with image being displayed on a device and not on another, either use multi-resolution content, or use content that fits into all.

Posted on Leave a comment

Android Code : Ping a domain/IP & Latency Calculation

The following code may be used to ping the IP / Domain addresses and to obtain latency

Tested in Android 4.4.2, 6.0
Mobile handsets: Lenovo A6000, Redmi Note 4A
Working application: PUBG Network Quality Check
Minimum API Tested: 19

public long pingg (String domain){
        Runtime runtime = Runtime.getRuntime();
        try {
            long a = (System.currentTimeMillis() % 100000);
            Process ipProcess = runtime.exec("/system/bin/ping -c 1 "+domain);
            ipProcess.waitFor();
            long b = (System.currentTimeMillis() % 100000);
            if (b <= a) {
                timeofping = ((100000 - a) + b);
            } else {
                timeofping = (b - a);
            }
        }catch (Exception e){

        }
        return timeofping;
    }

Explanation:
The code fetches the current time in milliseconds to a variable.
The ping function is then called, with the domain as the parameter.
The code waits till the pinging is over.
The current time in milliseconds is fetched again.
The time interval between this is calculated as latency.

Special Thanks to StackOverflow for the idea and code concept !

Posted on Leave a comment

Announcing Introduction of Knowledge Centers

Dear well-wishers and followers,

We are glad to announce the introduction of ‘Knowledge centers’. When we were working on our android project, we came across a few obstacles in coding. Apart from the normal coding practices and logic, we came across a few libraries and repositories which could be of help.

Knowledge center was selected on the basis of polls in our Facebook Group –https://www.facebook.com/groups/regaldreamtech/ where most people chose that the knowledge and lessons learnt are to be made available for the people who follow us.

We will soon be introducing the Knowledge Center on our home page. This will be in the blog, but categorized separately, with home page featuring the link to the knowledge center.

Knowledge center may be found at https://www.regaldreamtech.com/knowledge-center/

Stay tuned for the updates !

Regards,
The Team,
RegalDream Technologies

Posted on Leave a comment

RDTwo: Our Experiments with Android

The emerging platform of Smartphones, and android operating system was one of the most important factors in the start up boom and culture here in India. Since the investment required was considerably less compared to hardware platforms, and as the SDK by Google was quite helpful with StackOverflow being able to solve most problems, android application grew, and with it, the startups.

Most unicorn start ups, has android application presence. We too had earlier experiences with Android Application development, and Windows Phone Application development as well.

Both SDK was pretty good to start with. Stack overflow being the encyclopedia for us.

Our Project RDTwo, is just a big analytical project. We collect data and just display the data. While working on Project RDOne, which is hardware related, we stumbled upon a few issues, and though, we should do that as well. We already had plans of expanding to Android Application Development, but didn’t even had idea that RDOne schedule would fall not behind RDTwo.

RDTwo – will be probably released as ‘GeoSpeed’. Stay tuned for more updates.

Expected release: December 1st week
Current Status: In Development