27 Ağustos 2018 Pazartesi

MotionEvent Sınıfı

MotionEvent.ACTION_UP Alanı
Açıklaması şöyle.
A pressed gesture has finished, the motion contains the final release location as well as any intermediate points since the last down or move event.
getAction metodu
Şöyle yaparız.
ivProductImage.setOnTouchListener(new View.OnTouchListener() {

  @Override
  public boolean onTouch(View v, MotionEvent event) {


    switch (event.getAction()) {
      case MotionEvent.ACTION_DOWN: {

        //press event
        imageDialog.show();

        return true;
      }
      case MotionEvent.ACTION_UP: {

        //release event
        imageDialog.dismiss();


        return true;
      }
      default:
        return false;

      }
  }

});

17 Ağustos 2018 Cuma

ApplicationInfo Sınıfı

flags Alanı
Bir uygulamanın oyun olup olmadığını anlamak için şöyle yaparız.
PackageManager pm = mContext.getPackageManager();
ApplicationInfo ai = pm.getApplicationInfo(mPackageName,0);
if((ai.flags & ApplicationInfo.FLAG_IS_GAME) == ApplicationInfo.FLAG_IS_GAME)
    return true;
return false;

14 Ağustos 2018 Salı

TextUtils Sınıfı

Giriş
Şu satırı dahil ederiz.
import android.text.TextUtils;
concat metodu
Şöyle yaparız.
SpannableString str1 = ...;
SpannableString str2 = ...;
String str = TextUtils.concat(str1 , str2);
join metodu
Iterable nesneleri attraç kullanarak birleştirir ve string'e çevirir.
Örnek
Şöyle yaparız.
ArrayList<Integer> list = ...;
String str = TextUtils.join (",", list);
Örnek
Şöyle yaparız.
TextUtils.join(" and ", names);
isEmpty metodu
Şöyle yaparız.
String str = ...;
if (TextUtils.isEmpty(tag)) {...}


1 Ağustos 2018 Çarşamba

SystemClock Sınıfı

elapsedRealtime metodu
Açıklaması şöyle.
Returns milliseconds since boot, including time spent in sleep.
elapsedRealtimeNanos metoud
Açıklaması şöyle.
Returns nanoseconds since boot. It will continue to tic even in sleep.
Şöyle yaparız.
long timeInNanos = System.nanoTime();
upTimeMillis metodu
Açıklaması şöyle.
Returns milliseconds since boot, not counting time spent in deep sleep.