Okay day 2 with Apple Music. Iam a bit disappointed. 1. The App for PC and Mac is bundled with Itunes...

Okay day 2 with Apple Music.
Iam a bit disappointed.
1. The App for PC and Mac is bundled with Itunes. Itunes itself is a really big piece of Software. The Music Feature feels jammed inside.
Example: You have the Itunes Store right next to your Music Flatrate. Or you have Playlists, but those Playlists are your old Playlists from Itunes. It feels very poor integrated.
2. There is no developer API for imports. So right now you cannot import your Playlists from other Music Streaming Services.
3. The iOS App hungs up and feel very slow. There is a 2-3sec delay when you tab a song and when you turn the Device it stutters noticeable.

You only get Synchronizing with your different Installations when you active Medialibrary Sharing.
I enabled it afterwards.. Classic migration bugs =D

I have seen code reviews, things that should be a collaborative, learning experience, subvert group ...

I have seen code reviews, things that should be a collaborative, learning experience, subvert group dynamics and result in negativity and hostility being paid forward. So, if you’re interested in a guide on how to do just that and how to turn optimistic, bright eyed developers into angry, cynical people, look no further, because I’m going to tell you.

One of the most enjoyable, and at times scary, things about working on my team is doing code reviews. They are mandatory no matter how "senior" you think you are. Better check that rank c&$p at the door. I sometimes catch myself thinking "better not add Mr. SoAndSo because he's going to point out all the ugly things in this pile of hacks I've been constructing here". It's those times where I just go back and try to make things less hacky. And then add that guy who would have the most objectively critical eye to look at the code change.

There's no better opportunity to grow and become just that much better. Every single day, if you can. Even after all these years. I don't think there's such a thing as those mythical 10,000 hours in our field.

How to Use a Code Review to Execute Someone’s Soul | DaedTech

Wow! I just fixed this weird Wifi Bug with my Nexus4 Phone. I noticed that everytime my Bluetooth was...

