Kankan's android picker view - android

Does anybody know how to install this kankan's android project in my app.
http://code.google.com/p/android-wheel/
There is no installation guide.
UPDATED
After adding wheel.jar file in my project I try to run it but it gave me following runtime exception
12-13 18:17:13.682: E/AndroidRuntime(306): Uncaught handler: thread main exiting due to uncaught exception
12-13 18:17:13.712: E/AndroidRuntime(306): java.lang.NoClassDefFoundError: kankan.wheel.R$drawable
12-13 18:17:13.712: E/AndroidRuntime(306): at kankan.wheel.widget.WheelView.initResourcesIfNecessary(WheelView.java:427)
12-13 18:17:13.712: E/AndroidRuntime(306): at kankan.wheel.widget.WheelView.calculateLayoutWidth(WheelView.java:482)
12-13 18:17:13.712: E/AndroidRuntime(306): at kankan.wheel.widget.WheelView.onMeasure(WheelView.java:518)
12-13 18:17:13.712: E/AndroidRuntime(306): at android.view.View.measure(View.java:7964)
12-13 18:17:13.712: E/AndroidRuntime(306): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3023)
12-13 18:17:13.712: E/AndroidRuntime(306): at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:888)
12-13 18:17:13.712: E/AndroidRuntime(306): at android.widget.LinearLayout.measureHorizontal(LinearLayout.java:619)
12-13 18:17:13.712: E/AndroidRuntime(306): at android.widget.LinearLayout.onMeasure(LinearLayout.java:280)
12-13 18:17:13.712: E/AndroidRuntime(306): at android.view.View.measure(View.java:7964)
12-13 18:17:13.712: E/AndroidRuntime(306): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3023)
12-13 18:17:13.712: E/AndroidRuntime(306): at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:888)
12-13 18:17:13.712: E/AndroidRuntime(306): at android.widget.LinearLayout.measureVertical(LinearLayout.java:350)
12-13 18:17:13.712: E/AndroidRuntime(306): at android.widget.LinearLayout.onMeasure(LinearLayout.java:278)
12-13 18:17:13.712: E/AndroidRuntime(306): at android.view.View.measure(View.java:7964)
12-13 18:17:13.712: E/AndroidRuntime(306): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3023)
12-13 18:17:13.712: E/AndroidRuntime(306): at android.widget.FrameLayout.onMeasure(FrameLayout.java:245)
12-13 18:17:13.712: E/AndroidRuntime(306): at android.view.View.measure(View.java:7964)
12-13 18:17:13.712: E/AndroidRuntime(306): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3023)
12-13 18:17:13.712: E/AndroidRuntime(306): at android.widget.FrameLayout.onMeasure(FrameLayout.java:245)
12-13 18:17:13.712: E/AndroidRuntime(306): at android.view.View.measure(View.java:7964)
12-13 18:17:13.712: E/AndroidRuntime(306): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3023)
12-13 18:17:13.712: E/AndroidRuntime(306): at android.widget.FrameLayout.onMeasure(FrameLayout.java:245)
12-13 18:17:13.712: E/AndroidRuntime(306): at android.view.View.measure(View.java:7964)
12-13 18:17:13.712: E/AndroidRuntime(306): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3023)
12-13 18:17:13.712: E/AndroidRuntime(306): at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:888)
12-13 18:17:13.712: E/AndroidRuntime(306): at android.widget.LinearLayout.measureVertical(LinearLayout.java:350)
12-13 18:17:13.712: E/AndroidRuntime(306): at android.widget.LinearLayout.onMeasure(LinearLayout.java:278)
12-13 18:17:13.712: E/AndroidRuntime(306): at android.view.View.measure(View.java:7964)
12-13 18:17:13.712: E/AndroidRuntime(306): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3023)
12-13 18:17:13.712: E/AndroidRuntime(306): at android.widget.FrameLayout.onMeasure(FrameLayout.java:245)
12-13 18:17:13.712: E/AndroidRuntime(306): at android.view.View.measure(View.java:7964)
12-13 18:17:13.712: E/AndroidRuntime(306): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3023)
12-13 18:17:13.712: E/AndroidRuntime(306): at android.widget.FrameLayout.onMeasure(FrameLayout.java:245)
12-13 18:17:13.712: E/AndroidRuntime(306): at android.view.View.measure(View.java:7964)
12-13 18:17:13.712: E/AndroidRuntime(306): at android.widget.LinearLayout.measureVertical(LinearLayout.java:464)
12-13 18:17:13.712: E/AndroidRuntime(306): at android.widget.LinearLayout.onMeasure(LinearLayout.java:278)
12-13 18:17:13.712: E/AndroidRuntime(306): at android.view.View.measure(View.java:7964)
12-13 18:17:13.712: E/AndroidRuntime(306): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3023)
12-13 18:17:13.712: E/AndroidRuntime(306): at android.widget.FrameLayout.onMeasure(FrameLayout.java:245)
12-13 18:17:13.712: E/AndroidRuntime(306): at android.view.View.measure(View.java:7964)
12-13 18:17:13.712: E/AndroidRuntime(306): at android.view.ViewRoot.performTraversals(ViewRoot.java:763)
12-13 18:17:13.712: E/AndroidRuntime(306): at android.view.ViewRoot.handleMessage(ViewRoot.java:1633)
12-13 18:17:13.712: E/AndroidRuntime(306): at android.os.Handler.dispatchMessage(Handler.java:99)
12-13 18:17:13.712: E/AndroidRuntime(306): at android.os.Looper.loop(Looper.java:123)
12-13 18:17:13.712: E/AndroidRuntime(306): at android.app.ActivityThread.main(ActivityThread.java:4363)
12-13 18:17:13.712: E/AndroidRuntime(306): at java.lang.reflect.Method.invokeNative(Native Method)
12-13 18:17:13.712: E/AndroidRuntime(306): at java.lang.reflect.Method.invoke(Method.java:521)
12-13 18:17:13.712: E/AndroidRuntime(306): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
12-13 18:17:13.712: E/AndroidRuntime(306): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
12-13 18:17:13.712: E/AndroidRuntime(306): at dalvik.system.NativeStart.main(Native Method)

