[VIDEO-Tut] Building an Contact-Caller App in Minutes

Basic Tutorials concerning: GUI, Views, Activites, XML, Layouts, Intents, ...

Postby code » Tue Feb 12, 2008 7:17 pm

THANX plusminus :D it works perfectly NOW


Regards,
code
User avatar
code
Junior Developer
Junior Developer
 
Posts: 21
Joined: Sat Feb 09, 2008 6:24 pm
Location: UAE

Top

Postby plusminus » Sat Feb 23, 2008 11:14 am

updated to sdk-version m5.

Thanks to 'aaron' for the notification.

Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Postby pedro » Fri Apr 04, 2008 2:33 pm

somebody knows as to edit some contact of the Android?
pedro
Developer
Developer
 
Posts: 29
Joined: Mon Jan 28, 2008 2:48 pm

Postby ferobert » Mon Apr 07, 2008 4:27 pm

code wrote:THANX plusminus :D it works perfectly NOW



Did you manage to visually select a row when the list is displayed initially? I.e. this "bug":
http://groups.google.com/group/android- ... 746d71de6a

I want to force a visual selection, but with setSelection() I only manage to select a row in the background, without the user being aware of the selection... until it starts to navigate in the list.

Robert
ferobert
Freshman
Freshman
 
Posts: 6
Joined: Sun Apr 06, 2008 6:22 pm

Postby code » Mon Apr 07, 2008 9:24 pm

Hi Robert,

Yes I did that using the way suggested by plusmunis :D
here you the code I used:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2.                 new Handler().postDelayed(new Runnable(){
  3.             @Override
  4.             public void run() {
  5.                 View vv = (View) this.getListView().getSelectedView();
  6.                 TextView tv = (TextView) vv.findViewById(R.id.row_entry);
  7.                 tv.setVisibility(View.VISIBLE); selectedTV = tv;
  8.             }
  9.        }, 1000);
  10.  
Parsed in 0.031 seconds, using GeSHi 1.0.8.4


Note: I added this code at the end of onCreate method after calling this.setListAdapter()



Regards,
code
User avatar
code
Junior Developer
Junior Developer
 
Posts: 21
Joined: Sat Feb 09, 2008 6:24 pm
Location: UAE

Postby ferobert » Tue Apr 08, 2008 9:41 pm

I tried adapting your code to my situation (using the IconifiedTextView class from the File Browser tutorial). You are using row_entry from XML, while I construct the row with Java code. I tried making "mText" public in IconifiedTextView.java, and came up with this code:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2.         new Handler().postDelayed(new Runnable(){
  3.  
  4.             @Override
  5.  
  6.             public void run() {
  7.  
  8.           IconifiedTextView vv = (IconifiedTextView) getListView().getSelectedView();
  9.  
  10.           TextView tv = (TextView) vv.mText;
  11.  
  12.           tv.setVisibility(View.VISIBLE);
  13.  
  14.             }
  15.  
  16.        }, 1000);
  17.  
  18.  
Parsed in 0.031 seconds, using GeSHi 1.0.8.4


Also tried setting the visibility for the IconifiedTextView object:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2.          IconifiedTextView vv = (IconifiedTextView) getListView().getSelectedView();
  3.  
  4.          vv.setVisibility(View.VISIBLE);
  5.  
  6.  
Parsed in 0.033 seconds, using GeSHi 1.0.8.4


But, still no visual selection of the selected row. Starting the ListActivity with the keyboard produces the desired effect, though, even without any of the above extra code. It might be a bug, and I have other things to focus on in my application, so I'll leave it like that for now.

Thanks anyway,
Robert
ferobert
Freshman
Freshman
 
Posts: 6
Joined: Sun Apr 06, 2008 6:22 pm

Top

Postby ferobert » Wed Apr 09, 2008 10:37 am

Couldn't let this issue yet :) After further reading and trial&error, I learned that the real problem for visually selecting a row, has to do with touchmode vs keymode. If you are in touch mode, Android considers there is no need to highlight the row. You can change this default behavior with:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2. getListView().setFocusableInTouchMode(true);
  3.  
  4.  
Parsed in 0.035 seconds, using GeSHi 1.0.8.4


