Posts

Set navigation drawer selected item from Fragment

  public class HomeFragment extends Fragment {   private NavigationView navigationView ;   public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {  navigationView = (NavigationView)getActivity().findViewById(R.id. navigation_view ); navigationView .setCheckedItem(R.id. nav_staff );   }     use getActivity instead of using view.

Alternative for System.out.println in android

For debugging purposes, alternative solution for System.out.println is to use Log.d d means debug. To see the log simply click on android monitor which is located on the bottom of android studio. select debug (right side of search toolbar) select the emulator of your app running.

com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes)

Android studio error while adding dependencies for RecyclerView. Simple change to the latest version same as your appcompat-v7:25.3.1   for example: compile 'com.android.support:appcompat-v7:25.3.1'   compile 'com.android.support:recyclerview-v7:25.3.1'       Android studio gives warning if the version is not the same.

Missing recyclerview component on android studio

resolve by adding the following dependency on gradle --  module app. add the following to the dependecies    - compile 'com.android.support:recyclerview-v7:+'   sync now on the top of the editor.   credit to: https://stackoverflow.com/questions/24441107/recyclerview-is-missing

Validate Email address in Java

Method to validate email entry in Java. public static boolean isValidEmailAddress(String enteredEmail) {                 boolean isValid = false;         boolean containsDot = false;         boolean containsAt = false;         int dotPosition = 0;         int addPosition = 0;         char addSign = '@';         char dotLetter = '.';                 if (enteredEmail != null && !enteredEmail.isEmpty()){             dotPosition = enteredEmail.lastIndexOf(".");             addPosition = enteredEmail.lastIndexOf("@");                  ...

Primefaces Calendar component

Try to use Primefaces Calendar component realizing unable to use Ajax in command button. solved by updating the form id to form or simple remove the id. leaving only <h:form>

CPU locks at 700Mhz

Device : Laptop Acer Aspire S3 951, core i7 2637M upgraded to windows 10 from windows 7 64x. Cpu clock speed constantly locks at 700Mhz after running the laptop for a while. Able to resolve this in short term, by shut down the laptop, turn off the adaptor, but the lock will come back again after running some heavy task. try run prime95 to test it. updating BIOS somehow work in short term as well. As for long term solution, - updated the chipset driver with the latest provided by Intel ( just overwrite the one comes with Acer for windows 7 driver). - updated the Intel Management Engine with the one provided by Intel. Laptop has been running for few days (without shutting down) heavy processing sometime. Now without having CPU clock speed locks. - updated Not sure if it is related with hard drive failure. PC's hard drive fail soon when try to reformat the PC with windows 10 installer. upgraded to SSD now running smooth.