Android: Handling orientation changes myself - RelativeLayout is getting messed up - android

In an Android app, I've got an activity that is somewhat complex and may have threads running at certain times which, when finished, will update the UI. As such, having the Activity destroy and create again (due to orientation change) in the middle of one of these threads could lead to the user having to re-try that action, which is bad.
As such, I've decided to handle orientation changes myself by having android:configChanges="orientation|keyboardHidden" in the manifest, and can then override the Activity.onConfigurationChanged(Configuration newConfig) method.
The root layout for this activity is a RelativeLayout.
Currently, I don't actually do anything in onConfigurationChanged() other than call the super().
After an orientation change, the layout is muddled - some elements which are android:layout_above= are either at the bottom of the screen, or floating way above what they should be floating above.
Does anyone have any ideas as to how to fix this?
I'm aware that if I allowed the activity to restart upon an orientation change, it would then use a layout from res/layout-land/, but restarting the activity really seems to be the wrong way to go here.
Edit:
I've tried to setContentView(R.layout.displaymap); in the onConfigurationChanged() method and get the following error:
I/WindowManager( 571): onOrientationChanged, rotation changed to 1
D/StatusBar( 571): updateResources
E/AndroidRuntime( 3813): android.view.InflateException: Binary XML file line #17: Error inflating class java.lang.reflect.Constructor
E/AndroidRuntime( 3813): at android.view.LayoutInflater.createView(LayoutInflater.java:512)
E/AndroidRuntime( 3813): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:564)
E/AndroidRuntime( 3813): at android.view.LayoutInflater.rInflate(LayoutInflater.java:617)
E/AndroidRuntime( 3813): at android.view.LayoutInflater.rInflate(LayoutInflater.java:620)
E/AndroidRuntime( 3813): at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
E/AndroidRuntime( 3813): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
E/AndroidRuntime( 3813): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
E/AndroidRuntime( 3813): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:309)
E/AndroidRuntime( 3813): at android.app.Activity.setContentView(Activity.java:1626)
E/AndroidRuntime( 3813): at com.apps.virtualtravel.DisplayMap.onConfigurationChanged(DisplayMap.java:1065)
E/AndroidRuntime( 3813): at android.app.ActivityThread.performConfigurationChanged(ActivityThread.java:3383)
E/AndroidRuntime( 3813): at android.app.ActivityThread.handleConfigurationChanged(ActivityThread.java:3449)
E/AndroidRuntime( 3813): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1762)
E/AndroidRuntime( 3813): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 3813): at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime( 3813): at android.app.ActivityThread.main(ActivityThread.java:3948)
E/AndroidRuntime( 3813): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 3813): at java.lang.reflect.Method.invoke(Method.java:521)
E/AndroidRuntime( 3813): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:782)
E/AndroidRuntime( 3813): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540)
E/AndroidRuntime( 3813): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime( 3813): Caused by: java.lang.reflect.InvocationTargetException
E/AndroidRuntime( 3813): at com.google.android.maps.MapView.<init>(MapView.java:237)
E/AndroidRuntime( 3813): at java.lang.reflect.Constructor.constructNative(Native Method)
E/AndroidRuntime( 3813): at java.lang.reflect.Constructor.newInstance(Constructor.java:446)
E/AndroidRuntime( 3813): at android.view.LayoutInflater.createView(LayoutInflater.java:499)
E/AndroidRuntime( 3813): ... 20 more
E/AndroidRuntime( 3813): Caused by: java.lang.IllegalStateException: You are only allowed to have a single MapView in a MapActivity
E/AndroidRuntime( 3813): at com.google.android.maps.MapActivity.setupMapView(MapActivity.java:180)
E/AndroidRuntime( 3813): at com.google.android.maps.MapView.<init>(MapView.java:279)
E/AndroidRuntime( 3813): at com.google.android.maps.MapView.<init>(MapView.java:254)
E/AndroidRuntime( 3813): ... 24 more

You have to create layout for landscape mode if you want to set for landscape and put the layout in layout-land folder with same name which is for portrait and than setContentview(R.layout.name) in onConfigChanged method. this will give the desired UI.other wise you will face issue in RelativeLayout.

