27 Aralık 2015 Pazar

Android, URL adresinden text dosya okumak

new Thread() {
            @Override
            public void run() {
                String path ="http://host.com/info.txt";
                URL u = null;
                try {
                    u = new URL(path);
                    HttpURLConnection c = (HttpURLConnection) u.openConnection();
                    c.setRequestMethod("GET");
                    c.connect();
                    InputStream in = c.getInputStream();
                    final ByteArrayOutputStream bo = new ByteArrayOutputStream();
                    byte[] buffer = new byte[1024];
                    in.read(buffer); // Read from Buffer.
                    bo.write(buffer); // Write Into Buffer.

                    runOnUiThread(new Runnable() {
                        @Override
                        public void run() {
                            TextView text = (TextView) findViewById(R.id.TextView1);
                            text.setText(bo.toString());
                            try {
                                bo.close();
                            } catch (IOException e) {
                                e.printStackTrace();
                            }
                        }
                    });

                } catch (MalformedURLException e) {
                    e.printStackTrace();
                } catch (ProtocolException e) {
                    e.printStackTrace();
                } catch (IOException e) {
                    e.printStackTrace();
                }

            }
        }.start();

25 Mayıs 2015 Pazartesi

AppInventor ile IOIO LDR Analog Voltaj Okuma :

AppInventor ile IOIO LDR Analog Voltaj Okuma :

Devre :

Ekran Tasarımı :




Blok Diyagram :


Çıktı :

Ön Bilgi için örnek : App Inventor ile IOIO kullanımı

11 Mayıs 2015 Pazartesi

IOIO LDR Analog Voltaj Okuma

IOIO LDR Analog Voltaj Okuma :

AndroidManifest.xml :
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.BLUETOOTH" />
MainActivity.java :
public class MainActivity extends IOIOActivity {
    ToggleButton button_;
    TextView tv_;

    @Override    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        button_ = (ToggleButton) findViewById(R.id.toggleButton);
        tv_ = (TextView) findViewById(R.id.textView2);
    }
    class Looper extends BaseIOIOLooper {
        private DigitalOutput led_;
        private AnalogInput a_in;
        @Override        
        protected void setup() throws ConnectionLostException {
            led_ = ioio_.openDigitalOutput(0, true);
            a_in = ioio_.openAnalogInput(40);
        }
        @Override        
        public void loop() throws ConnectionLostException, InterruptedException {
            led_.write(!button_.isChecked());
            runOnUiThread(new Runnable() {
                @Override                public void run() {
                    try {
                        tv_.setText(String.format("%f", a_in.getVoltage()));
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    } catch (ConnectionLostException e) {
                        e.printStackTrace();
                    }
                }
            });
        }
    }
    protected IOIOLooper createIOIOLooper() {
        return new Looper();
    }
}

16 Mart 2015 Pazartesi

Android Studio HAXM hatası

Android Studio  kurulumu sonrası HAXM hatası için :

1. System BIOS ayarlarından Intel Virtualization Technology ayarını Enabled yapın

2. HAXM Installer yükleyin ve {SDK_FOLDER}\extras\intel\Hardware_Accelerated_Execution_Manager\intelhaxm.exe dosyasını çalıştırın.


8 Mart 2015 Pazar

LG G3 için Eclipse DDMS Sürücü Yükleme

  1. http://adbdriver.com/ adresinden Adb Driver Installer (9.0 MB) indir, çalıştır.
  2. USB yi tak ve sürücüyü kur.
  3. USB takılınca açılan USB PC bağlantı ayarını PTP olarak seç,
  4. USB kablosunu çıkar.
  5. Telefonun Ayarlar/Genel/Gelişirici Seçenekleri/USB Hata Ayıklama seç.
  6. USB yi tak. Gelen PC kodunu kabul et.