Wow! I
just fixed this weird Wifi Bug with my Nexus4 Phone. I noticed that everytime my Bluetooth was on my Wifi breaked down totally. The Icons were still in place but no Data was transfered.
After Booting in Safe Mode everything went fine again. In Normal Bootmode again its still Bugged. I digged into the Last Updated Apps and looked at all the Running Services.
I noticed that the App "barcoo" had gotten a new feature called "iBeacon". It uses the Bluetooth 4.0 Low Profile mode to notify you when youre near a shopping place, basicly it display advertisements when you standing in front of the shelf. So this App Feature apparantly bugs out. TL;DR if you have trouble with your Wifi when Bluetooth is enabled: check your Apps that uses Bluetooth Features and try do deactivate them. [#w]

For those who suffer from no sound after hibernate / sleep with a Intel HD-Audio Soundchip. I have this...

For those who suffer from no sound after hibernate / sleep with a Intel HD-Audio Soundchip.
I have this Setup on an GIGABYTE GA-C1037UN-EU.
Try this script, it will kill all soundapps and remove the intel soundmodule from the linux kernel.
After resuming the PC the script reloads the Module.

place the script in /etc/pm/sleep.d
call it 49_sound_fix

function kill_sound_apps() {
pidsnd=$(lsof | grep /dev/snd | awk '{ print $2 }')
pidmixer=$(lsof | grep /dev/mixer | awk '{ print $2 }')
piddsp=$(lsof | grep /dev/dsp | awk '{ print $2 }')
kill $pidsnd $pidmixer $piddsp

case "$1" in
modprobe -r snd_hda_intel
modprobe snd_hda_intel

exit $?

chmod +x /etc/pm/sleep.d/49_sound_fix

Setting up a Socks Proxy over SSH on Windows If we wanna open the Tunnel automatically on Startup we...

Setting up a Socks Proxy over SSH on Windows

If we wanna open the Tunnel automatically on Startup we need passwordless ssh login with Private/Public Keys
For this use puttygen.exe from http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html

Get plink.exe to
Its a command line interface for putty

First create a new Key pair with Puttygen.exe, add the public key to your servers .ssh/authorized_keys
If the .ssh directory doesnt exist, use ssh example.com and say Yes

Store the private Key on your PC.

plink.exe -ssh <proxyIp> -l <user> -i <path/to/privateKey.ppk> -D <localport> -N
we create the Tunnel, -N supresses the login shell

we now could simple put that in a .bat file and run it on startup, but it would spawn a cmd shell that must stay open.

A better solution is a Windows Service,

load the Windows Server 2003 Resource Kit Tools

Swith into the Tools Directory with a root cmd shell
instsrv.exe <TunnelServiceName> <fullPathTo>srvany.exe

The Service is now installed, we need to configure it.

save that as *.reg file

Windows Registry Editor Version 5.00

"AppParameters"="-ssh <proxyIp> -l <user> -i <path/to/privateKey.ppk> -D <localport> -N"

Now the Service automatically Starts on Bootup and opens the Tunnel. On Standby or Hibernation though, the Tunnel just collapse.
For this we need to Trigger a Service Restart on relogging. We could also react on the Power event but that covers not all Power Saving Features.


<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
    <Principal id="Author">
  <Actions Context="Author">
      <Arguments>stop ###ServiceName###</Arguments>
      <Arguments>start ###ServiceName###</Arguments>

Now we can use localhost <Port> as Socks5 Proxy, Cool! =)

PuTTY Download Page

Displaying the correct Size of a Samba Share with 2 Harddrives

Add this to your Samba Share definition inside /etc/samba/smb.conf

dfree command = /usr/local/bin/dfree.sh

HDD1total=`df $1 | tail -1 | awk '{print $(NF-4)}'`
HDD2total=`df /path/to/secondHDD | tail -1 | awk '{print $(NF-4)}'`

HDD1av=`df $1 | tail -1 | awk '{print $(NF-2)}'`
HDD2av=`df /path/to/secondHDD | tail -1 | awk '{print $(NF-2)}'`

echo $((HDD1total + HDD2total)) $((HDD1av + HDD2av))
Samba now uses the custom dfree script to determine the Available and Total space for that Samba share.

Google Maps -> MapView -> creation of a constructor -> RuntimeException

I try to write one application for Google Maps.

Tell me, what is my mistake?

If you write like this, all of the works, the card is loaded.

public class TravelMapActivity extends MapActivity {
  private MapView mapView;

    protected void onCreate(Bundle savedInstanceState) {
        mapView = (MapView)findViewById(R.id.travelMapView);

And if you create a constructor, I get these errors here.

protected void onCreate(Bundle savedInstanceState) {
    mapView = new MapView(this, getResources().getString(R.string.google_maps_api_key));

 java.lang.RuntimeException: Unable to start activity ComponentInfo{de.ai.mi.maptrack/de.ai.mi.maptrack.activities.TravelMapActivity}: java.lang.IllegalStateException: You are only allowed to have a single MapView in a MapActivity

 Caused by: java.lang.IllegalStateException: You are only allowed to
 have a single MapView in a MapActivity



With the v1 google maps android api you only allowed one MapView at a time. You instantiate one MapView in your XML travel_map_activity i guess, so when you try to create another one with

mapView = new MapView(this, getResources().getString(R.string.google_maps_api_key));

you get the Exception. Try remove the MapView from the XML to solve this.

New Google Maps API for Android #android   #androiddev A new Google Maps API is available for Android...

New Google Maps API for Android
#android   #androiddev  

A new Google Maps API is available for Android. It brings long awaited features such as vector-based 2D maps, 3D maps and fragments support. Go check it out!


Android Developers Blog: New Google Maps Android API now part of Google Play services

#androiddev #droidcon #polaris #clustering  I've had to hack quite a few things into Google Maps for...

#androiddev #droidcon #polaris #clustering 

I've had to hack quite a few things into Google Maps for various Android projects and I always meant to open source something but never quite got round to it. Now that +Cyril Mottier has produced this fine Polaris project (enjoyed your Droidcon UK project btw!) I thought I'd contribute a cool and often requested maps feature: Clustering.

If you're already using Polaris and want to enable clustering all you have to do is create a Clusterer object and feed it your original Annotations (OverlayItems) and it will give you back a reduced set (replacing overlapping ones with cluster spots) so that you can add them to your PolarisMapView.

You can optionally create a custom ClusterConfig object which tells the clusterer the thresholds for low, medium & high cluster spots) e.g. 

Clusterer clusterer = new Clusterer(mMapView, annotations, new ClusterConfig(4, 8));
    mMapView.setAnnotations(clusterer.getClusters(), R.drawable.map_pin_holed_blue);

If you need it now, then you can take a look at:

with sample apk here:

I already sent a pull request to Cyrill. Hopefully it will be integrated into Polaris proper when he gets some free time :)

Android BroadcastReceiver: run it on default process or in a new one?

I have an application with two Broadcast Receivers, one of them to receive data and the other one to send it. I've seen that they have an attribute android:process to make them run on the application's default process or in another one. In the examples I found using google, receivers were set to run in the process ":remote".

My question is, what are the advantages and disadvantages of using each option?


Using a different Process than the Default Process of the Application is handy when you want to share ressources with another Application.

Todo so you need to arrange two Applications with the same processname, if your processname begins with an lowerchar a global process is spawned. If it begins with a colon : than the process is private. Keep in mind that to share a process between two apps you need the same userID and the same app certificate.

You also have to load ressources only once and get benefits in memory consumption.

for more information

Android database transactions

I am new to Android programming and am trying to understand the best practices.

I want to do multiple inserts into two different database tables, but as one transaction (as the tables shared a foreign key). I want my function to return a result so that I can display a Toast or something to say that an error occurred, otherwise I want to return the row ID of the first insert.

I believe one way of doing this is sort-of as follows (Disclaimer: psuedo-ish code, probably won't compile!):

Long result = -1;
try {
   // Insert into first table
   ContentValue someValues = new ContentValues();
   someValues.put("dbfield1", 1);
   result = myDatabase.insert(DATABASE_TABLE_1, null, someValues);

   if (-1 != result ) {         
       // Insert into second table
       someValues.put("dbfield2", 2);

       if( myDatabase.insert(DATABASE_TABLE_2, null, someValues) < 0 ) {
           result = -1;

} catch(Exception e) {
    // An error occurred
    result = -1;
} finally {

Is there a simpler/better way of doing this?


You can override bulkInsert inside your ContentProvider your Code looks fine. The Method should return the inserted Rows Value but you can customize that so you return only the first ID.

public int bulkInsert(Uri uri, ContentValues[] values) {
    Log.e("BULK", "Bulk insert started for URI" + uri.toString());
    bulkSqlDB = database.getWritableDatabase();
    int numInserted;

    try {
        for (ContentValues cv : values) {
            insert(uri, cv);
        numInserted = values.length;
    } finally {
        getContext().getContentResolver().notifyChange(uri, null);
    return numInserted;

Jelly Bean android.R.id.content changed?

i recently tested my App on a Jelly Bean device and noticed that my Actionbar Dodging Code doesnt work anymore.

I have a transparent Actionbar with OverlayMode true but want to behave the Actionbar like a solid actionbar in some of my Screens.

To make this working i have borrowed some Code from the Honeycomb Gallery Code

Basicly i check the Acionbar Height and set the topMargin of the android.R.id.content bucket to this value.

  public void setupActionbar() {
    final int sdkVersion = Build.VERSION.SDK_INT;
    int barHeight = getSupportActionBar().getHeight();
      if (sdkVersion < Build.VERSION_CODES.HONEYCOMB) {
        FrameLayout content = (FrameLayout) findViewById(android.R.id.content);
        RelativeLayout.LayoutParams params = (android.widget.RelativeLayout.LayoutParams) content.getLayoutParams();

        if (params.topMargin != barHeight) {
          params.topMargin = barHeight;

        if (!getSupportActionBar().isShowing()) {
          params.topMargin = 0;
      } else {
        FrameLayout content = (FrameLayout) findViewById(android.R.id.content);
        LayoutParams params = content.getLayoutParams();
        if (params instanceof RelativeLayout.LayoutParams) {
          android.widget.RelativeLayout.LayoutParams lp = (RelativeLayout.LayoutParams) params;
          if (lp.topMargin != barHeight) {
            lp.topMargin = barHeight;

          if (!getActionBar().isShowing()) {
            lp.topMargin = 0;
        } else if (params instanceof FrameLayout.LayoutParams) {
          FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) params;
          if (lp.topMargin != barHeight) {
            lp.topMargin = barHeight;

          if (!getActionBar().isShowing()) {
            lp.topMargin = 0;


In Jelly Beans this strategy doesnt work anymore for some reason. Did Jelly Bean change the id.content Container perhabs?


Ok answering my own Question here. First i had a typo in my Code:

content.setLayoutParams(params); should read

But the real Problem was that

FrameLayout content = (FrameLayout) findViewById(android.R.id.content);

provide the View of the whole Screen, including the Statusbar. Only on Android 4.1 Jelly Bean

View content = ((ViewGroup) findViewById(android.R.id.content)).getChildAt(0);

gives the RootContentView that needs to be pushed under the Transparent Actionbar.

Actionbarsherlock switch Actionbar Overlay Mode programmatic

i use Actionbarsherlock for my App and i like to switch the Actionbar Overlay Mode in my Code. I have 2 Fragments (one is a Mapview where i want a translucent Actionbar) the other is a ListFragment where a solid Actionbar is needed.

i tryed

requestWindowFeature((int) Window.FEATURE_ACTION_BAR & ~Window.FEATURE_ACTION_BAR_OVERLAY);

problem with this is that requesting Features only works before content is added.

i using this style to accomplish the transparent Actionbar

<style name="TransparentActionbar" parent="@style/Theme.Sherlock" xmlns:android="http://schemas.android.com/apk/res/android">
    <item name="windowActionBarOverlay">true</item>
    <item name="windowActionModeOverlay">true</item>
    <item name="abBackground">#96000000</item>
    <item name="abDivider">@null</item>

is there a way to set

<item name="windowActionBarOverlay">true</item>
<item name="windowActionModeOverlay">true</item>

to false inside the Activity/Fragment?


Edit: Sadly it doesnt work for Actionbarsherlock and a ListFragment from the Compatibility Package. Top Margin is added to the Bottom Margin for some reason. Left and Right Margin working fine inside the LayoutListener.

Found a solution for this Problem in an Android Developer Example

// Attach a GlobalLayoutListener so that we get a callback when the layout
// has finished drawing. This is necessary so that we can apply top-margin
// to the ListView in order to dodge the ActionBar. Ordinarily, that's not
// necessary, but we've set the ActionBar to "overlay" mode using our theme,
// so the layout does not account for the action bar position on its own.
ViewTreeObserver observer = getListView().getViewTreeObserver();

// Because the fragment doesn't have a reliable callback to notify us when
// the activity's layout is completely drawn, this OnGlobalLayoutListener provides
// the necessary callback so we can add top-margin to the ListView in order to dodge
// the ActionBar. Which is necessary because the ActionBar is in overlay mode, meaning
// that it will ordinarily sit on top of the activity layout as a top layer and
// the ActionBar height can vary. Specifically, when on a small/normal size screen,
// the action bar tabs appear in a second row, making the action bar twice as tall.
ViewTreeObserver.OnGlobalLayoutListener layoutListener = new ViewTreeObserver.OnGlobalLayoutListener() {
    public void onGlobalLayout() {
        int barHeight = getActivity().getActionBar().getHeight();
        ListView listView = getListView();
        FrameLayout.LayoutParams params = (LayoutParams) listView.getLayoutParams();
        // The list view top-margin should always match the action bar height
        if (params.topMargin != barHeight) {
            params.topMargin = barHeight;
        // The action bar doesn't update its height when hidden, so make top-margin zero
        if (!getActivity().getActionBar().isShowing()) {
          params.topMargin = 0;