I have created a button on my XML file, I want to click on that button so that the Android device's call log is displayed.
-
I've checked but I'm still not sure that the call log is a button
-
Does anyone know me about this Advice on how to advise.
Here's my XML:
& lt ;? Xml version = "1.0" encoding = "UTF-8"? & Gt; & Lt; Android: "Layout_width =" fill_parent "Android: layout_height =" fill_parent "Android: Baseline Alliance =" True "Android "& Gt; & Lt; Button Android: id = "@ + id / btn" Android: layout_width = "wrap_content" Android: layout_height = "wrap_content" android: text = "SEARCH" /> & Lt; / LinearLayout & gt;
My code is below, but there are some errors. I have not set my button
OnClickListener :
import java .util.ArrayList; Import java.util.list; Import android App Import android.app.AlertDialog; Import android.content.DialogInterface; Import android.content.Intent; Import android.database.Cursor; Import android.net.Uri; Importroid.os.Bundle; Import android Prozar Call log; Import android.provider.ContactsContract.CommonDataKinds.Phone; Import android.provider.ContactsContract.Contacts; Import android.provider.ContactsContract.CommonDataKinds.Email; Import android.util.log; Import android.view.View; Import android.widget.Button; Import android.widget.EditText; Import android.widget.Toast; The public class extends callLogActivity activity {/ ** is called when the activity has been created first. * / @ Override Super. Connet (Saved Instantstate); SetContentView (R.layout.main); String [] launch = new string [{callLog.Calls.NUMBER, call log. Call. Data, call log. Call. CACHED_NAME}; Uri Contact = Call Log Call. CONTENT_URI; Cursor Managed Kaiser = Managed (Contact, Launch, Empty, Empty, Call Log, Call.DAT + "ASC"); GetColumnData (managedCursor); } Private Wide getColumnData (cursor) {try {if (cur.moveToFirst ()) {String name; String number; Long date; Int name column = cur.getColumnIndex (CallLog.Calls.CACHED_NAME); Int number column = com Column index (call log call number); Int Date column = BRO Column index (call log call.date); System.out.println ("Reading Call Details:"); Do {name = cur.getString (nameColumn); Number = cur.getString (numberColumn); Date = CR Lang (date column); System.out.println (number + ":" + new date (date) + ":" + + name); } While (cur.moveToNext ()); }} Finally {cur.close (); }}}}
After pressing a button to get a call log, you Call log content provider
cursor c = contentResolver.query (CallLog.Calls.CONTENT_URI, DataQuery.PROJECTION, DataQuery.SELECTION, new string [] String.valueOf (rawContactId)}, tap ;
Comments
Post a Comment