package se.blunden.xbmclauncher;

import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.ComponentName;
import android.content.Intent;
import android.os.Bundle;
import android.widget.Toast;

public class MainActivity extends Activity {
	
	private String activity = "org.xbmc.xbmc/org.xbmc.xbmc.Splash"; 
	
	private void launch()
	{
		Intent activityIntent = Intent.makeMainActivity(ComponentName.unflattenFromString(activity));
		try {
			startActivity(activityIntent);
			return;
		}
		catch (ActivityNotFoundException e)
		{
			Toast.makeText(this, "Activity " + activity + " not found", Toast.LENGTH_SHORT).show();
		}
	}

	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		launch();
		finish();
	}
}

@@ -181,16 +181,42 @@
 ntent;%0D%0A
+import android.os.Build;%0D%0A
 import a
@@ -230,24 +230,24 @@
 os.Bundle;%0D%0A
-
 import andro
@@ -440,80 +440,470 @@
 tent
- = Intent.makeMainActivity(ComponentName.unflattenFromString(activity));
+;%0D%0A%09%09%0D%0A%09%09// Intent.makeMainActivity is only available in API level 11 and above%0D%0A%09%09if(Build.VERSION.SDK_INT %3E= Build.VERSION_CODES.HONEYCOMB) %7B%0D%0A%09%09%09activityIntent = Intent.makeMainActivity(ComponentName.unflattenFromString(activity));%0D%0A%09%09%7D else %7B%0D%0A%09%09%09activityIntent = new Intent(Intent.ACTION_MAIN);%0D%0A            activityIntent.setComponent(ComponentName.unflattenFromString(activity));%0D%0A            activityIntent.addCategory(Intent.CATEGORY_LAUNCHER);%0D%0A%09%09%7D%0D%0A%09%09
 %0D%0A%09%09

Handle backward compatibility