今天再看一个Android LunchList的tutorial
发现有两种写法:
都是在 LunchList 这个类里,不同的方法
new Intent(this, EditPreferences.class);
和
new Intent(LunchList.this, DetailForm.class);
LunchList.this和this有什么区别?
今天再看一个Android LunchList的tutorial
发现有两种写法:
都是在 LunchList 这个类里,不同的方法
new Intent(this, EditPreferences.class);
和
new Intent(LunchList.this, DetailForm.class);
LunchList.this和this有什么区别?
这应该是在内部类里面调用的吧
如果在内部类里面的this就是这个内部类的实例,而OuterClassName.this就是它外面的那个类的实例
看起来是Android编程吧,应该是写了一个listener的匿名类?
如果是的话,那么this就是指这个listener实例,而LunchList.this就是外面的类,可能是Activity吧
2 回答1.3k 阅读✓ 已解决
2 回答2.7k 阅读
2 回答1.7k 阅读
1 回答2.1k 阅读
1 回答1.2k 阅读
1 回答1.2k 阅读
1 回答564 阅读✓ 已解决
如果你的程序里面包含了内部匿名类之类,比如线程