我可以在我的edittext中显示CallLog号码吗?新来的

时间:2012-07-17 15:23:52

标签: android button android-intent android-edittext calllog

  • 我创建了一个带有一个按钮和一个edittext的简单xml。
  • 点击按钮后,我可以进入CallLog页面。
  • 点击CallLog中的任何数字后,是否可以将所选数字显示在我的EditText中?

XML:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:baselineAligned="true"
android:orientation="horizontal" >

<EditText
android:id="@+id/edittext"
android:layout_width="172dp"
android:layout_height="wrap_content"
android:layout_weight="0.29"
android:hint="CONTACT NUMBER" >

<requestFocus />
</EditText>

<Button
android:id="@+id/btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="CALL LOG" />

</LinearLayout>

编码:

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

public class CallLogRetrieveActivity extends Activity {

Button myCallLogBtn;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);

myCallLogBtn=(Button)findViewById(R.id.btn);

myCallLogBtn.setOnClickListener(new Button.OnClickListener(){

    public void onClick(View v) {

        Intent myIntent=new Intent();
        myIntent.setAction(Intent.ACTION_CALL_BUTTON);
        startActivity(myIntent);

    }});
}
}

1 个答案:

答案 0 :(得分:0)

你应该先开始阅读手册和教程,而不是在这里询问你在做RTFM后简单知道的基本事情。所以“是的,你可以”。但现在请通过阅读“android通话日志教程”谷歌搜索材料做你的功课。这里没有人会这样做。

相关问题