我对 Java 非常熟悉,因为我实际上正在创建自己的应用程序。但我有一些关于高级java代码的问题......
我实际上试图在 SharedPreferences 中保存一个字符串数组,以便在通过主页按钮退出应用程序后恢复屏幕。所以我找到了这两个链接: 如何让 Android 应用重新启动时返回到上次打开的 Activity? 和 是否可以添加数组或反对 Android 上的 SharedPreferences
我知道该做什么以及如何做,所以这不是本主题的重点。
我的观点是,我不熟悉使用 <> 之间的参数的构造函数。而不是 (),我不明白与“经典”构造函数有什么区别。
例如,对于我的项目,几天前,我使用了 ArrayAdapters ( http: //developer.android.com/reference/android/widget/ArrayAdapter.html )并使用像 sort(Comparator comparator) 这样的函数,我们必须使用 Comparator
。那是什么?
有人可以解释一下如何使用它(不是特别是排序方法,而是全局的),因为我真的迷路了,在我的项目中,我使用了一些我什至不理解的 Android 界面!
希望我已经说清楚了,谢谢!
I'm quite familiar with Java as I'm actually creating my own app. But I have a few questions on advanced java codes...
I'm actually trying to save a String Array in the SharedPreferences to restore a screen after the app have been exited by the home button. So I found these two links : How to make an android app return to the last open activity when relaunched? and Is it possible to add an array or object to SharedPreferences on Android
I know what to do and how to do it so that's not the point of this topic.
My point is th fact that I'm not familiar with the constructors using parameters between <> instead of (), I don't understand what is the difference with a "classic" constructor.
By example, for my project, a few days ago, I used ArrayAdapters ( http://developer.android.com/reference/android/widget/ArrayAdapter.html ) and to use a function like sort(Comparator comparator) , we have to use a Comparator<? super T>
. What is that ?
Could somebody explain me how to use it (not especially for the sort method, but globally) cause I'm really lost and in my project, I use some faces of Android that I don't even understand !
Hope I've been clear, Thanks !
发布评论
评论(2)
您将看到泛型类型参数。
You're seeing generic type parameters.
那是一个泛型类型。 http://download.oracle.com/javase/tutorial/java/generics /generics.html
That is a generic type. http://download.oracle.com/javase/tutorial/java/generics/generics.html