You can Download the code using this link. http://tortoisesvn.net/downloads.html.
After installation you copy the url and download entire project.

The kankan wheel project is an Android library so you can include it directly into your android project without having to copy the source and resource files.
This is how the wheel-demo project does it. Use the wheel-demo project as a guideline to setup your project to use the wheel project as a library.
If you are using Eclipse, do the following:
Import the kankan wheel project into Eclipse
Open the properties for the Eclipse Android project you wish to use the kankan wheel library
Select Android from the list of properties
Go to the bottom of the right hand screen to the library section
Press Add and select wheel
You are now good to go.

Checkout this source using SVN: http://android-wheel.googlecode.com/svn/trunk/ , it will download this source code in your local machine.
Once you are done with downloading, copy and paste the necessary classes in your project, and declare all the activity classes inside the AndroidManifest.xml file.

Related

How do I Debug this on Android?. Stack Trace from Logcat Below

This is the entire stacktace from Logcat. I'm basically using the twitter4j library. I've added my tokens and secrets from the twitter dev site. Can you Help me Debug this?
The code is mostly based on http://www.androidhive.info/2012/09/android-twitter-oauth-connect-tutorial/
Thanks!
12-13 16:38:22.225: E/AndroidRuntime(12659): FATAL EXCEPTION: main
12-13 16:38:22.225: E/AndroidRuntime(12659): Process: code.laerstudios.gappa, PID: 12659
12-13 16:38:22.225: E/AndroidRuntime(12659): android.os.NetworkOnMainThreadException
12-13 16:38:22.225: E/AndroidRuntime(12659):at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1145)
12-13 16:38:22.225: E/AndroidRuntime(12659): at java.net.InetAddress.lookupHostByName(InetAddress.java:385)
12-13 16:38:22.225: E/AndroidRuntime(12659): at java.net.InetAddress.getAllByNameImpl(InetAddress.java:236)
12-13 16:38:22.225: E/AndroidRuntime(12659): at java.net.InetAddress.getAllByName(InetAddress.java:214)
12-13 16:38:22.225: E/AndroidRuntime(12659): at com.android.okhttp.internal.Dns$1.getAllByName(Dns.java:28)
12-13 16:38:22.225: E/AndroidRuntime(12659): at com.android.okhttp.internal.http.RouteSelector.resetNextInetSocketAddress(RouteSelector.java:216)
12-13 16:38:22.225: E/AndroidRuntime(12659): at com.android.okhttp.internal.http.RouteSelector.next(RouteSelector.java:122)
12-13 16:38:22.225: E/AndroidRuntime(12659): at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:292)
12-13 16:38:22.225: E/AndroidRuntime(12659): at com.android.okhttp.internal.http.HttpEngine.sendSocketRequest(HttpEngine.java:255)
12-13 16:38:22.225: E/AndroidRuntime(12659): at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:206)
12-13 16:38:22.225: E/AndroidRuntime(12659): at com.android.okhttp.internal.http.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:345)
12-13 16:38:22.225: E/AndroidRuntime(12659): at com.android.okhttp.internal.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:89)
12-13 16:38:22.225: E/AndroidRuntime(12659): at com.android.okhttp.internal.http.HttpURLConnectionImpl.getOutputStream(HttpURLConnectionImpl.java:197)
12-13 16:38:22.225: E/AndroidRuntime(12659): at com.android.okhttp.internal.http.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:254)
12-13 16:38:22.225: E/AndroidRuntime(12659): at twitter4j.internal.http.HttpClientImpl.request(HttpClientImpl.java:135)
12-13 16:38:22.225: E/AndroidRuntime(12659): at twitter4j.internal.http.HttpClientWrapper.request(HttpClientWrapper.java:61)
12-13 16:38:22.225: E/AndroidRuntime(12659): at twitter4j.internal.http.HttpClientWrapper.post(HttpClientWrapper.java:98)
12-13 16:38:22.225: E/AndroidRuntime(12659): at twitter4j.auth.OAuthAuthorization.getOAuthRequestToken(OAuthAuthorization.java:122)
12-13 16:38:22.225: E/AndroidRuntime(12659): at twitter4j.auth.OAuthAuthorization.getOAuthRequestToken(OAuthAuthorization.java:104)
12-13 16:38:22.225: E/AndroidRuntime(12659): at twitter4j.TwitterBaseImpl.getOAuthRequestToken(TwitterBaseImpl.java:298)
12-13 16:38:22.225: E/AndroidRuntime(12659): at code.laerstudios.gappa.MainActivity.loginToTwitter(MainActivity.java:225)
12-13 16:38:22.225: E/AndroidRuntime(12659): at code.laerstudios.gappa.MainActivity.access$0(MainActivity.java:212)
12-13 16:38:22.225: E/AndroidRuntime(12659): at code.laerstudios.gappa.MainActivity$1.onClick(MainActivity.java:153)
12-13 16:38:22.225: E/AndroidRuntime(12659): at android.view.View.performClick(View.java:4438)
12-13 16:38:22.225: E/AndroidRuntime(12659): at android.view.View$PerformClick.run(View.java:18422)
12-13 16:38:22.225: E/AndroidRuntime(12659): at android.os.Handler.handleCallback(Handler.java:733)
12-13 16:38:22.225: E/AndroidRuntime(12659): at android.os.Handler.dispatchMessage(Handler.java:95)
12-13 16:38:22.225: E/AndroidRuntime(12659): at android.os.Looper.loop(Looper.java:136)
12-13 16:38:22.225: E/AndroidRuntime(12659): at android.app.ActivityThread.main(ActivityThread.java:5019)
12-13 16:38:22.225: E/AndroidRuntime(12659): at java.lang.reflect.Method.invoke(Native Method)
12-13 16:38:22.225: E/AndroidRuntime(12659): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
12-13 16:38:22.225: E/AndroidRuntime(12659): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
12-13 16:38:25.449: I/Process(12659): Sending signal. PID: 12659 SIG: 9
Teach a man to fish;
If you Google the exception you got, you'll notice that you can't run network operation on the main thread.
https://www.google.co.uk/search?q=NetworkOnMainThreadException&client=ubuntu&channel=cs&oq=NetworkOnMainThreadException&aqs=chrome.0.69i57j69i59&sourceid=chrome&ie=UTF-8
The exception at the top is very clear: android.os.NetworkOnMainThreadException
Android does not let you do network operations on your main thread. Try creating an AsyncTask and do you operations there asynchronously.
Its Simple You have some network related Code in your UI thread, So put that within a thread like
Thread thread = new Thread()
{
#Override
public void run() {
}
};
thread.start();
Any code related to Http request or socket or any such things that are network related which will block the UI execution will cause this exception

