Tuesday, January 31, 2017

Feild Validation in Android

public static boolean isNotNull(String txt){
    return txt!=null && txt.trim().length()>0 ? true: false;
}

public boolean isEmailEmpty(String lusername) {
    boolean status;

    if (Utility.isNotNull(lusername)) {
        status = true;
    } else {
        status = false;

        textt.setText("Email cannot be empty");
        toastt.setView(layoutt);
        toastt.show();


    }
    return status;
}
public boolean isEmailValid(String lusername) {
    boolean status;
    if (Utility.validateEmail(lusername)){
        status = true;
    } else {
        status = false;

        textt.setText("Invalid email address");
        toastt.setView(layoutt);
        toastt.show();


    }
    return status;
}

public boolean isPasswordhaveSixDigits(String pass) {
    boolean status;

    if (pass.length() > 7) {
        status = true;
    } else {
        status = false;

        textt.setText("Invalid Password");
        toastt.setView(layoutt);
        toastt.show();
    }
    return status;
}
public boolean isPasswordEmpty(String pass) {
    boolean status;

    if (Utility.isNotNull(pass)) {
        status = true;
    } else {
        status = false;

        textt.setText("Password cannot be empty");
        toastt.setView(layoutt);
        toastt.show();


    }
    return status;
}

===============================

Call the Service Method...


lusername = txtEmail.getText().toString();
lpassword = txtPassword.getText().toString();

if (isEmailEmpty(lusername) && isEmailValid(lusername) && isPasswordEmpty(lpassword) && isPasswordhaveSixDigits(lpassword)){
                loginUserOnline(lusername, lpassword);
}
else {
    System.out.println("4");
}



Monday, January 30, 2017

How to create release Hash Key for facebook login in android


1. We need to download openssl from Google code (64 bit users must downloadopenssl-0.9.8e X64, not the latest version) 

2. Extract it. 
create a folder- OpenSSL in C:/ and copy the extracted code here. 

3. Then you want to move to keytool location of your PC. Its in your java derectroy , bin folder, Example :    C:\Program Files\Java\jre1.8.0.111\bin
From here load the Command prompt.

Enter this command;
keytool -exportcert -alias androidreleasekey -keystore "C:\Users\user\.android\debug.keystore" | "C:\OpenSSL\bin\openssl" sha1 -binary | "C:\OpenSSL\bin\openssl" base64

But here path must be your PC relative paths......


Now, it will ask for password, put android 

That's all. It will return a key-hash.


Thursday, January 26, 2017

Best Practices for Android App Performance


Lession 1-

How to identify problems in your app's layout performance and improve the UI responsiveness.
  1. Optimizing Layout Hierarchies
  2. Re-using Layouts with <include/>
  3. Delayed Loading of Views
  4. Making ListView Scrolling Smooth













https://developer.android.com/training/best-performance.html

What is Observer pattern in Programming

https://en.wikipedia.org/wiki/Observer_pattern

RxAndroid Tutorial

RxAndroid Tutorial


https://www.raywenderlich.com/141980/rxandroid-tutorial

Use an HTTP library like Volley, Retrofit

Use an HTTP library like Volley, Retrofit for service calling

Calling Async methods in Android with http://reactivex.io/

Calling Async methods in Android with http://reactivex.io/

Hybrid Framework - Configure.IT


http://www.configure.it/platform/appconsole/


As per my experience in this field, I recommend developers as well as beginners to use mobile app development platform like Configure.IT, because it provides automatic coding, app preview facility, direct API connect and a lot more features. These things save a lot more development time and provides fast and well designed app in much less time.

Wednesday, January 25, 2017

How to create a custom toast in android


Decleration---------------------------------
LayoutInflater inflatert;
View layoutt;
TextView textt;
Toast toastt;


Initialization---------------------------------
inflatert = getLayoutInflater();
layoutt = inflatert.inflate(R.layout.custom_toast,
        (ViewGroup) findViewById(R.id.custom_toast_container));
textt = (TextView) layoutt.findViewById(R.id.text);
toastt = new Toast(getApplicationContext());
toastt.setGravity(Gravity.CENTER, 0, -150);
toastt.setDuration(Toast.LENGTH_LONG);
toastt.setView(layoutt);



Implementation---------------------------------
textt.setText("Invalid email address");
toastt.setView(layoutt);
toastt.show();


custome_toast xml file----------------------
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"    android:id="@+id/custom_toast_container"    android:orientation="horizontal"    android:layout_width="fill_parent"    android:layout_height="fill_parent"    android:padding="8dp"    android:background="@color/default__toast_color"    >

    <TextView android:id="@+id/text"        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:textColor="#FFF"        />
</LinearLayout>

Get Debug SHA key for facebook login in android

PackageInfo infoooo;
try {
    infoooo = getPackageManager().getPackageInfo("com.myapp.android.new", PackageManager.GET_SIGNATURES);
    for (Signature signature : infoooo.signatures) {
        MessageDigest md;
        md = MessageDigest.getInstance("SHA");
        md.update(signature.toByteArray());
        String something = new String(Base64.encode(md.digest(), 0));
        //String something = new String(Base64.encodeBytes(md.digest()));        Log.e("hash key", something);
    }
} catch (PackageManager.NameNotFoundException e1) {
    Log.e("name not found", e1.toString());
} catch (NoSuchAlgorithmException e) {
    Log.e("no such an algorithm", e.toString());
} catch (Exception e) {
    Log.e("exception", e.toString());
}