Event for Handling the Focus of the EditText

Here is the focus listener example. editText.setOnFocusChangeListener(new OnFocusChangeListener() { @Override public void onFocusChange(View view, boolean hasFocus) { if (hasFocus) { Toast.makeText(getApplicationContext(), “Got the focus”, Toast.LENGTH_LONG).show(); } else { Toast.makeText(getApplicationContext(), “Lost the focus”, Toast.LENGTH_LONG).show(); } } });

protobuf vs gRPC

Protocol buffers is (are?) an Interface Definition Language and serialization library: You define your data structures in its IDL i.e. describe the data objects you want to use It provides routines to translate your data objects to and from binary, e.g. for writing/reading data from disk gRPC uses the same IDL but adds syntax “rpc” … Read more

ping response “Request timed out.” vs “Destination Host unreachable”

Destination Host Unreachable This message indicates one of two problems: either the local system has no route to the desired destination, or a remote router reports that it has no route to the destination. If the message is simply “Destination Host Unreachable,” then there is no route from the local system, and the packets to … Read more

ConnectivityManager getNetworkInfo(int) deprecated

You can use: getActiveNetworkInfo(); ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo activeNetwork = cm.getActiveNetworkInfo(); if (activeNetwork != null) { // connected to the internet if (activeNetwork.getType() == ConnectivityManager.TYPE_WIFI) { // connected to wifi } else if (activeNetwork.getType() == ConnectivityManager.TYPE_MOBILE) { // connected to mobile data } } else { // not connected to the internet } … Read more

Access HTTP response as string in Go

bs := string(body) should be enough to give you a string. From there, you can use it as a regular string. A bit as in this thread (updated after Go 1.16 — Q1 2021 — ioutil deprecation: ioutil.ReadAll() => io.ReadAll()): var client http.Client resp, err := client.Get(url) if err != nil { log.Fatal(err) } defer … Read more

What is the difference between 127.0.0.1 and localhost

Well, the most likely difference is that you still have to do an actual lookup of localhost somewhere. If you use 127.0.0.1, then (intelligent) software will just turn that directly into an IP address and use it. Some implementations of gethostbyname will detect the dotted format (and presumably the equivalent IPv6 format) and not do … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)