ActionBarSherlock raises Exception

I have a problem with implementing ActionBarSherlock in my test application.
If the main Activity is a subclass of Activity everything works perfectly, but when I subclass SherlockActivity I get an exception:
12-13 11:33:02.630: E/AndroidRuntime(11345): FATAL EXCEPTION: main
12-13 11:33:02.630: E/AndroidRuntime(11345): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{pl.lsi.test.packages/pl.lsi.test.packages.MainActivity}: java.lang.ClassNotFoundException: pl.lsi.test.packages.MainActivity
12-13 11:33:02.630: E/AndroidRuntime(11345): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2024)
12-13 11:33:02.630: E/AndroidRuntime(11345): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2125)
12-13 11:33:02.630: E/AndroidRuntime(11345): at android.app.ActivityThread.access$600(ActivityThread.java:140)
12-13 11:33:02.630: E/AndroidRuntime(11345): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1227)
12-13 11:33:02.630: E/AndroidRuntime(11345): at android.os.Handler.dispatchMessage(Handler.java:99)
12-13 11:33:02.630: E/AndroidRuntime(11345): at android.os.Looper.loop(Looper.java:137)
12-13 11:33:02.630: E/AndroidRuntime(11345): at android.app.ActivityThread.main(ActivityThread.java:4898)
12-13 11:33:02.630: E/AndroidRuntime(11345): at java.lang.reflect.Method.invokeNative(Native Method)
12-13 11:33:02.630: E/AndroidRuntime(11345): at java.lang.reflect.Method.invoke(Method.java:511)
12-13 11:33:02.630: E/AndroidRuntime(11345): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1006)
12-13 11:33:02.630: E/AndroidRuntime(11345): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)
12-13 11:33:02.630: E/AndroidRuntime(11345): at dalvik.system.NativeStart.main(Native Method)
12-13 11:33:02.630: E/AndroidRuntime(11345): Caused by: java.lang.ClassNotFoundException: pl.lsi.test.packages.MainActivity
12-13 11:33:02.630: E/AndroidRuntime(11345): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
12-13 11:33:02.630: E/AndroidRuntime(11345): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
12-13 11:33:02.630: E/AndroidRuntime(11345): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
12-13 11:33:02.630: E/AndroidRuntime(11345): at android.app.Instrumentation.newActivity(Instrumentation.java:1057)
12-13 11:33:02.630: E/AndroidRuntime(11345): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2015)
12-13 11:33:02.630: E/AndroidRuntime(11345): ... 11 more
I also have a problem with applying SherlockTheme to the manifest (Sherlock styles is not visible).
Then in values folder you have to add styles in styles.xml file....
I think you are missing the some file to place there

