8 Ağustos 2012 Çarşamba

Android de unzip yapabilen method.

private boolean unpackZip() {
    InputStream is;
    ZipInputStream zis;
    String path = Environment.getExternalStorageDirectory()
            .getAbsolutePath() + "/downloadFolder"; //sdcard ta zip dosyasının bulunduğu klasör
    String fileName = "music" + ".zip"; //zip dosyasi ismi tanımlanacak
    path += "/";
    try {
        is = new FileInputStream(path+fileName);
        zis = new ZipInputStream(new BufferedInputStream(is));
        ZipEntry ze;
       

        while ((ze = zis.getNextEntry()) != null) {
           
           
            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            byte[] buffer = new byte[1024];
            int count;


            String filename = ze.getName();
            File tmpFile = File.createTempFile(filename, "tmp");
            tmpFile.deleteOnExit();
            FileOutputStream fout = new FileOutputStream(path + filename);


            while ((count = zis.read(buffer)) != -1) {
                baos.write(buffer, 0, count);
                byte[] bytes = baos.toByteArray();
                fout.write(bytes);
                baos.reset();
            }

            fout.close();
            zis.closeEntry();
        }

        zis.close();
    } catch (IOException e) {
        e.printStackTrace();
        return false;
    }

    return true;
}

9 Temmuz 2012 Pazartesi

Android Layoutlarında Klavyenin Otomatik Gelmesi Sorunu Çözümü

  Android intentlerinde klavye gizlenmek eğer sizinde başınıza ağrıtan bir dert olmuşsa ve aradım araştırdım bulamıyorum çözümü çok basit :) Android androidmanifest.xml dosyası içerisindeki activitylerimizi aşağıda ki kodda belirttiğim android:windowSoftInputMode="stateHidden" kodunu klavyenin gizlenmesini istediğimiz activityinin içerisine yazmamız yeterli olacaktır.
   Kolay Gelsin.

<application
 android:icon="@drawable/big_app_icon"
 android:label="@string/app_name" >
 <activity
 android:name=".applicationActivity"
 android:label="@string/app_name" >
 <intent-filter>
 <action android:name="android.intent.action.MAIN" />
 <category android:name="android.intent.category.LAUNCHER" />
 </intent-filter>
 </activity>
 <activity
 android:name=".Comments"
 android:label="@string/app_name"
 android:windowSoftInputMode="stateHidden" >
 </activity>
</application>