30 Temmuz 2015 Perşembe

Android - Any thread synchron to the MainThread

new Thread(new Runnable() {
  public void run() {
    //Write something code.
    Activity_Name.this.runOnUiThread(new Runnable() {
        @Override
        public void run() {
            EditText1.setText(""); <-- Here
        }
    });
    sendingMessage = "";
  }
}).start();

27 Temmuz 2015 Pazartesi

Java - Dialog remove title


  final Dialog dialog = new Dialog(view_animebolum.this.getApplicationContext());
  dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
  dialog.setContentView(R.layout.layout_sendcomment);

 dialog.show();

13 Temmuz 2015 Pazartesi

Android.os.NetworkOnMainThreadException Hatası ve Çözümü

Bu problemin 2 çözümü var.

1-Ana thread içinde network işlemleri yapıldığı için oluşur.Network işlemlerini Async Task içinde yapmak gerekir.

2-setContentView methodundan sonra aşağıdaki kodu ekleyin ve android.os.StrictMode import edin.

if (android.os.Build.VERSION.SDK_INT > 9)
{
  StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();           StrictMode.setThreadPolicy(policy);
}

Alıntı: http://abdullahcetinkaya.com/