[android-developers] Re: Using contacts (again)

2010-07-19 Thread ionel
Take a look on this 
http://www.higherpass.com/Android/Tutorials/Working-With-Android-Contacts/1/

On Jul 13, 2:32 pm, Lieuwe  wrote:
> Is it possible to create a generic android application that uses
> contacts (though a contentResolver) that will run on all android
> versions > 1.5 ?
>
> I have backward compatibility issues where f.i. my HTC Hero which is
> upgraded to Android 2.1 is not able to use the People.CONTENT_URI even
> though this is meant to be deprecated - not unsupported!
>
> If I include the new API style ContactsContract.Contacts.CONTENT_URI
> (with or without a check on the Build.SDK_VERSION to alternatively
> load the old style URI - similar to the Businesscard example 
> -http://developer.android.com/resources/samples/BusinessCard/index.html)
> I would still have to set up Eclipse to use the Android 2.1 libraries.
> Would this application still run on an Android 1.5 device if I keep
> the minsdkversion in the manifest at 3?
>
> I would like to avoid having to branch my application, create 2
> eclipse projects and release 2 different applications.
>
> Any advice on this?
>
> Lew

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


[android-developers] PopupWindow can't be dismissed when press back key

2010-06-04 Thread ionel
Hi,

I've created a custom PopupWindow but when I press back button, the
window doesn't dissapear.
If somebody found a solution please response.

Thanks,
   Ionel.

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


[android-developers] Re: New to android. Listview problem

2010-05-28 Thread ionel
Hi,

 Put the line "setContentView(R.layout.main); " after line
"super.onCreate(savedInstanceState);"

On May 26, 6:15 am, Somebodyconfused  wrote:
> All,
> I'm trying to get the following code to work. It should just be a
> textview with a listview underneath it. What is going wrong?
>
> MAIN.xml
>
> 
> http://schemas.android.com/apk/res/
> android"
>     android:orientation="vertical"
>     android:layout_width="fill_parent"
>     android:layout_height="fill_parent"
>     >
>      android:layout_width="fill_parent"
>     android:layout_height="wrap_content"
>     android:text="@string/hello"
>     />
>            android:layout_width="wrap_content"
>         android:layout_height="wrap_content"/>
>     
>
> public class TestApp extends Activity {
>     /** Called when the activity is first created. */
>
>         @Override
>     public void onCreate(Bundle savedInstanceState) {
>         super.onCreate(savedInstanceState);
>         TextView meh = new TextView(this);
>         ListView ls = (ListView) findViewById(R.id.lista);
>         String[] COUNTRIES = {"Afghanistan", "Albania", "Algeria"};
>         meh.setText("HI THERE");
>         setContentView(R.layout.main);
>         ls.setAdapter(new
> ArrayAdapter(this,android.R.layout.simple_list_item_1,
> COUNTRIES));
>
>     }

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


[android-developers] Re: Scan wireless networks periodically

2010-05-27 Thread ionel
Hi,

Use alarms

On May 26, 8:06 pm, Charly  wrote:
> Hi,
>
> I'm developing sort of a wireless scanner, so I need to scan every X
> seconds.
>
> I know I should use WifiManager and startScan() to get the networks
> and then register a receiver to receive the event once the scan has
> finished. However I'm having problems when trying to figure out how to
> scan periodically. It's more like a design problem.
>
> My solution so far has been to create a Service which takes care of
> the scanning, besides the main Activity. I think this is correct. So
> how could I tell this Service to scan every X seconds? I've thought it
> may have a Thread object, call its Scan method during tart_services()
> and then take it to sleep. Also I thought I could just get rid of the
> Service and run the Thread from the main Activity, but then I guess it
> would die whenever the Activity is not visible. None of then seem like
> a really good solution to me, and I think there must be an easier way
> to do this.
>
> Could anyone help me please?
>
> Thanks in advance.

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


[android-developers] Re: Twitter app's popup aligned with ListView item - how did they do it?

2010-05-27 Thread ionel
Can you put some code how you created PopupWindows?

On May 21, 10:53 pm, Nerdrow  wrote:
> I used the layouts, graphics, and animation from the default Contacts
> app, which uses separate layouts for the header, body, and footer, but
> you can merge them all into one.  Create a PopupWindow, set that
> layout as the contentView, then use showAsDropDown(View anchor, int
> xoff, int yoff) to show it.  The Contacts layout has a LinearLayout
> inside a HorizontalScrollView w/ImageViews for the two grips, so just
> stick your content in the LinearLayout between the grips and you're
> set.  The QuickContactWindow class has a method to set the arrows and
> everything, copy & paste.
>
> On May 12, 7:58 pm, Adam  wrote:
>
>
>
> > Is there a way to get that same popup layout like they have on twitter
> > or in the quick contacts popup? Do we just combine the top, middle,
> > bottom image resources as backgrounds in some sort of layout, or is
> > there a simpler way?
>
> > On May 10, 5:16 pm, skink  wrote:
>
> > > Mark Murphy wrote:
> > > > westmeadboy wrote:
> > > > > Anyone any ideas?
>
> > > > Ummm...figure out where the item is positioned on screen, then use some
> > > > margin tricks to position theirpopupto match, I suppose.
>
> > > if you usePopupWindowyou don't have to use margins at all - you can
> > > position yourpopupin any (x,y) location
>
> > > moreover: using showAsDropDown you don't even have to locate anchor
> > > view position
>
> > > pskink
>
> > > --
> > > You received this message because you are subscribed to the Google
> > > Groups "Android Developers" group.
> > > To post to this group, send email to android-developers@googlegroups.com
> > > To unsubscribe from this group, send email to
> > > android-developers+unsubscr...@googlegroups.com
> > > For more options, visit this group 
> > > athttp://groups.google.com/group/android-developers?hl=en
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to android-developers@googlegroups.com
> > To unsubscribe from this group, send email to
> > android-developers+unsubscr...@googlegroups.com
> > For more options, visit this group 
> > athttp://groups.google.com/group/android-developers?hl=en
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group 
> athttp://groups.google.com/group/android-developers?hl=en

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


[android-developers] SyncAdapter 2.x question

2010-05-06 Thread ionel
Can we use sync adapters for email?

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


[android-developers] Re: ListView/Adapter IllegalStateException

2010-04-28 Thread ionel
This isn't a solution for me, but thanks.

On Apr 7, 4:55 pm, Jerry Fan  wrote:
> I have a fix for this. Just set the visibility of ur ListView to Gone during
> update and back to visible after update. By doing so, u can avoid the
> inconsistency of ur adapter and listView item count.
>
> On Wed, Mar 31, 2010 at 4:35 PM, ionel  wrote:
> > I am calling notifyDataSetChanged() in update method
>
> > On Mar 30, 11:36 pm, social hub  wrote:
> > > prob u need to call notifyDataSetChanged if data is changed. See if that
> > > helps
>
> > > On Tue, Mar 30, 2010 at 3:15 PM, ionel  wrote:
> > > > I've implemented a custom ListView and  Adapter, and sometimes I
> > > > receive IllegalStateException exception:” ERROR/AndroidRuntime(3575):
> > > > java.lang.IllegalStateException: The content of the adapter has
> > > > changed but ListView did not receive a notification. Make sure the
> > > > content of your adapter is not modified from a background thread, but
> > > > only from the UI thread.”
>
> > > > Here is some code example:
>
> > > > public interface BuddyChangeListener {
>
> > > >     void onChange(List buddys);
>
> > > > }
>
> > > > public class BuddyListView extends ListView implements
> > > > BuddyChangeListener
>
> > > >   public void onChange(List Buddy) {
> > > >     MyActivity.instance.handler.post(new Runnable() {
> > > >                 public void run() {
> > > >                     if (((BuddyAdapter) refreshListView.getAdapter()) !
> > > > = null) {
> > > >                         ((BuddyAdapter)
> > > > refreshListView.getAdapter()).update(Buddy);
> > > >                     }
> > > >                 }
> > > >             });
> > > > }
> > > > public class BuddyAdapter extends BaseAdapter {
>
> > > >     private List       buddyList;
>
> > > >     public BuddyAdapter (Context context, List buddyList) {
> > > >         this.buddyList= buddyList;
> > > >     }
>
> > > >     public void update(List buddyList) {
> > > >         this.buddyList= buddyList;
> > > >         this.notifyDataSetChanged();
> > > >     }
> > > > }
>
> > > > Every time when the content of the list need to be updated I run from
> > > > onChange method and I use a handler to change the adapter content,to
> > > > update the content from UI thread.
>
> > > > Can someone to tell me if I have made something wrong on update ?
>
> > > > Thanks.
>
> > > > --
> > > > You received this message because you are subscribed to the Google
> > > > Groups "Android Developers" group.
> > > > To post to this group, send email to
> > android-developers@googlegroups.com
> > > > To unsubscribe from this group, send email to
> > > > android-developers+unsubscr...@googlegroups.com
> > 
>
> > > > For more options, visit this group at
> > > >http://groups.google.com/group/android-developers?hl=en
>
> > > > To unsubscribe from this group, send email to android-developers+
> > > > unsubscribegooglegroups.com or reply to this email with the words
> > "REMOVE
> > > > ME" as the subject.
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to android-developers@googlegroups.com
> > To unsubscribe from this group, send email to
> > android-developers+unsubscr...@googlegroups.com
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en
>
>

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


[android-developers] Re: ListActivity and onListItemClick

2010-04-14 Thread ionel
You have conflict name between your class name and “ListView” from
onListItemClick method.

Change class name, import android.widget.ListView and should work

On Apr 11, 1:16 am, Amon Darthir  wrote:
> Hi. I am having trouble figuring out how to get my onListItemClick to
> work. Here is my code.
>
> package list.view;
>
> import android.app.ListActivity;
> import android.os.Bundle;
> import android.view.View;
> import android.widget.ArrayAdapter;
>
> public class ListView extends ListActivity {
>     /** Called when the activity is first created. */
>     @Override
>     public void onCreate(Bundle savedInstanceState) {
>         super.onCreate(savedInstanceState);
>
>         setListAdapter(new ArrayAdapter(this,
>         android.R.layout.simple_list_item_1, ANIONS));
>         }
>
>     public static final String[] ANIONS = new String[] {
>         "Acetate", "Bromine", "Carbonate", "Chlorate", "Chloride",
>         "Chlorite", "Chromate", "Cyanide", "Dychromate",
>     };
>
>     protected void onListItemClick(ListView l, View v, int position,
> long id)
>     {
>     if (position == 0){
>         setContentView(R.layout.acetate);
>         };
>     if (position == 1){
>         setContentView(R.layout.bromine);
>         };
>     if (position == 2){
>         setContentView(R.layout.carbonate);
>         };
>     if (position == 3){
>         setContentView(R.layout.chlorate);
>         };
>                                                 };
>
> }
>
> It seems like it should work but it never brings up the new .xml. Any
> suggestions would be nice. Thanks.

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

To unsubscribe, reply using "remove me" as the subject.


[android-developers] Re: Memory profiling for my Android application

2010-04-14 Thread ionel
You can find some information here:
http://groups.google.com/group/android-developers/browse_thread/thread/afd865f3eb7494ed

On Apr 13, 3:29 pm, SAM  wrote:
> Hi,
> I have a requiirement of finding out the max RAM usage of my
> application. I tried installing the Memory Profilers in eclipse but I
> was not able to use it with my application. Please let me know how can
> I find the RAM usage of my application on the 'emulator'.
>
> Thanks
> Sam

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

To unsubscribe, reply using "remove me" as the subject.


[android-developers] Re: ListView/Adapter IllegalStateException

2010-03-31 Thread ionel
I am calling notifyDataSetChanged() in update method

On Mar 30, 11:36 pm, social hub  wrote:
> prob u need to call notifyDataSetChanged if data is changed. See if that
> helps
>
> On Tue, Mar 30, 2010 at 3:15 PM, ionel  wrote:
> > I've implemented a custom ListView and  Adapter, and sometimes I
> > receive IllegalStateException exception:” ERROR/AndroidRuntime(3575):
> > java.lang.IllegalStateException: The content of the adapter has
> > changed but ListView did not receive a notification. Make sure the
> > content of your adapter is not modified from a background thread, but
> > only from the UI thread.”
>
> > Here is some code example:
>
> > public interface BuddyChangeListener {
>
> >     void onChange(List buddys);
>
> > }
>
> > public class BuddyListView extends ListView implements
> > BuddyChangeListener
>
> >   public void onChange(List Buddy) {
> >     MyActivity.instance.handler.post(new Runnable() {
> >                 public void run() {
> >                     if (((BuddyAdapter) refreshListView.getAdapter()) !
> > = null) {
> >                         ((BuddyAdapter)
> > refreshListView.getAdapter()).update(Buddy);
> >                     }
> >                 }
> >             });
> > }
> > public class BuddyAdapter extends BaseAdapter {
>
> >     private List       buddyList;
>
> >     public BuddyAdapter (Context context, List buddyList) {
> >         this.buddyList= buddyList;
> >     }
>
> >     public void update(List buddyList) {
> >         this.buddyList= buddyList;
> >         this.notifyDataSetChanged();
> >     }
> > }
>
> > Every time when the content of the list need to be updated I run from
> > onChange method and I use a handler to change the adapter content,to
> > update the content from UI thread.
>
> > Can someone to tell me if I have made something wrong on update ?
>
> > Thanks.
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to android-developers@googlegroups.com
> > To unsubscribe from this group, send email to
> > android-developers+unsubscr...@googlegroups.com
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en
>
> > To unsubscribe from this group, send email to android-developers+
> > unsubscribegooglegroups.com or reply to this email with the words "REMOVE
> > ME" as the subject.

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


[android-developers] ListView/Adapter IllegalStateException

2010-03-30 Thread ionel
I've implemented a custom ListView and  Adapter, and sometimes I
receive IllegalStateException exception:” ERROR/AndroidRuntime(3575):
java.lang.IllegalStateException: The content of the adapter has
changed but ListView did not receive a notification. Make sure the
content of your adapter is not modified from a background thread, but
only from the UI thread.”

Here is some code example:


public interface BuddyChangeListener {
   
    void onChange(List buddys);

}

public class BuddyListView extends ListView implements
BuddyChangeListener

  public void onChange(List Buddy) {
    MyActivity.instance.handler.post(new Runnable() {
    public void run() {
    if (((BuddyAdapter) refreshListView.getAdapter()) !
= null) {
    ((BuddyAdapter)
refreshListView.getAdapter()).update(Buddy);
    }
    }
    });
}
public class BuddyAdapter extends BaseAdapter {

    private List   buddyList;

    public BuddyAdapter (Context context, List buddyList) {
    this.buddyList= buddyList;
    }
 
    public void update(List buddyList) {
    this.buddyList= buddyList;
    this.notifyDataSetChanged();
    }
}

Every time when the content of the list need to be updated I run from
onChange method and I use a handler to change the adapter content,to
update the content from UI thread.

Can someone to tell me if I have made something wrong on update ?

Thanks.

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

To unsubscribe from this group, send email to 
android-developers+unsubscribegooglegroups.com or reply to this email with the 
words "REMOVE ME" as the subject.