hi Tatsu

Thanks very much for your tip.
That was what made it work.

The line below is commented.
{android.provider.Contacts.PeopleColumns.NAME};


On Apr 3, 8:07 am, Tatsu <[EMAIL PROTECTED]> wrote:
> Hi mario,
>
> Please add "android:" to the last TextView's id as follows:
> <TextView  android:id="@+id/row_entry"
>
> Is the following comment line?
> {android.provider.Contacts.PeopleColumns.NAME};
> You can replace the left side of the previous line with it.
>
> Maybe this program was written for m3 and rewritten for m5 later
> incompletely.
>
> Best Regards,
>  Tatsuhttp://www.tatsu.com
>
> On Apr 1, 6:11 am, marioneil <[EMAIL PROTECTED]> wrote:
>
> > Hi
>
> > I am following the Android phone example from youtube.
> > It works , except for one small detail.
>
> > The app displays the list of contacts , but it doesnot display the
> > names of the contacts. It is a list of blank lines.
>
> > When I click on any blank line it dials the correct contact.
>
> > How do i display the name of the contact.
>
> > According to the youtube tutorial by Dan Morrill the following three
> > lines should be displaying the name. Am I missing anyhting?
>
> >          String[] columns = new String[] {People.NAME};
> >          int[] names = new int[] {R.id.row_entry};
> >          mAdapter = new SimpleCursorAdapter(this, R.layout.main, C, columns,
> > names);
>
> > I have attached my code below.
>
> > Thanks in advance
>
> > mario
>
> > package com.google.android.hello.phone;
>
> > import android.app.Activity;
> > import android.net.Uri;
> > import android.os.Bundle;
> > import android.app.ListActivity;
> > import android.content.Intent;
> > import android.database.Cursor;
> > import android.os.Bundle;
> > import android.provider.Contacts.People;
> > import android.provider.Contacts.Phones;
> > import android.util.Log;
> > import android.view.View;
> > import android.widget.AdapterView;
> > import android.widget.ListAdapter;
> > import android.widget.ListView;
> > import android.widget.SimpleCursorAdapter;
> > import android.widget.TextView;
>
> > public class HelloAndroidPhone extends ListActivity {
> >     /** Called when the activity is first created. */
>
> >          private ListAdapter mAdapter;
> >          private static final String TAG = "MyActivity";
>
> >          /** Called when the activity is first created. */
> >          @Override
> >          public void onCreate(Bundle icicle) {
> >          super.onCreate(icicle);
>
> >          Cursor C = getContentResolver().query(People.CONTENT_URI, null,
> > null, null, null);
>
> >          Log.v(TAG, "Count - " + C.count() );
>
> >          startManagingCursor(C);
>
> >          String[] columns = new String[] {People.NAME};
> > {android.provider.Contacts.PeopleColumns.NAME};
>
> >          int[] names = new int[] {R.id.row_entry};
>
> >          mAdapter = new SimpleCursorAdapter(this, R.layout.main, C, columns,
> > names);
> >          setListAdapter(mAdapter);
> >          }
>
> >          @Override
> >          protected void onListItemClick(ListView l, View v, int position,
> > long id) {
> >          super.onListItemClick(l, v, position, id);
> >          Intent i = new Intent(Intent.CALL_ACTION);
> >          Cursor C = (Cursor) mAdapter.getItem(position);
>
> >          String phoneId =
> >                   C.getString(C.getColumnIndex(People.PREFERRED_PHONE_ID));
>
> >                  i.setData(Uri.withAppendedPath(Phones.CONTENT_URI, 
> > phoneId));
>
> >          startActivity(i);
> >          }
>
> > }
>
> > main.xml
>
> > <?xml version="1.0" encoding="utf-8"?>
> > <LinearLayout xmlns:android="http://schemas.android.com/apk/res/
> > android"
> >     android:orientation="horizontal"
> >     android:layout_width="fill_parent"
> >     android:layout_height="wrap_content"
> >     >
> > <TextView
> >     android:layout_width="wrap_content"
> >     android:layout_height="wrap_content"
> >     android:text="Name: "
> >     />
> > <TextView  id="@+id/row_entry"
> >     android:layout_width="wrap_content"
> >     android:layout_height="wrap_content"
> >     />
> > </LinearLayout>
>
> > AndroidManifest.xml
>
> > <?xml version="1.0" encoding="utf-8"?>
> > <manifest xmlns:android="http://schemas.android.com/apk/res/android";
> >     package="com.google.android.hello.phone">
> >  <uses-permission android:name="android.permission.READ_CONTACTS" />
> >  <uses-permission android:name="android.permission.CALL_PHONE" />
> > <uses-permission android:name="android.permission.WRITE_CONTACTS" /
>
> >     <application android:icon="@drawable/icon">
> >         <activity android:name=".HelloAndroidPhone"
> > 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>
> > </manifest>
>
> > - Hide quoted text -
>
> > - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to