Related

java.lang.ClassNotFoundException when inflating a view from a jar

I want to replace the rotating icon in progress dialog with my custom icon. The custom icon is part of my own jar placed inside /device//package_name/Custom_View.java. When this class is referenced in my frameworks/base/core/res/res/layout/progress_dialog_holo.xml. I am having this crash
please help me resolve this issue.
E/AndroidRuntime( 699): *** FATAL EXCEPTION IN SYSTEM PROCESS: WindowManagerPolicy
E/AndroidRuntime( 699): android.view.InflateException: Binary XML file line #39: Error inflating class com.iamplus.aware.AwareProgressView
E/AndroidRuntime( 699): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:698)
E/AndroidRuntime( 699): at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
E/AndroidRuntime( 699): at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
E/AndroidRuntime( 699): at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
E/AndroidRuntime( 699): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
E/AndroidRuntime( 699): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
E/AndroidRuntime( 699): at android.app.ProgressDialog.onCreate(ProgressDialog.java:164)
E/AndroidRuntime( 699): at android.app.Dialog.dispatchOnCreate(Dialog.java:355)
E/AndroidRuntime( 699): at android.app.Dialog.show(Dialog.java:260)
E/AndroidRuntime( 699): at com.android.server.pm.ShutdownThread.beginShutdownSequence(ShutdownThread.java:223)
E/AndroidRuntime( 699): at com.android.server.pm.ShutdownThread.access$000(ShutdownThread.java:57)
E/AndroidRuntime( 699): at com.android.server.pm.ShutdownThread$1.onClick(ShutdownThread.java:140)
E/AndroidRuntime( 699): at com.android.internal.app.AlertController$ButtonHandler.handleMessage(AlertController.java:190)
E/AndroidRuntime( 699): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 699): at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime( 699): at com.android.server.wm.WindowManagerService$PolicyThread.run(WindowManagerService.java:882)
E/AndroidRuntime( 699): Caused by: java.lang.ClassNotFoundException: com.iamplus.aware.AwareProgressView
E/AndroidRuntime( 699): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
E/AndroidRuntime( 699): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
E/AndroidRuntime( 699): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
E/AndroidRuntime( 699): at android.view.LayoutInflater.createView(LayoutInflater.java:552)
E/AndroidRuntime( 699): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:687)
E/AndroidRuntime( 699): ... 15 more
Make sure that you have added the external jar to your project build path.
After that, go to Project -> Properties -> Java Build Path -> Order and Export and mark the checkbox corresponding to your external jar.
Clean and build the project before you run.

How to use both AppCompat action bar & nested fragments on Android 2.3?

Using nested fragments via XML or programmatically works great on a 4.2/4.3 device.
When 2.3 tries to use nested fragments and has AppCompat's action bar, it seems like the nested fragments want access to the action bar, but cannot find it... because they're nested in a fragment and should not have one.
I know there are some gotchas when using AppCompat like: AppCompat, fragments, & 2.3, and am hoping this can be solved just as easily.
XML layout:
<fragment
android:id="#+id/my_fragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:name="my.package.MyFragment"
tools:layout="#layout/my_layout" />
Manifest.xml:
<application
...
android:theme="#style/Theme.AppCompat.Light">
Stack trace:
E/AndroidRuntime( 6487): java.lang.RuntimeException: Unable to start activity ComponentInfo{your.package.here/your.package.here.SomeActivity}: java.lang.IllegalArgumentException: No view found for id 0x7f080014 (your.package.here:id/action_bar_activity_content) for fragment ProfileFragment{406160e0 #0 id=0x7f080014 SomeFragment}
E/AndroidRuntime( 6487): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1651)
E/AndroidRuntime( 6487): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)
E/AndroidRuntime( 6487): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
E/AndroidRuntime( 6487): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
E/AndroidRuntime( 6487): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 6487): at android.os.Looper.loop(Looper.java:130)
E/AndroidRuntime( 6487): at android.app.ActivityThread.main(ActivityThread.java:3691)
E/AndroidRuntime( 6487): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 6487): at java.lang.reflect.Method.invoke(Method.java:507)
E/AndroidRuntime( 6487): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:907)
E/AndroidRuntime( 6487): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:665)
E/AndroidRuntime( 6487): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime( 6487): Caused by: java.lang.IllegalArgumentException: No view found for id 0x7f080014 (your.package.here:id/action_bar_activity_content) for fragment SomeFragment{406160e0 #0 id=0x7f080014 SomeFragment}
E/AndroidRuntime( 6487): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:919)
E/AndroidRuntime( 6487): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1104)
E/AndroidRuntime( 6487): at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:682)
E/AndroidRuntime( 6487): at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1460)
E/AndroidRuntime( 6487): at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:556)
E/AndroidRuntime( 6487): at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1129)
E/AndroidRuntime( 6487): at android.app.Activity.performStart(Activity.java:3833)
E/AndroidRuntime( 6487): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1624)
E/AndroidRuntime( 6487): ... 11 more
How can I fix this while still using nested fragments and the AppCompat action bar?

