1、protected
在Observable里面有这么个方法:
protected synchronized void setChanged() {
changed = true;
}
在它的子类里面可以调用:
package com.gzmu.observer.observable;
import java.util.Observable;
public class Publisher extends Observable {
private String magazineName;
public String getMagazineName() {
return magazineName;
}
public void publish(String magazineName) {
magazineName = magazineName;
//这里算是见识到了,protected修饰的方法,在 子类里面可以调用。但在其它的类里边,就算是拿到了子类的实例,也不能调用。
setChanged();
notifyObservers(this);
}
}
在其它的类里边不能调用,拿到了子类的引用也不能:
package com.gzmu.observer.test;
import org.junit.Test;
import com.gzmu.observer.observable.Publisher;
import com.gzmu.observer.observable.TVStation;
import com.gzmu.observer.observer.Reader;
public class TestCase {
@Test
public void register() {
Reader reader = new Reader();
Publisher publisher = new Publisher();
publisher.addObserver(reader);
// publisher.publish("Kent.Kwan的技术空间");
//上面的那行代码是在publish方法里面调用setChanged,我现在想不能过publish方法,而是直接调用setChanged,尝试如下:
publisher.setChanged() XXXX错错错!提示没有这么方法,方法不可见
//通过这次经验算是真正理解了protect修饰符的威力了。
}
}
扩散联想:
2、private 。肯定是在子类里面也不能调用,只有在原始类里面才可以调用的方法。
3、public 。 如果是public,那上面例子中的方法就可以正常调用了。
ndk-build提示:
D:/aDeveloper/ndk/android-ndk-r8b/platforms/android-8/arch-arm/usr/include/jni.h:592:13: note: the mangling of 'va_list' has changed in GCC 4.4
如.........什么note: the mangling of 'va_list' has changed in GCC 4.4
解决办法:
修改 Android.mk, LOCAL_CFLAGS = -Wno-psabi
UIColor支持的几种特殊背景色
self.view.backgroundColor = [UIColor viewFlipsideBackgroundColor];
+ (UIColor *)lightTextColor; // for a dark background
+ (UIColor *)darkTextColor; // for a light background
// Group style table view backgrounds can no longer be represented by a simple color.
// If you want to have a background in your own view that looks like the table view background,
// then you should create an empty table view and place it behind your content.
+ (UIColor *)groupTableViewBackgroundColor; // This method will be deprecated during the 6.0 seed program
+ (UIColor *)viewFlipsideBackgroundColor;
+ (UIColor *)scrollViewTexturedBackgroundColor NS_AVAILABLE_IOS(3_2);
+ (UIColor *)underPageBackgroundColor NS_AVAILABLE_IOS(5_0);