-1
  • 1 つのボタンと 1 つの 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);

    }});
}
}
4

1 に答える 1

0

ここでは、RTFM を実行した後にわかるような初歩的なことについて質問するのではなく、まずマニュアルとチュートリアルを読み始める必要があります。だから「はい、できます」。ただし、「android call log tutorial」のググされた資料を読んで、宿題をしてください。ここにいる誰もあなたのためにそれを行っているわけではありません。

于 2012-07-17T15:36:51.710 に答える