Thursday, 11 December 2014

Blog is moving to another place, better place

Hi, I am going to write further posts in different url: http://blog.mokrzycki.io/
I decided to move out from blogger to wordpress because I couldn't store any pics or videos. Everytime I had to upload stuff somewhere out of blogger where I wasn't able control it in 100%.
See you there, feel free post there! 
 _      _                                     _                             _     _     _        
| |__  | |  ___    __ _     _ __ ___    ___  | | __ _ __  ____ _   _   ___ | | __(_)   (_)  ___  
| '_ \ | | / _ \  / _` |   | '_ ` _ \  / _ \ | |/ /| '__||_  /| | | | / __|| |/ /| |   | | / _ \ 
| |_) || || (_) || (_| | _ | | | | | || (_) ||   < | |    / / | |_| || (__ |   < | | _ | || (_) |
|_.__/ |_| \___/  \__, |(_)|_| |_| |_| \___/ |_|\_\|_|   /___| \__, | \___||_|\_\|_|(_)|_| \___/ 
                  |___/                                        |___/                             

Tuesday, 18 November 2014

Coca Cola Club/House 2003 collection - names of tracks

Many years ago Coca Cola was giving away for free collection with cool club/house music.I am not sure if is it possible to get that CD from the web but here is that list (hope it will help someone who was lurking around for that great tracks!).

1. Moguai - U know y
2. Spiller - Cry baby
3. Big world meets Gerald - Love is like music
4. Phil Fuldner - Miami pop
5. The goodfallas - Soul heaven
6. David Chong - I love
7. Tomy Novy - I rock
8. Millan & D`Attis - Lift me up
9. Nalin inc. - Planet violet
10. Frank Moiraghi - The sound

Monday, 10 November 2014

com.android.support:appcompat-v7:21.+ and aapt.exe has stopped - solution

If you are occurring still error dialogs after you implemented
compile 'com.android.support:appcompat-v7:21.+' 
in your project, it might means you forget set build tools to the latest version. To fix that, you should go to your gradle.build file and change version in buildToolsVersion param i.e. to 21.1.1 (remember to update your sdk!).

Example:

 android {  
   compileSdkVersion 21  
   buildToolsVersion "21.1.1"//<--------------------!!!  
   defaultConfig {  
     applicationId "com.example.project"  
     minSdkVersion 14  
     targetSdkVersion 21  
     versionCode 1  
     versionName "1.0"  
   }  
   buildTypes {  
     release {  
       runProguard false  
       proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'  
     }  
   }  
 }  
 dependencies {  
   compile fileTree(dir: 'libs', include: ['*.jar'])  
   compile 'org.jsoup:jsoup:1.7.2'  
   compile 'com.android.support:appcompat-v7:21.+'  
 }  

Sunday, 9 November 2014

Problem with update android studio due modified file device-art.xml studio64.exe.vmoptions - rescue text !

Here is a default source of device-art.xml in case of problem with updating android studio to new version
http://pastebin.com/PyZWYv0E

Here is a default source of studio64.exe.vmoptions in case of problem with updating android studio to new version
http://pastebin.com/HrWmusZZ

Friday, 17 October 2014

Intent chooser - custom action button - example

Without saying empty words...
First we need make own Activity which will handle our action - in my example it will be a plain text which will be stored into android clipboard.

First our clipboard activity:

 public class ClipActivity extends Activity {  
   
   public static final String TAG = ClipActivity.class.getSimpleName();  
   
   @Override  
   protected void onCreate(Bundle savedInstanceState) {  
     super.onCreate(savedInstanceState);  
   
     if (getIntent().getExtras() != null) {  
       //just listing keys and values  
       for (String s : getIntent().getExtras().keySet()) {  
         Log.d(TAG, s + " " + getIntent().getExtras().getString(s));  
       }  
   
       //copying our text to android clipboard  
       if (getIntent().hasExtra("android.intent.extra.TEXT")) {  
         ClipboardManager cm = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);  
         ClipData cd = ClipData.newPlainText("clipboard", getIntent().getExtras().getString("android.intent.extra.TEXT"));  
         cm.setPrimaryClip(cd);  
       }  
     }  
     Toast.makeText(this, "Copied by our app :)", Toast.LENGTH_SHORT).show();  
     finish();  
   }  
   
 }  

