我是开发的初学者,我知道这个问题可能听起来很基础,但是,让我切入正题:这是我的课
public class MainActivity extends Activity {
private ListView lvPhone;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
lvPhone = (ListView)findViewById(R.id.listPhone);
List<PhoneBook> listPhoneBook = new ArrayList<PhoneBook>();
listPhoneBook.add(new PhoneBook(
BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher),
"blah_blah", "384765345667", "something@someprovider.com"));
listPhoneBook.add(new PhoneBook(
BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher),
"blah_blah", "34856834796", "something@someprovider.com"));
listPhoneBook.add(new PhoneBook(
BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher),
"blah_name", "868734633", "something@someprovider.com"));
PhoneBookAdapter adapter = new PhoneBookAdapter(this, listPhoneBook);
lvPhone.setAdapter(adapter);
}
}
在这里我希望它被“附加”,所以当点击按钮时,电话簿就会出现。
public void addListenerOnButton(){
imageButton = (ImageButton) findViewById(R.id.pb_button);
imageButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
Toast.makeText(MyAndroidAppActivity.this,//phone_book goes here
"ImageButton is clicked!", Toast.LENGTH_SHORT).show();//no toaster instead
}
});
}
你们中的任何人都可以帮忙吗?这对我真的很有帮助。如果您确实回答,请尝试解释,因为您正在向“Java_moron”解释:)(请尽可能通过)
[现在我确实尝试了聊天室,没有声望点所以没有发生,我尝试尽可能多地谷歌找不到任何有用的东西;也许有答案,但我缺乏知识让我失望。] 谢谢,
[编辑:或者不使用电话簿类,我如何从手机的本地联系人列表中呼叫联系人?任何事情都会有帮助。]