Skip to content

Instantly share code, notes, and snippets.

<?xml version="1.0" encoding="utf-8"?>
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
android:src="@drawable/background"
android:tileMode="repeat" />
@levinotik
levinotik / gist:2501615
Created April 26, 2012 18:20
Google Code Jam Solution
# this solves google code jam problem found here: http://code.google.com/codejam/contest/1460488/dashboard#s=p0
require 'pp'
#create map using the sample input and output
input = "ejp mysljylc kd kxveddknmc re jsicpdrysi
rbcpc ypc rtcsra dkh wyfrepkym veddknkmkrkcd
de kr kd eoya kw aej tysr re ujdr lkgc jv".
strip.gsub("\n", '').gsub(" ", '').squeeze('').chars.to_a
output = "our language is impossible to understand there are
<style name="Theme.MyApp.Light.DarkActionBar.Tabs">
<item name="vpiCirclePageIndicatorStyle">@style/Widget.CirclePageIndicator</item>
<item name="vpiTitlePageIndicatorStyle">@style/Widget.TitlePageIndicator</item>
<item name="vpiTabPageIndicatorStyle">@style/Widget.TabPageIndicator</item>
<item name="vpiTabTextStyle">@style/Widget.MyApp.TabPageIndicator.Text.Black</item>
</style>
E/AndroidRuntime(17276): Caused by: android.view.InflateException: Binary XML file line #5: Error inflating class fragment
E/AndroidRuntime(17276): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:587)
E/AndroidRuntime(17276): at android.view.LayoutInflater.rInflate(LayoutInflater.java:623)
E/AndroidRuntime(17276): at android.view.LayoutInflater.inflate(LayoutInflater.java:408)
E/AndroidRuntime(17276): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
E/AndroidRuntime(17276): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
E/AndroidRuntime(17276): at com.actionbarsherlock.internal.ActionBarSherlockCompat.setContentView(ActionBarSherlockCompat.java:850)
E/AndroidRuntime(17276): at com.actionbarsherlock.app.SherlockFragmentActivity.setContentView(SherlockFragmentActivity.java:309)
E/AndroidRuntime(17276): at com.jamsession.ln.android.activities.LoginActivity.onCreate(LoginActivity.java:27)
E/AndroidRuntime(17276): at android.app.Instrumentation.callActi
E/AndroidRuntime(28709): FATAL EXCEPTION: main
E/AndroidRuntime(28709): java.lang.NullPointerException
E/AndroidRuntime(28709): at android.support.v4.app.DialogFragment.dismissInternal(DialogFragment.java:163)
E/AndroidRuntime(28709): at android.support.v4.app.DialogFragment.dismiss(DialogFragment.java:149)
E/AndroidRuntime(28709): at com.jamsession.ln.android.fragments.CreateProfileFragment$1$1.run(CreateProfileFragment.java:55)
E/AndroidRuntime(28709): at android.app.Activity.runOnUiThread(Activity.java:3725)
E/AndroidRuntime(28709): at com.jamsession.ln.android.fragments.CreateProfileFragment$1.gotLocation(CreateProfileFragment.java:52)
E/AndroidRuntime(28709): at com.jamsession.ln.android.mylib.MyLocation$1.onLocationChanged(MyLocation.java:50)
E/AndroidRuntime(28709): at android.location.LocationManager$ListenerTransport._handleMessage(LocationManager.java:227)
E/AndroidRuntime(28709): at android.location.LocationManager$ListenerTransport.access$000(LocationManager.java:160)
@levinotik
levinotik / AndroidConversions.scala
Created May 16, 2012 17:57 — forked from pfn/AndroidConversions.scala
AndroidConversions.scala
package com.hanhuy.android.irc
import android.app.Activity
import android.app.ActionBar
import android.content.Intent
import android.content.Context
import android.content.BroadcastReceiver
import android.content.res.Configuration
import android.os.AsyncTask
import android.os.Build
package com.example.myandroid;
import android.app.Activity
import android.app.ActionBar
import android.content.Intent
import android.content.Context
import android.content.BroadcastReceiver
import android.content.res.Configuration
import android.os.AsyncTask
class MyView(c: Context) extends RelativeLayout(c) {
import AndroidConversions._;
val tv = new TextView(c)
var params = new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)
params.addRule(RelativeLayout.CENTER_IN_PARENT)
tv.setLayoutParams(params)
tv.setText("hello")
tv.setId(10)
addView(tv)
class MyTask extends AsyncTask[Void, Void, Void] {
def doInBackground(params: Void*): Unit = {
}
}
class MyTask extends AsyncTask[Void, Void, Void] {
def doInBackground(params: Void*) {
<service android:name="com.me.services.MusicService">
<intent-filter>
<action android:name="com.me.action.NOTIFY_WIFI_CHANGE"/>
</intent-filter>
</service>
public void onReceive(Context context, Intent intent) {
Intent notifyIntent = new Intent(MusicService.ACTION_NOTIFY_WIFI_CHANGE);
notifyIntent.putExtra("have_connection", mHaveConnection);