The second step is to declare our action intent in our manifest file.

 <activity android:name=".ClipActivity" android:noHistory="true" >  
      <intent-filter android:icon="@android:drawable/ic_dialog_alert" android:label="My label">  
           <action android:name="android.intent.action.SEND"/>  
           <category android:name="android.intent.category.DEFAULT"/>  
           <data android:mimeType="text/plain"/>  
      </intent-filter>  
 </activity>  

However it is possible your action will blink while action -> open activity-copy to clipboard-kill activity.

So you should use transculent theme like that:

     <activity android:name=".ClipActivity" android:noHistory="true" android:theme="@android:style/Theme.Translucent">  
       <intent-filter android:icon="@android:drawable/ic_dialog_alert" android:label="My label">  
         <action android:name="android.intent.action.SEND"/>  
         <category android:name="android.intent.category.DEFAULT"/>  
         <data android:mimeType="text/plain"/>  
       </intent-filter>  
     </activity>  

Now it's the matter of call our intent chooser :)

 Intent intent = new Intent();  
 intent.setAction(Intent.ACTION_SEND);  
 intent.putExtra(Intent.EXTRA_TEXT, "This is my text to copy.");  
 intent.setType("text/plain");  
   
 Intent chooser = Intent.createChooser(intent, "My Intent Chooser");  
   
 if(intent.resolveActivity(getActivity().getPackageManager()) !=null)  
      getActivity().startActivity(chooser);  

So as you see, it's nothing hard as it could be.

Saturday, 4 October 2014

OnLoadFinished() called twice - solution

Recently I was learning cursor adapters and I've noticed strange thing with them. My last project was about parsing colors from colourlovers page and generate  custom views with colors values.

What I noticed was that, the cursorloaders existing in my fragment were called twice instead once.
I checked some posts about it and I found solution. IMHO you must always destroy loadmanagers when you don't want make them run twice. So here is just short snippet how to.

First you call your cursor loader somewhere in onActivityCreated in fragment:

 getLoaderManager().initLoader(0, null, this);   


And then somewhere in onStop in fragment you call:

 getLoaderManager().destroyLoader(0);  

Sunday, 28 September 2014

Git ignores my folder - here is a solution (for me it was : git ignored my drawable-xxxx folder with files)

I am not good in writing long posts so.. here is a short example and solution for that problem.
Be sure you have already checked .gitignore files, and you are sure it is not .gitignore files problem.

First, please write this code in console - to get list of ignored files:

 git status --ignored  

 # On branch master  
 # Ignored files:  
 #  (use "git add -f <file>..." to include in what will be committed)  
 #  
 #    ../../../.gradle/  
 #    ../../../.idea/  
 #    ../../app.iml  
 #    ../../build/  
 #    res/drawable-hdpi/  
 #    res/drawable-ldpi/  
 #    res/drawable-mdpi/  
 #    res/drawable-xhdpi/  
 #    res/drawable-xxhdpi/  
 #    res/drawable-xxxhdpi/  
 #    ../../../build/  
 #    ../../../java_pid5188.hprof  
 #    ../../../java_pid5940.hprof  
 #    ../../../local.properties  
 #    ../../../prawo-g.iml  

As you see, somehow res/drawable-xxxx is ignored..
So let's add it again by this command:

 git add --force .\res  

And let's see again our ignore list...

 git status --ignored  


 # On branch master  
 # Ignored files:  
 #  (use "git add -f <file>..." to inclu  
 #  
 #    ../../../.gradle/  
 #    ../../../.idea/  
 #    ../../app.iml  
 #    ../../build/  
 #    ../../../build/  
 #    ../../../java_pid5188.hprof  
 #    ../../../java_pid5940.hprof  
 #    ../../../local.properties  
 #    ../../../prawo-g.iml  

Voila! Our missing files were added back to revision.
Dont forget to use later commands:

 git add -A   
 git commit -am "added missing files in revision"