Getting resource not found exception in android app

I am trying to build an app in AOSP, my development kit has HDPI density, I have double verified it with the following code snippet:
switch (getResources().getDisplayMetrics().densityDpi) {
case DisplayMetrics.DENSITY_LOW:
Log.d(TAG, "\n\n\n\n LDPI \n\n\n\n");
break;
case DisplayMetrics.DENSITY_MEDIUM:
Log.d(TAG, "\n\n\n\n MDPI \n\n\n\n");
break;
case DisplayMetrics.DENSITY_HIGH:
Log.d(TAG, "\n\n\n\n HDPI \n\n\n\n");
// ...
break;
case DisplayMetrics.DENSITY_XHIGH:
Log.d(TAG, "\n\n\n\n XDPI \n\n\n\n");
// ...
break;
}
when I build my application in Android File system,and if I run it, then I am getting following error:
E/AndroidRuntime( 825): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example/com.example.MainActivity}: android.view.InflateException: Binary XML file line #11: Error inflating class android.widget.Button
E/AndroidRuntime( 825): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1956)
E/AndroidRuntime( 825): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
E/AndroidRuntime( 825): at android.app.ActivityThread.access$600(ActivityThread.java:123)
E/AndroidRuntime( 825): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
E/AndroidRuntime( 825): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 825): at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime( 825): at android.app.ActivityThread.main(ActivityThread.java:4424)
E/AndroidRuntime( 825): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 825): at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime( 825): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
E/AndroidRuntime( 825): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
E/AndroidRuntime( 825): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime( 825): Caused by: android.view.InflateException: Binary XML file line #11: Error inflating class android.widget.Button
E/AndroidRuntime( 825): at android.view.LayoutInflater.createView(LayoutInflater.java:606)
E/AndroidRuntime( 825): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
E/AndroidRuntime( 825): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:653)
E/AndroidRuntime( 825): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:678)
E/AndroidRuntime( 825): at android.view.LayoutInflater.rInflate(LayoutInflater.java:739)
E/AndroidRuntime( 825): at android.view.LayoutInflater.rInflate(LayoutInflater.java:742)
E/AndroidRuntime( 825): at android.view.LayoutInflater.parseInclude(LayoutInflater.java:823)
E/AndroidRuntime( 825): at android.view.LayoutInflater.rInflate(LayoutInflater.java:729)
E/AndroidRuntime( 825): at android.view.LayoutInflater.rInflate(LayoutInflater.java:742)
E/AndroidRuntime( 825): at android.view.LayoutInflater.rInflate(LayoutInflater.java:742)
E/AndroidRuntime( 825): at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
E/AndroidRuntime( 825): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
E/AndroidRuntime( 825): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
E/AndroidRuntime( 825): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:251)
E/AndroidRuntime( 825): at android.app.Activity.setContentView(Activity.java:1835)
E/AndroidRuntime( 825): at com.example.MainActivity.onCreate(MainActivity.java:96)
E/AndroidRuntime( 825): at android.app.Activity.performCreate(Activity.java:4465)
E/AndroidRuntime( 825): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
E/AndroidRuntime( 825): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
E/AndroidRuntime( 825): ... 11 more
E/AndroidRuntime( 825): Caused by: java.lang.reflect.InvocationTargetException
E/AndroidRuntime( 825): at java.lang.reflect.Constructor.constructNative(Native Method)
E/AndroidRuntime( 825): at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
E/AndroidRuntime( 825): at android.view.LayoutInflater.createView(LayoutInflater.java:586)
E/AndroidRuntime( 825): ... 29 more
E/AndroidRuntime( 825): Caused by: android.content.res.Resources$NotFoundException: Resource is not a Drawable (color or path): TypedValue{t=0x1/d=0x7f02000d a=-1 r=0x7f02000d}
E/AndroidRuntime( 825): at android.content.res.Resources.loadDrawable(Resources.java:1897)
E/AndroidRuntime( 825): at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
E/AndroidRuntime( 825): at android.widget.TextView.<init>(TextView.java:620)
E/AndroidRuntime( 825): at android.widget.Button.<init>(Button.java:108)
E/AndroidRuntime( 825): at android.widget.Button.<init>(Button.java:104)
E/AndroidRuntime( 825): ... 32 more
My all the drawable resources are in drawable-hdpi.
But if I put drawables in all the drawable-* folder then app runs.
But then UI is getting scattered.
Does anybody have idea, what the problem could. Do I have to add any Variable or flag in the Android.mk
=========edit=========
The app works fine if I build with eclipse. And run on the same device.
Therefore issue might be in building app along with AOSP.
========================
Any help would be highly appreciated.
Regards,
Yuvi
So after struggling too long and googling for more then two days, I found the issue. There was no drawable-hdpi folder in apk. I have resolved the issue by adding the LOCAL_AAPT_FLAGS += -c mdpi,hdpi,xhdpi line in Android.mk file.
Those who are struggling with the same kind of problem follow these supper steps:
Check at which line it is giving error:
Binary XML file line #11: Error inflating class android.widget.Button
In my xml file it was:
<Button
android:id="#+id/btn_footer_back"
style="#style/normalButtonStyle"
android:layout_width="wrap_content"
android:layout_height="60px"
android:layout_marginRight="1dp"
android:background="#drawable/button_state_selector"
android:drawableLeft="#drawable/ic_back"
android:drawablePadding="10px"
android:text="#string/back"
android:visibility="gone" />
So, what is the next step now, the log itself tells the story, check the line:
Caused by: android.content.res.Resources$NotFoundException: Resource is not a Drawable (color or path): TypedValue{t=0x1/d=0x7f02000d a=-1 r=0x7f02000d}
Here r=0x7f02000d is the resource id, that you can find in yourproject/gen/R.java
if you search for 0x7f02000d in R.java then you will able to find which resource is creating the problem, in my case it was R.drawable.ic_back
Hope it helps other to resolve their problems.
Regards,
Yuvi
Your UI is scattered because your files are not matching to appropriate density or resolution while displaying on device. You should use density independent pixels in xml.
And Create Drawable folder and put your files in it. And give reference of the drawable folder.

