Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 5th, 2012  |  syntax: None  |  size: 1.37 KB  |  hits: 12  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Read call log and display number EditText
  2. <?xml version="1.0" encoding="utf-8"?>
  3. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  4. android:layout_width="fill_parent"
  5. android:layout_height="fill_parent"
  6. android:baselineAligned="true"
  7. android:orientation="horizontal" >
  8.  
  9. <EditText
  10.     android:id="@+id/edittext"
  11.     android:layout_width="172dp"
  12.     android:layout_height="wrap_content"
  13.     android:layout_weight="0.29"
  14.     android:hint="CONTACT NUMBER" >
  15.  
  16.     <requestFocus />
  17. </EditText>
  18.  
  19. <Button
  20.     android:id="@+id/btn"
  21.     android:layout_width="wrap_content"
  22.     android:layout_height="wrap_content"
  23.     android:text="CALL LOG" />
  24.  
  25. </LinearLayout>
  26.        
  27. import android.app.Activity;
  28. import android.content.Intent;
  29. import android.os.Bundle;
  30. import android.view.View;
  31. import android.widget.Button;
  32.  
  33. public class CallLogRetrieveActivity extends Activity {
  34.  
  35. Button myCallLogBtn;
  36. /** Called when the activity is first created. */
  37. @Override
  38. public void onCreate(Bundle savedInstanceState) {
  39.     super.onCreate(savedInstanceState);
  40.     setContentView(R.layout.main);
  41.  
  42.     myCallLogBtn=(Button)findViewById(R.id.btn);
  43.  
  44.     myCallLogBtn.setOnClickListener(new Button.OnClickListener(){
  45.  
  46.         public void onClick(View v) {
  47.  
  48.             Intent myIntent=new Intent();
  49.             myIntent.setAction(Intent.ACTION_CALL_BUTTON);
  50.             startActivity(myIntent);
  51.  
  52.         }});
  53. }
  54. }