Sunday, February 9, 2014

Android source code issue. . .


            
Encountered a problem while viewing an Android source files, can not think of one herself, ask Daniel to help. .

Problem Description: Android source code Resources.java NativePluralRules.java this class has a class, I want to see the source code described in this class, but hold down the Ctrl key in Eclipse environment but can not open the file, it does not show the link of this class When I use this class in your own code is, but it is showing no class, to create your own. By looking at the package name, that NativePluralRules this class is in libcore.icu.NativePluralRules this library. Android does not belong to you? How to get this thing the source of it? Android is not open source it? Is that what happens?

Brother knowledge has limitations, please enlighten ~ Thank
cattle
Resources.java relevant code
 import libcore.icu.NativePluralRules; 


public class Resources {
static final String TAG = "Resources";
private static final boolean DEBUG_LOAD = false;
private static final boolean DEBUG_CONFIG = false;
private static final boolean DEBUG_ATTRIBUTES_CACHE = false;
private static final boolean TRACE_FOR_PRELOAD = false;
private static final boolean TRACE_FOR_MISS_PRELOAD = false;

private static final int ID_OTHER = 0x01000004;

private static final Object mSync = new Object ();
/ * Package * / static Resources mSystem = null;

/ / Information about preloaded resources. Note that they are not
/ / Protected by a lock, because while preloading in zygote we are all
/ / Single-threaded, and after that these are immutable.
private static final LongSparseArray sPreloadedDrawables
= New LongSparseArray ();
private static final LongSparseArray sPreloadedColorStateLists
= New LongSparseArray ();
private static final LongSparseArray sPreloadedColorDrawables
= New LongSparseArray ();
private static boolean sPreloaded;
private static int sPreloadedDensity;

/ * Package * / final TypedValue mTmpValue = new TypedValue ();
/ * Package * / final Configuration mTmpConfig = new Configuration ();

/ / These are protected by the mTmpValue lock.
private final LongSparseArray > mDrawableCache
= New LongSparseArray > ();
private final LongSparseArray > mColorStateListCache
= New LongSparseArray > ();
private final LongSparseArray > mColorDrawableCache
= New LongSparseArray > ();
private boolean mPreloading;

/ * Package * / TypedArray mCachedStyledAttributes = null;
RuntimeException mLastRetrievedAttrs = null;

private int mLastCachedXmlBlockIndex = -1;
private final int [] mCachedXmlBlockIds = {0, 0, 0, 0};
private final XmlBlock [] mCachedXmlBlocks = new XmlBlock [4];

/ * Package * / final AssetManager mAssets;
private final Configuration mConfiguration = new Configuration ();
/ * Package * / final DisplayMetrics mMetrics = new DisplayMetrics ();
private NativePluralRules mPluralRule;

private CompatibilityInfo mCompatibilityInfo;



Correlation method code
 public CharSequence getQuantityText (int id, int quantity) throws NotFoundException {
NativePluralRules rule = getPluralRule ();
CharSequence res = mAssets.getResourceBagText (id,
attrForQuantityCode (rule.quantityForInt (quantity)));
if (res! = null) {
return res;
}
res = mAssets.getResourceBagText (id, ID_OTHER);
if (res! = null) {
return res;
}
throw new NotFoundException ("Plural resource ID # 0x" + Integer.toHexString (id)
+ "Quantity =" + quantity
+ "Item =" + stringForQuantityCode (rule.quantityForInt (quantity)));
}

private NativePluralRules getPluralRule () {
synchronized (mSync) {
if (mPluralRule == null) {
mPluralRule = NativePluralRules.forLocale (mConfiguration.locale);
}
return mPluralRule;
}
}

Thank you
Reply:
Amount, Dinga. . Seeking to explain. . .
Is it because it comes to the bottom of the library? ?
Reply:
https://android.googlesource.com/platform/libcore/+/master/luni/src/main/java/libcore/icu/NativePluralRules.java

Search to find the next one .. I do not know right.
Reply:
Ah is this library. . . But in Eclipse, no. . . Download Android Android.source when the association of this package. . Estimate is that it does not contain this package. . . .

Thank you!

Also ask you this study is to download the source code down?
Reply:
reference to the second floor genesisevarei reply:
https://android.googlesource.com/platform/libcore/+/master/luni/src/main/java / libcore / icu / NativePluralRules.java

Search to find the next one .. I do not know right.


Forget references. . See 3L
Reply:
reference to the third floor benma378 reply:
ah is this library. . . But in Eclipse, no. . . Download Android Android.source when the association of this package. . Estimate is that it does not contain this package. . . .

Thank you!

Also ask you this study is to download the source code down?

You do not just want to look at the source?
android source code is not compiled with eclipse it.
Search should be able to download the source code can be compiled to search.

No comments:

Post a Comment