Martin van der Woude
Martin van der Woude

Reputation: 67

Including AOSP classes in my app

I made a custom class that extends ProgressBar for some extra functionality. It's all functioning but I found that there is a difference in the way it displays on different phones with different ROMs.

For instance, it works flawlessly on the Android emulator but it's kinda messed up on my actual phone which runs MIUI ROM but runs fine on my old HTC with Cyanogen. I figured it's because MIUI has it's own custom ProgressBar class, among other custom widget classes made by them to give the ROM a different look.

I want to know if there is a way to include the 2.3.3 AOSP ProgressBar class in my app so that it overrides the class already present on the phone of the user, regardless of the custom ROM of the user.

Thanks

Upvotes: 0

Views: 325

Answers (1)

Jeremy Edwards
Jeremy Edwards

Reputation: 14750

You can copy the ProgressBar source code from AOSP and change the package name from it. This may have some problems though.

  1. You'll have to reference it by the full package name + class name when using it in XML layouts.
  2. Copying the code over isn't trivial. You'll have to fix the compile errors as you see them. Perhaps create reflection hooks for private variables and so on.

Upvotes: 1

Related Questions