我上课了
public class SMS
{
public String addr;
public String body;
public String type;
public String timestamp;
}
Run Code Online (Sandbox Code Playgroud)
现在我已经创建了一个对象的数组列表
ArrayList<SMS> temp = new ArrayList<SMS>();
Run Code Online (Sandbox Code Playgroud)
我添加了值.现在我想根据时间戳对arrayList进行排序.
如何根据时间戳以升序/降序对arrayList进行排序?
我的活动上有两个按钮.一个是完美的,一个不是.我似乎无法找到问题.这是代码.该create_profile按钮不起作用.有人可以告诉我为什么吗?
private Button create_profile,select_contact;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.create_main);
select_contact = (Button)findViewById(R.id.add_contact);
create_profile = (Button)findViewById(R.id.create_button);
select_contact.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
final Uri uriContact = ContactsContract.Contacts.CONTENT_URI;
Intent intentPickContact = new Intent(Intent.ACTION_PICK, uriContact);
startActivityForResult(intentPickContact, PICK_CONTACT);
}
});
create_profile.setOnClickListener(new OnClickListener() {
@SuppressLint("ShowToast")
@Override
public void onClick(View arg0) {
Toast.makeText(getApplicationContext(), "Pressed", Toast.LENGTH_LONG);
System.out.println("PRessed");
}
});
}
Run Code Online (Sandbox Code Playgroud)
这是xml代码
<Button
android:id="@+id/add_contact"
android:layout_width="85dp"
android:layout_height="wrap_content"
android:text="Add"
android:layout_marginLeft="5dp"
android:layout_marginRight="2dp"
android:textSize="19dp"/>
<Button
android:id="@+id/create_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:text="Create Profile"
android:textSize="18sp"
android:layout_marginTop="8dp"/>
Run Code Online (Sandbox Code Playgroud)
我检查了一切,但似乎无法找到问题.