After this, using setSelection() will also visually select the row you indicate. More info here:
http://groups.google.com/group/android- ... dda862f864

Hope this post will be read by the developers who are still struggling with this problem.

Regards
Robert
ferobert
Freshman
Freshman
 
Posts: 6
Joined: Sun Apr 06, 2008 6:22 pm

Postby code » Wed Apr 09, 2008 10:42 am

Thanks Robert for this information :) you always come with the best way for doing thinks not like me use the work around ways :lol:

Thanks again for sharing :idea:

Regards,
code
User avatar
code
Junior Developer
Junior Developer
 
Posts: 21
Joined: Sat Feb 09, 2008 6:24 pm
Location: UAE

Postby coding_android » Wed May 07, 2008 1:59 pm

Hello guys,

At first I want to say thank you for that great tutorials. Now I'd like to ask something. I tried to implement the visible/invisible thing but didn't get it the right way. (just getting the number when I press long enough the "down" key) So could you please give me the right solution how it should be coded the right way in order to get more information visible while having an item selected.

Regards!
User avatar
coding_android
Moderator
Moderator
 
Posts: 76
Joined: Mon May 05, 2008 10:22 am
Location: Germany

contacts

Postby lmsa » Fri May 23, 2008 3:50 pm

Hello,

I have a little problem with my address book application.
I want to display the e-mail address of a contact picked up in a list but I don't succeed.
I used PREFERRED_EMAIL_ID but it doesn't work. :x

If somebody has the solution, please post it.

Thank U +/- for this website....

my source code:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2. package octilla.droid;
  3.  
  4.  
  5.  
  6. import android.app.Activity;
  7.  
  8. import android.app.ListActivity;
  9.  
  10. import android.database.Cursor;
  11.  
  12. import android.os.Bundle;
  13.  
  14. import android.provider.Contacts.People;
  15.  
  16. import android.view.View;
  17.  
  18. import android.widget.EditText;
  19.  
  20. import android.widget.ListAdapter;
  21.  
  22. import android.widget.SimpleCursorAdapter;
  23.  
  24. import android.widget.TextView;
  25.  
  26.  
  27.  
  28. public class ContactInfoActivity extends Activity {
  29.  
  30.     /** Called when the activity is first created. */
  31.  
  32.        
  33.  
  34.     @Override
  35.  
  36.     public void onCreate(Bundle icicle) {
  37.  
  38.         super.onCreate(icicle);
  39.  
  40.         this.setTitle("Contact Card");
  41.  
  42.         setContentView(R.layout.contact);      
  43.  
  44.         Bundle bundle = getIntent().getExtras();
  45.  
  46.         /* Extract the default keyword
  47.  
  48.         * by using the public ID we
  49.  
  50.         * defined in the caller. */
  51.  
  52.         String name = bundle.getString("ContactName");
  53.  
  54.        
  55.  
  56.         Cursor C = getContentResolver().query(
  57.  
  58.                 android.provider.Contacts.People.CONTENT_URI,
  59.  
  60.                 null, null, null,null);
  61.  
  62.         startManagingCursor(C);
  63.  
  64.        
  65.  
  66.         int nameColumn = C.getColumnIndex(android.provider.Contacts.People.NAME);
  67.  
  68.         if(C.first()){
  69.  
  70.             do{
  71.  
  72.         String compName = C.getString(nameColumn);
  73.  
  74.        
  75.  
  76.         if (name.equalsIgnoreCase(compName))
  77.  
  78.         {
  79.  
  80.                 TextView Name =(TextView)this.findViewById(R.id.ContactName);
  81.  
  82.             Name.setText("Name:  "+name);
  83.  
  84.                
  85.  
  86.                 int phoneColumn = C.getColumnIndex(android.provider.Contacts.Phones.NUMBER);
  87.  
  88.                 String number = C.getString(phoneColumn);
  89.  
  90.                
  91.  
  92.                 TextView Number =(TextView)this.findViewById(R.id.ContactHome);
  93.  
  94.             Number.setText("Home:  "+number);
  95.  
  96.            
  97.  
  98.             int mailColumn = C.getColumnIndex(android.provider.Contacts.People.PREFERRED_EMAIL_ID);
  99.  
  100.                 String email = C.getString(mailColumn);
  101.  
  102.                
  103.  
  104.                 TextView mail =(TextView)this.findViewById(R.id.ContactMail);
  105.  
  106.             mail.setText("E-mail:  "+email);
  107.  
  108.  
  109.  
  110.         }
  111.  
  112.             }while(C.next());}
  113.  
  114.        
  115.  
  116.     }
  117.  
  118. }
  119.  
  120.                         /*String[] columns = new String[]{People.Phones.NUMBER};
  121.  
  122.                         int[] number = new int[] {R.id.row_entry};
  123.  
  124.                        
  125.  
  126.                         mAdapter = new SimpleCursorAdapter(this, R.layout.list, C, columns, number);
  127.  
  128.                         setListAdapter(mAdapter);*/
  129.  
  130.  