Incorrect classpath to NumberPickerButton from Quietly Coding NumberPicker

I am developing an Android application for >= API 8.
For compatibility reasons, the application uses Actionbar Sherlock. Before API 11, the NumberPicker was an internal widget, but I need the NumberPicker, so I had to come up with another solution.
After some Googling, I stumbled upon this NumberPicker from Mike Novak. I implemented it but unfortunately, when I click on the preference that should bring up the dialog with the numberpicker, the application crashes.
It seems there is something wrong with the reference to the layout (logcat says com.example.widget.NumberPicker is used) file, but the source references to com.michaelnovakjr.numberpicker.R.layout.pref_number_picker as you can see here.
LogCat output:
12-13 13:59:27.516: W/dalvikvm(11642): threadid=1: thread exiting with uncaught exception (group=0x40dbe930)
12-13 13:59:27.555: E/AndroidRuntime(11642): FATAL EXCEPTION: main
12-13 13:59:27.555: E/AndroidRuntime(11642): android.view.InflateException: Binary XML file line #24: Error inflating class com.michaelnovakjr.numberpicker.NumberPicker
12-13 13:59:27.555: E/AndroidRuntime(11642): at android.view.LayoutInflater.createView(LayoutInflater.java:613)
12-13 13:59:27.555: E/AndroidRuntime(11642): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:687)
12-13 13:59:27.555: E/AndroidRuntime(11642): at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
12-13 13:59:27.555: E/AndroidRuntime(11642): at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
12-13 13:59:27.555: E/AndroidRuntime(11642): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
12-13 13:59:27.555: E/AndroidRuntime(11642): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
12-13 13:59:27.555: E/AndroidRuntime(11642): at android.preference.DialogPreference.onCreateDialogView(DialogPreference.java:343)
12-13 13:59:27.555: E/AndroidRuntime(11642): at android.preference.DialogPreference.showDialog(DialogPreference.java:287)
12-13 13:59:27.555: E/AndroidRuntime(11642): at android.preference.DialogPreference.onClick(DialogPreference.java:266)
12-13 13:59:27.555: E/AndroidRuntime(11642): at android.preference.Preference.performClick(Preference.java:949)
12-13 13:59:27.555: E/AndroidRuntime(11642): at android.preference.PreferenceScreen.onItemClick(PreferenceScreen.java:215)
12-13 13:59:27.555: E/AndroidRuntime(11642): at android.widget.AdapterView.performItemClick(AdapterView.java:298)
12-13 13:59:27.555: E/AndroidRuntime(11642): at android.widget.AbsListView.performItemClick(AbsListView.java:1100)
12-13 13:59:27.555: E/AndroidRuntime(11642): at android.widget.AbsListView$PerformClick.run(AbsListView.java:2749)
12-13 13:59:27.555: E/AndroidRuntime(11642): at android.widget.AbsListView$1.run(AbsListView.java:3423)
12-13 13:59:27.555: E/AndroidRuntime(11642): at android.os.Handler.handleCallback(Handler.java:725)
12-13 13:59:27.555: E/AndroidRuntime(11642): at android.os.Handler.dispatchMessage(Handler.java:92)
12-13 13:59:27.555: E/AndroidRuntime(11642): at android.os.Looper.loop(Looper.java:137)
12-13 13:59:27.555: E/AndroidRuntime(11642): at android.app.ActivityThread.main(ActivityThread.java:5039)
12-13 13:59:27.555: E/AndroidRuntime(11642): at java.lang.reflect.Method.invokeNative(Native Method)
12-13 13:59:27.555: E/AndroidRuntime(11642): at java.lang.reflect.Method.invoke(Method.java:511)
12-13 13:59:27.555: E/AndroidRuntime(11642): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
12-13 13:59:27.555: E/AndroidRuntime(11642): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
12-13 13:59:27.555: E/AndroidRuntime(11642): at dalvik.system.NativeStart.main(Native Method)
12-13 13:59:27.555: E/AndroidRuntime(11642): Caused by: java.lang.reflect.InvocationTargetException
12-13 13:59:27.555: E/AndroidRuntime(11642): at java.lang.reflect.Constructor.constructNative(Native Method)
12-13 13:59:27.555: E/AndroidRuntime(11642): at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
12-13 13:59:27.555: E/AndroidRuntime(11642): at android.view.LayoutInflater.createView(LayoutInflater.java:587)
12-13 13:59:27.555: E/AndroidRuntime(11642): ... 23 more
12-13 13:59:27.555: E/AndroidRuntime(11642): Caused by: android.view.InflateException: Binary XML file line #22: Error inflating class com.example.widget.NumberPickerButton
12-13 13:59:27.555: E/AndroidRuntime(11642): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:698)
12-13 13:59:27.555: E/AndroidRuntime(11642): at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
12-13 13:59:27.555: E/AndroidRuntime(11642): at android.view.LayoutInflater.inflate(LayoutInflater.java:459)
12-13 13:59:27.555: E/AndroidRuntime(11642): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
12-13 13:59:27.555: E/AndroidRuntime(11642): at com.michaelnovakjr.numberpicker.NumberPicker.<init>(NumberPicker.java:125)
12-13 13:59:27.555: E/AndroidRuntime(11642): at com.michaelnovakjr.numberpicker.NumberPicker.<init>(NumberPicker.java:117)
12-13 13:59:27.555: E/AndroidRuntime(11642): ... 26 more
12-13 13:59:27.555: E/AndroidRuntime(11642): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.example.widget.NumberPickerButton" on path: /data/app/nl.livecarb.android-1.apk
12-13 13:59:27.555: E/AndroidRuntime(11642): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65)
12-13 13:59:27.555: E/AndroidRuntime(11642): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
12-13 13:59:27.555: E/AndroidRuntime(11642): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
12-13 13:59:27.555: E/AndroidRuntime(11642): at android.view.LayoutInflater.createView(LayoutInflater.java:552)
12-13 13:59:27.555: E/AndroidRuntime(11642): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:687)
12-13 13:59:27.555: E/AndroidRuntime(11642): ... 31 more
res/xml/main_preferences.xml
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:picker="http://schemas.android.com/apk/res/nl.livecarb.android" >
<PreferenceCategory android:title="#string/pref_cat_title_medical" >
<com.michaelnovakjr.numberpicker.NumberPickerPreference
android:key="#string/pref_key_ratio"
android:summary="Bla"
android:title="#string/pref_title_ratio"
picker:defaultValue="1"
picker:endRange="31"
picker:startRange="1" />
</PreferenceCategory>
<PreferenceCategory android:title="#string/pref_cat_title_other" >
<Preference
android:key="#string/pref_key_disclaimer"
android:title="#string/pref_title_disclaimer" />
</PreferenceCategory>
</PreferenceScreen>
SettingsActivity.java
public class SettingsActivity extends PreferenceActivity implements OnPreferenceClickListener {
#SuppressWarnings("deprecation")
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if(android.os.Build.VERSION.SDK_INT >= 11) {
getFragmentManager().beginTransaction().replace(android.R.id.content, new SettingsFragment(), "settings").commit();
} else {
addPreferencesFromResource(R.xml.main);
}
}
class SettingsFragment extends PreferenceFragment {
private Preference preferences = null;
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.main);
preferences = findPreference(getResources().getString(R.string.pref_key_disclaimer));
preferences.setOnPreferenceClickListener(SettingsActivity.this);
}
}
}
The error
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.example.widget.NumberPickerButton" on path: /data/app/nl.livecarb.android-1.apk doesn't make any sense to me, since I never used com.example.widget.NumberPickerButton. Neither the NumberPicker lib does.
Things I did trying to solve this problem:
How to use NumberPicker from QuietlyCoding in preferences?
Double checked the library project is referenced correct
Cleaned the project (including all libs)
Any thoughts?
Are you working off the master branch of the project? Try searching your code for a reference to that example package. I just took a look in the library and I don't see any reference to it.

