Friday 10 May 2019

Fix MTP driver Installation on Windows 10

Fix MTP driver Installation on Windows 10

C:\Windows\INF\wpmdmtp.inf

wpmdmtp.inf is a file related to MTP and installing it manually can possibly 
resolve your issues is a file related to MTP and installing it manually can 
possibly resolve your issues

Right-click on the wpmdmtp.inf file and select Install
now the problem solved.

Thursday 9 May 2019

How to get string if length is more than 50 after 50 it split into another string ?

String st = "A string is a data type used in programming,
 such as an integer and floating point unit,
but is used to represent text rather than numbers";
if (st.length() > 50) {
    int comma = st.indexOf(',', 50);
    if (comma >= 0) {

        //Bit before comma        String partOne = st.substring(0, comma);

        //Bit after comma        String partTwo = st.substring(comma);
        Log.e("string partOne", partOne);
        Log.e("string partTwo", partTwo);
    }
}

Parses a specific value from string against a specific key for xml format data l̥

 Parses a specific value from string against a specific key for xml format data l̥

private String getValueFromString(String key, String input) {
    if (!AppUtility.isNullOrEmpty(input)) {
        try {
            String match = key.toLowerCase() + "=\"";
            String[] dataArray1 = input.split(match);
            String[] dataArray2;
            if (dataArray1 != null && (dataArray1.length > 0)) {
                int size = dataArray1.length;
                if (size > 1) {
                    dataArray2 = dataArray1[1].split("\"");
                    return dataArray2[0].trim();
                } else {
                    match = key.toUpperCase() + "=\"";
                    dataArray1 = input.split(match);
                    if (dataArray1 != null && (dataArray1.length > 0)) {
                        size = dataArray1.length;
                        if (size > 1) {
                            dataArray2 = dataArray1[1].split("\"");
                            return dataArray2[0].trim();
                        }
                    }
                }
            }

        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    return " ";/*empty string*/
}