So I can print the actual phone number that I wish to dial but I can
actually dial it.  Its seems like a trivial problem but I am not sure I am
doing anything wrong in Eclipse. --Jonathan

On Mon, Jul 12, 2010 at 5:05 PM, Jonathan <[email protected]> wrote:

> Cool,
> I figured out the method to shifting through the contactscontract but now
> get a weird error on the intent.  Any help would be appreciated. I think I
> have the right manifest. Thanks, --Jonathan
>
>     @Override
>     // the class that is called every time the user clicks something
>     protected void onListItemClick(ListView l, View v, int position, long
> id) {
>         // TODO Auto-generated method stub
>         super.onListItemClick(l, v, position, id);
>
>         // the reflections of a applications intent to perform some
> activity
>         // in this case a call action to dial the phone
>         Intent i = new Intent(Intent.ACTION_CALL);
>         // cursor of the selection
>         Cursor c = (Cursor) mAdapter.getItem(position);
>
>         // get some info from the cursor
>         String contactId = c.getString(c.getColumnIndex(Contacts._ID));
>         String IsPhone =
> c.getString(c.getColumnIndex(Contacts.HAS_PHONE_NUMBER));
>
>         //if the selection has phone numbers
>         if (Integer.parseInt(IsPhone)> 0) {
>             Cursor phones = getContentResolver().query(Phone.CONTENT_URI,
> null, Phone.CONTACT_ID + "=" + contactId, null, null);
>             while (phones.moveToNext()) {
>                 String strPhoneNumber =
> phones.getString(phones.getColumnIndex(Phone.NUMBER));
>                 System.out.println(strPhoneNumber);
>                 i.setData(Phone.CONTENT_URI);
>             }
>         }
>         //i.setData(strPhoneNumber);
>
>         // Causes the dialer to appear on the screen and initiate the phone
> call
>         //startActivity(i);
>     }
>
>
> <?xml version="1.0" encoding="utf-8"?>
> <manifest xmlns:android="http://schemas.android.com/apk/res/android";
>       package="hello.android"
>       android:versionCode="1"
>       android:versionName="1.0">
>     <application android:icon="@drawable/icon"
> android:label="@string/app_name">
>         <activity android:name=".hello"
>                   android:label="@string/app_name">
>             <intent-filter>
>                 <action android:name="android.intent.action.MAIN" />
>                 <category android:name="android.intent.category.LAUNCHER"
> />
>             </intent-filter>
>         </activity>
>
>     </application>
>     <uses-sdk android:minSdkVersion="7" />
> <uses-permission
> android:name="android.permission.CALL_PHONE"></uses-permission>
> <uses-permission
> android:name="android.permission.READ_CONTACTS"></uses-permission>
> </manifest>
> --
> "If men were angels, no government would be necessary."
> --Madison
>



-- 
"If men were angels, no government would be necessary."
--Madison

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to