Android. How to set wallpaper by sending intent

I want to call activity, where user can choose area of picture and set it as wallpaper
I have some problem with it. My code is:
Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_ATTACH_DATA);
Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.background);
shareIntent.putExtra(Intent.EXTRA_STREAM, bitmap);
shareIntent.setType("image/jpeg");
startActivity(shareIntent);
but when I choose set as wallpaper, gallery is stop working (Android 2.3), or (Android 4.0) "set as" menu doesn't displayed.
Android 2.3 LogCat (this errors in com.cooliris.media package):
12-13 16:20:27.509: E/AndroidRuntime(14414): FATAL EXCEPTION: main
12-13 16:20:27.509: E/AndroidRuntime(14414): java.lang.NullPointerException
12-13 16:20:27.509: E/AndroidRuntime(14414): at android.app.ActivityThread.handleStopActivity(ActivityThread.java:2593)
12-13 16:20:27.509: E/AndroidRuntime(14414): at android.app.ActivityThread.access$1800(ActivityThread.java:123)
12-13 16:20:27.509: E/AndroidRuntime(14414): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:953)
12-13 16:20:27.509: E/AndroidRuntime(14414): at android.os.Handler.dispatchMessage(Handler.java:99)
12-13 16:20:27.509: E/AndroidRuntime(14414): at android.os.Looper.loop(Looper.java:130)
12-13 16:20:27.509: E/AndroidRuntime(14414): at android.app.ActivityThread.main(ActivityThread.java:3835)
12-13 16:20:27.509: E/AndroidRuntime(14414): at java.lang.reflect.Method.invokeNative(Native Method)
12-13 16:20:27.509: E/AndroidRuntime(14414): at java.lang.reflect.Method.invoke(Method.java:507)
12-13 16:20:27.509: E/AndroidRuntime(14414): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:847)
12-13 16:20:27.509: E/AndroidRuntime(14414): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:605)
12-13 16:20:27.509: E/AndroidRuntime(14414): at dalvik.system.NativeStart.main(Native Method)
12-13 16:20:27.529: W/ActivityManager(225): Force finishing activity com.cooliris.media/.Photographs
Android 4.0 LogCat
12-13 11:26:44.722: E/JavaBinder(12822): !!! FAILED BINDER TRANSACTION !!!
Sorry for my bad english.