PreferenceActivity getting close the second time i start the app

This is my .java code
public class MainHelp extends PreferenceActivity {
#Override
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.help_main);
}
}
and this is the layout
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" >
<Preference
android:title="Commands Documentation"
android:key="#string/commands"/>
<Preference
android:title = "How To Use"
android:key="#string/howToUse"/>
<Preference
android:title="Write Us"
android:key="#string/writeUs"/>
<Preference
android:title="About"
android:key="#string/aboutSuppApp"/>
</PreferenceScreen>
When I run the program the above code works perfectly....But, when i hit home button and try to go to this Activity, I get error saying
E/AndroidRuntime( 495): Uncaught handler: thread main exiting due to uncaught exception
E/AndroidRuntime( 495): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.suppapp/com.suppapp.help.MainHelp}: android.view.InflateException: Binary XML file line #10: Error inflating class prferences
E/AndroidRuntime( 495): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2496)
E/AndroidRuntime( 495): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)
E/AndroidRuntime( 495): at android.app.ActivityThread.access$2200(ActivityThread.java:119)
E/AndroidRuntime( 495): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)
E/AndroidRuntime( 495): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 495): at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime( 495): at android.app.ActivityThread.main(ActivityThread.java:4363)
E/AndroidRuntime( 495): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 495): at java.lang.reflect.Method.invoke(Method.java:521)
E/AndroidRuntime( 495): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
E/AndroidRuntime( 495): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
E/AndroidRuntime( 495): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime( 495): Caused by: android.view.InflateException: Binary XML file line #10: Error inflating class prferences
E/AndroidRuntime( 495): at android.preference.GenericInflater.createItemFromTag(GenericInflater.java:441)
E/AndroidRuntime( 495): at android.preference.GenericInflater.rInflate(GenericInflater.java:481)
E/AndroidRuntime( 495): at android.preference.GenericInflater.inflate(GenericInflater.java:326)
E/AndroidRuntime( 495): at android.preference.GenericInflater.inflate(GenericInflater.java:263)
E/AndroidRuntime( 495): at android.preference.PreferenceManager.inflateFromResource(PreferenceManager.java:254)
E/AndroidRuntime( 495): at android.preference.PreferenceActivity.addPreferencesFromResource(PreferenceActivity.java:253)
E/AndroidRuntime( 495): at com.suppapp.help.MainHelp.onCreate(MainHelp.java:19)
E/AndroidRuntime( 495): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
E/AndroidRuntime( 495): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2459)
E/AndroidRuntime( 495): ... 11 more
E/AndroidRuntime( 495): Caused by: java.lang.ClassNotFoundException: android.preference.prferences in loader dalvik.system.PathClassLoader#44c06600
E/AndroidRuntime( 495): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
E/AndroidRuntime( 495): at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
E/AndroidRuntime( 495): at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
E/AndroidRuntime( 495): at android.preference.GenericInflater.createItem(GenericInflater.java:375)
E/AndroidRuntime( 495): at android.preference.GenericInflater.onCreateItem(GenericInflater.java:417)
E/AndroidRuntime( 495): at android.preference.GenericInflater.createItemFromTag(GenericInflater.java:428)
E/AndroidRuntime( 495): ... 19 more
I tried to link my activity with the other .xml file but getting the same error again!! Even Caused by: android.view.InflateException: Binary XML file line #10: Error inflating class prferences shows the same line number(#10) for other .xml files
i changed the version code(inside manifest file) and re-installed the app...its working fine now.