Parsed in 0.045 seconds, using GeSHi 1.0.8.4
lmsa
Freshman
Freshman
 
Posts: 3
Joined: Mon Apr 21, 2008 4:42 pm

Re: contacts

Postby square » Wed Jul 16, 2008 5:28 am

lmsa wrote:Hello,

I have a little problem with my address book application.
I want to display the e-mail address of a contact picked up in a list but I don't succeed.
I used PREFERRED_EMAIL_ID but it doesn't work. :x

If somebody has the solution, please post it.

Thank U +/- for this website....


Hello

I'm facing the same problem :)
Appearently the cause of this problem is that, although you define e-mail address for a given contact, it doesn't appear in the People table under the preferred_email column. The e-mail addresses are stored in the ContactMethods table and they are defined by a unique id. Such an id from the contact methods should appear in the preferred_email column of the People table of the Contacts database, but it doesn't appear and I have no idea how to flag an e-mail address as preferred, or how to tell the People table which e-mail id is preferred for which contact. At least from the Contact manager application of the emulator I couldn't, but you could add things to the database manually, either from tho sqlite3 or by making a small application which does this.
I think this is similar to the thing that you can't add contact photos, only from the sqlite3 database.

If anyone knows some solution to these problems please write:)

Regards, square
square
Freshman
Freshman
 
Posts: 5
Joined: Wed Jul 16, 2008 4:54 am

Postby saahil » Sun Aug 24, 2008 6:56 pm

hello plusminus

i am getting the following two errors in the code -

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. int[] names = new int[]{R.id.row_entry};
  2.  
  3. R.id cannot be resolved
Parsed in 0.036 seconds, using GeSHi 1.0.8.4


&

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. Intent i = new Intent(Intent.CALL_ACTION);
  2.  
  3. Intent.CALL_ACTION cannot be resolved
Parsed in 0.036 seconds, using GeSHi 1.0.8.4


plz help... :(
Saahil
<think><code></code>.......
saahil
Freshman
Freshman
 
Posts: 5
Joined: Sun Aug 24, 2008 6:42 pm
Location: Manipal, Karnataka, India

Postby square » Sun Aug 24, 2008 11:31 pm

Hi !

Have you tried importing the corresponding packages and classes.
Try Ctrl+Shift+O. It will automatically resolve your import issues, it imports the neccessary classes and removes the unused imports.
Good luck, hope it was only this, and nothing more complicated.

Regards,
square
square
Freshman
Freshman
 
Posts: 5
Joined: Wed Jul 16, 2008 4:54 am

Postby saahil » Mon Aug 25, 2008 6:34 am

hey,
ctrl+shift+o didn't change nething. says, 0 imports added. plz help me. btw, i use SDK 0.9 beta, and i guess most of the people here use the m3 or m5 versions. is the problem because of the different versions of the SDK, that the earlier imports or functions are depricated or something? if yes, then plz tell me as to wat would be the solution to this.
Saahil
<think><code></code>.......
saahil
Freshman
Freshman
 
Posts: 5
Joined: Sun Aug 24, 2008 6:42 pm
Location: Manipal, Karnataka, India

Postby square » Mon Aug 25, 2008 7:18 am

Yepp, I'm also using M5, so I don't think I can help you. Sorry.

Good luck.
square
square
Freshman
Freshman
 
Posts: 5
Joined: Wed Jul 16, 2008 4:54 am

Top
PreviousNext

Return to Novice Tutorials

Who is online

Users browsing this forum: No registered users and 1 guest