Is there anyone of troubleshooting or dealing with stack overflow errors when the trace shows nothing?

Got a trace like this:
java.lang.StackOverflowError
at android.widget.TextView.onMeasure(TextView.java:5160)
at android.view.View.measure(View.java:8172)
at android.widget.TableRow.getColumnsWidths(TableRow.java:308)
at android.widget.TableLayout.findLargestCells(TableLayout.java:497)
at android.widget.TableLayout.measureVertical(TableLayout.java:462)
at android.widget.TableLayout.onMeasure(TableLayout.java:428)
at android.view.View.measure(View.java:8172)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3140)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1012)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:381)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:304)
at android.view.View.measure(View.java:8172)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3140)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1012)
at android.widget.LinearLayout.measureHorizontal(LinearLayout.java:696)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:306)
at android.view.View.measure(View.java:8172)
at android.widget.ListView.measureScrapChild(ListView.java:1135)
at android.widget.ListView.measureHeightOfChildren(ListView.java:1200)
at android.widget.ListView.onMeasure(ListView.java:1109)
at android.view.View.measure(View.java:8172)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3140)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1012)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:381)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:304)
at android.view.View.measure(View.java:8172)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3140)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:245)
at android.view.View.measure(View.java:8172)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:526)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:304)
at android.view.View.measure(View.java:8172)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3140)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:245)
at android.view.View.measure(View.java:8172)
at android.view.ViewRoot.performTraversals(ViewRoot.java:805)
at android.view.ViewRoot.handleMessage(ViewRoot.java:1744)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:144)
at android.app.ActivityThread.main(ActivityThread.java:4937)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
at dalvik.system.NativeStart.main(Native Method)
Is there anything that can be done here?
I'm getting reports of blank screens and force closes.
When stack traces don't help the best thing you can do is trace it.
Start to scatter log messages through strategic parts of your application, and once you find where it is set some breakpoints and step through.
Log.d("MyActivity", "MyClass.getView() — Initializing ");
Once you have your logs setup use LogCat

Categories

Resources