java.lang.ClassCastException in Android

Started getting a ClassCastException in a widget I've been working on that I'm not sure what it's having an issue with. I haven't modified the configure class, nor the configure layout, yet I've started getting a stack trace leading back to my configure class after modifying the main layout
E/AndroidRuntime( 2010): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.metatroid.minimal.music/
com.metatroid.minimal.music.Configure}: java.lang.ClassCastException: android.widget.RadioButton
E/AndroidRuntime( 2010): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
E/AndroidRuntime( 2010): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
E/AndroidRuntime( 2010): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
E/AndroidRuntime( 2010): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
E/AndroidRuntime( 2010): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 2010): at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime( 2010): at android.app.ActivityThread.main(ActivityThread.java:4627)
E/AndroidRuntime( 2010): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 2010): at java.lang.reflect.Method.invoke(Method.java:521)
E/AndroidRuntime( 2010): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
E/AndroidRuntime( 2010): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
E/AndroidRuntime( 2010): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime( 2010): Caused by: java.lang.ClassCastException: android.widget.RadioButton
E/AndroidRuntime( 2010): at com.metatroid.minimal.music.Configure.onCreate(Configure.java:39)
E/AndroidRuntime( 2010): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
E/AndroidRuntime( 2010): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
E/AndroidRuntime( 2010): ... 11 more
Reverting my changes causes the issue to go away, but I'm not doing anything with this file, nor am I modifying any RadioButtons...so what the hell? The line #39 of Configure.java is
EditText prv = (EditText) findViewById(R.id.previous_input);
I don't see how that ties into anything. And the only changes I am making to the entire project are changing some TextViews into Buttons in my main.xml layout which is not referenced in Configure.java. Reverting the Button back to TextView makes the error go away. What causes a "ClassCastException" and what could possibly be going on here?
Try clean your project. Previously you had RadioButton.

Categories

Resources