private ArrayList<String> conversation = new ArrayList<String>();
public ArrayAdapter<String> adapter;
private String phoneNumber;
ListView listView;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.converse_view);
this.adapter = new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_1, android.R.id.text1,
conversation);
ListView listView = (ListView) findViewById(R.id.conversation);
listView.setAdapter(adapter);
}
protected void onResume()
{
super.onResume();
setContentView(R.layout.converse_view);
this.adapter.notifyDataSetChanged();
}
public void changeNumber(String phoneNumber2) {
this.phoneNumber = phoneNumber2;
}
public void addText(String message) {
conversation.add(message);
}
@Override
public String toString() {
return phoneNumber;
}
public boolean equals(converseView other) {
return this.phoneNumber.equals(other.phoneNumber);
}
我正在创建一个短信应用程序,这是我的对话视图屏幕课程。addText() 在您单击发送按钮时被调用。我如何让列表视图更新,以便我可以看到发送的短信