Re: [android-developers] Re: Filtered ListView with custom Adapter derived from ArrayAdapter is not updated

2010-03-29 Thread Anton Pirker

Hi!

Thiago Diniz wrote:

Why do you want to put an edittext, listview already have an keystroke
filter.
  

An editText is in die screen design, so i have to use it.

I have a similar problem because my listview is not filtering, even
implementing the toString method os the class from my custom Adapter.
Ialso have a ListView with a custom Adapter that extends ArrayAdapter.
It's a ArrayAdapter of the Type User
  

Have you solved the problem?


regards,
Anton




On Mar 25, 9:45 am, Anton Pirker an...@ignaz.at wrote:
  

Hi!

Kumar Bibek wrote:


What exactly are you trying to do? Can you please explain?
  

What i am trying to do:

I want to have a EditText and below my list with about 1200 Artistnames.
If the user enters something in the EditText i want to filter the
artists according to the entered text.

So if the user enters sa only artists with a name that contains sa
are displayed in the list. The list should be updated on every keystroke.

I think this is a fairly common problem and i hav read a lot of solution
on the internet, but it is just not working with my code (see below)
According to my Log.d() Message the artists are filtered, but the list
does not change, its not updated! Do you know whats wrong with my code?

Thanks!
Anton





Thanks and Regards,
Kumar Bibek
  
On Mar 25, 3:17 pm, Anton Pirker an...@ignaz.at wrote:
  

Hi!

I have a ListView with a custom Adapter that extends ArrayAdapter. It's

a ArrayAdapter of Type Artist. (There are about 1200 artists in my list)

Artist is a very small class that has a name and an id. The Artist Class

has toString() overridden to return just the name.

I have an EditText. The EditText has an TextChangeListener where i call

.getFilter().filter(chars, callback) on my adapter.

In the Filter.Filterlistener().onComplete() callback i print the count

and it looks really good. As i type the count decreases. So it seams
everything works as advertised, but the List stays the same. I tried to
call artistAdapter.notifyDataSetChanged() to force the list to redraw,
but nothing happens. [see 2.)]

I am tinkering around for days now! I am desperate.. Hopefully someone

can have a look on my code and tell me what i am doing wrong! How can i
force the list to be redrawn?

Thanks!

(I have posted this question also on stackoverflow:http://stackoverflow.com/questions/2505800/filtered-listview-not-updated)

Here is what i have done:

1.) Defined a ListView and an EditText like this:

EditText xmlns:android=http://schemas.android.com/apk/res/android;

android:id=@+id/list_search_text
android:layout_width=fill_parent
android:layout_height=35dip
android:layout_below=@id/header
/EditText  
ListView xmlns:android=http://schemas.android.com/apk/res/android;

android:id=@+id/list_search
android:layout_width=fill_parent
android:layout_height=fill_parent
/ListView

2.) Setup my ListView in the Activities onCreate():

private ListView listView = null;

private ArtistAdapter artistAdapter = null;

@Override

protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.search_artists);

artistAdapter = new ArtistAdapter(this, R.layout.row, list); //

'list' is an ArrayListArtist

listView = (ListView) findViewById(R.id.list_search);

listView.setAdapter(artistAdapter);
listView.setFastScrollEnabled(true);
listView.setTextFilterEnabled(true);

listView.setOnItemClickListener(new OnItemClickListener() {

public void onItemClick(AdapterView? av, View v, int
position, long id) {
// do something
}
});

EditText txtSearch = (EditText) findViewById(R.id.list_search_text);

txtSearch.addTextChangedListener(new TextWatcher() {
public void afterTextChanged(Editable arg0) { }

public void beforeTextChanged(CharSequence arg0, int arg1,

int arg2, int arg3) { }

public void onTextChanged(CharSequence chars, int start, int

before, int count) {
artistAdapter.getFilter().filter(chars, new
Filter.FilterListener() {
public void onFilterComplete(int count) {
Log.d(Config.LOG_TAG, filter complete! count: 
+ count);
artistAdapter.notifyDataSetChanged();
}
});
}
});
}

3.) This is my ArtistAdapter in short. I added an remove() and add() method:

public class ArtistAdapter extends ArrayAdapterArtist implements

SectionIndexer {
private ListArtist items;

/* other stuff like overridden getView, getPositionForSection,

getSectionForPosition

[android-developers] Filtered ListView with custom Adapter derived from ArrayAdapter is not updated

2010-03-25 Thread Anton Pirker

Hi!

I have a ListView with a custom Adapter that extends ArrayAdapter. It's 
a ArrayAdapter of Type Artist. (There are about 1200 artists in my list)


Artist is a very small class that has a name and an id. The Artist Class 
has toString() overridden to return just the name.


I have an EditText. The EditText has an TextChangeListener where i call 
.getFilter().filter(chars, callback) on my adapter.


In the Filter.Filterlistener().onComplete() callback i print the count 
and it looks really good. As i type the count decreases. So it seams 
everything works as advertised, but the List stays the same. I tried to 
call artistAdapter.notifyDataSetChanged() to force the list to redraw, 
but nothing happens. [see 2.)]


I am tinkering around for days now! I am desperate.. Hopefully someone 
can have a look on my code and tell me what i am doing wrong! How can i 
force the list to be redrawn?


Thanks!

(I have posted this question also on stackoverflow: 
http://stackoverflow.com/questions/2505800/filtered-listview-not-updated)


Here is what i have done:

1.) Defined a ListView and an EditText like this:

   EditText xmlns:android=http://schemas.android.com/apk/res/android;
   android:id=@+id/list_search_text
   android:layout_width=fill_parent
   android:layout_height=35dip
   android:layout_below=@id/header
   /EditText  
   ListView xmlns:android=http://schemas.android.com/apk/res/android;

   android:id=@+id/list_search
   android:layout_width=fill_parent
   android:layout_height=fill_parent
   /ListView

2.) Setup my ListView in the Activities onCreate():

   private ListView listView = null;
   private ArtistAdapter artistAdapter = null;

   @Override
   protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.search_artists);

   artistAdapter = new ArtistAdapter(this, R.layout.row, list); // 
'list' is an ArrayListArtist


   listView = (ListView) findViewById(R.id.list_search);
   listView.setAdapter(artistAdapter);
   listView.setFastScrollEnabled(true);
   listView.setTextFilterEnabled(true);

   listView.setOnItemClickListener(new OnItemClickListener() {
   public void onItemClick(AdapterView? av, View v, int 
position, long id) {

   // do something
   }
   });

   EditText txtSearch = (EditText) findViewById(R.id.list_search_text);
   txtSearch.addTextChangedListener(new TextWatcher() {
   public void afterTextChanged(Editable arg0) { }

   public void beforeTextChanged(CharSequence arg0, int arg1, 
int arg2, int arg3) { }


   public void onTextChanged(CharSequence chars, int start, int 
before, int count) {
   artistAdapter.getFilter().filter(chars, new 
Filter.FilterListener() {

   public void onFilterComplete(int count) {
   Log.d(Config.LOG_TAG, filter complete! count:  
+ count);

   artistAdapter.notifyDataSetChanged();
   }
   });
   }
   });
   }

3.) This is my ArtistAdapter in short. I added an remove() and add() method:

   public class ArtistAdapter extends ArrayAdapterArtist implements 
SectionIndexer {

   private ListArtist items;

   /* other stuff like overridden getView, getPositionForSection, 
getSectionForPosition and so on */


   @Override
   public void remove(Artist object) {
   super.remove(object);
   items.remove(object);
   }

   @Override
   public void add(Artist object) {
   super.add(object);
   items.add(object);
   }
   }   


4.) My artist has also the toString() overridden:

   public class Artist implements ComparableArtist {
   public String   uid;
   public String   name;

   public Artist(String id, String name) {
   this.uid = id;
   this.name = name;
   }

   public int compareTo(Artist another) {
   return this.name.compareToIgnoreCase(another.name);
   }

   @Override
   public String toString() {
   return this.name;
   }
   }

--
DI(FH) Anton Pirker

--
cross platform mobile software
burggasse 123/53
a-1070 wien
tel: +43 699 1234 0 456
skype: antonpirker

http://anton-pirker.at



--
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.


Re: [android-developers] Re: Filtered ListView with custom Adapter derived from ArrayAdapter is not updated

2010-03-25 Thread Anton Pirker

Hi!

Kumar Bibek wrote:

What exactly are you trying to do? Can you please explain?
  

What i am trying to do:

I want to have a EditText and below my list with about 1200 Artistnames. 
If the user enters something in the EditText i want to filter the 
artists according to the entered text.


So if the user enters sa only artists with a name that contains sa 
are displayed in the list. The list should be updated on every keystroke.


I think this is a fairly common problem and i hav read a lot of solution 
on the internet, but it is just not working with my code (see below) 
According to my Log.d() Message the artists are filtered, but the list 
does not change, its not updated! Do you know whats wrong with my code?


Thanks!
Anton


Thanks and Regards,
Kumar Bibek

On Mar 25, 3:17 pm, Anton Pirker an...@ignaz.at wrote:
  

Hi!

I have a ListView with a custom Adapter that extends ArrayAdapter. It's
a ArrayAdapter of Type Artist. (There are about 1200 artists in my list)

Artist is a very small class that has a name and an id. The Artist Class
has toString() overridden to return just the name.

I have an EditText. The EditText has an TextChangeListener where i call
.getFilter().filter(chars, callback) on my adapter.

In the Filter.Filterlistener().onComplete() callback i print the count
and it looks really good. As i type the count decreases. So it seams
everything works as advertised, but the List stays the same. I tried to
call artistAdapter.notifyDataSetChanged() to force the list to redraw,
but nothing happens. [see 2.)]

I am tinkering around for days now! I am desperate.. Hopefully someone
can have a look on my code and tell me what i am doing wrong! How can i
force the list to be redrawn?

Thanks!

(I have posted this question also on 
stackoverflow:http://stackoverflow.com/questions/2505800/filtered-listview-not-updated)

Here is what i have done:

1.) Defined a ListView and an EditText like this:

EditText xmlns:android=http://schemas.android.com/apk/res/android;
android:id=@+id/list_search_text
android:layout_width=fill_parent
android:layout_height=35dip
android:layout_below=@id/header
/EditText  
ListView xmlns:android=http://schemas.android.com/apk/res/android;

android:id=@+id/list_search
android:layout_width=fill_parent
android:layout_height=fill_parent
/ListView

2.) Setup my ListView in the Activities onCreate():

private ListView listView = null;
private ArtistAdapter artistAdapter = null;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.search_artists);

artistAdapter = new ArtistAdapter(this, R.layout.row, list); //
'list' is an ArrayListArtist

listView = (ListView) findViewById(R.id.list_search);
listView.setAdapter(artistAdapter);
listView.setFastScrollEnabled(true);
listView.setTextFilterEnabled(true);

listView.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView? av, View v, int
position, long id) {
// do something
}
});

EditText txtSearch = (EditText) findViewById(R.id.list_search_text);
txtSearch.addTextChangedListener(new TextWatcher() {
public void afterTextChanged(Editable arg0) { }

public void beforeTextChanged(CharSequence arg0, int arg1,
int arg2, int arg3) { }

public void onTextChanged(CharSequence chars, int start, int
before, int count) {
artistAdapter.getFilter().filter(chars, new
Filter.FilterListener() {
public void onFilterComplete(int count) {
Log.d(Config.LOG_TAG, filter complete! count: 
+ count);
artistAdapter.notifyDataSetChanged();
}
});
}
});
}

3.) This is my ArtistAdapter in short. I added an remove() and add() method:

public class ArtistAdapter extends ArrayAdapterArtist implements
SectionIndexer {
private ListArtist items;

/* other stuff like overridden getView, getPositionForSection,
getSectionForPosition and so on */

@Override
public void remove(Artist object) {
super.remove(object);
items.remove(object);
}

@Override
public void add(Artist object) {
super.add(object);
items.add(object);
}
}  


4.) My artist has also the toString() overridden:

public class Artist implements ComparableArtist {
public String   uid;
public String   name;

public Artist(String id, String name) {
this.uid = id;
this.name = name;
}

public int compareTo(Artist another) {
return this.name.compareToIgnoreCase(another.name);
}

@Override
public

[android-developers] How-To write a custom filter for ListView with ArrayAdapter

2010-03-25 Thread Anton Pirker

Hi List!

I have a ListView which is connected to a ArrayAdapter where Artist is a 
simple class of mine, that has only an id and a name.


Now i want to filter the ListView so i call:

|artistAdapter.getFilter().filter(bla, new Filter.FilterListener() {
   public void onFilterComplete(int count) {
   Log.d(Config.LOG_TAG, filter complete! count:  + count); // returns 8
   Log.d(Config.LOG_TAG, adapter count:  + artistAdapter.getCount()); // 
return 1150
   }
});
|

The first debug statement prints a count of 8. That's the corrent count 
for listitems that start with bla but the adapter does not get it. the 
second debug statement prints a count 1150 items. that's the complete 
number of items in the list.


so somehow the filter does not tell the adapter that it has filtered the 
underlying data.


i want to know now: do i have do code something in my adapter so it gets 
the updates from the filter? do i have to write a custom filter? what do 
i have to do?


Thanks, Anton

--
DI(FH) Anton Pirker

--
cross platform mobile software
burggasse 123/53
a-1070 wien
tel: +43 699 1234 0 456
skype: antonpirker

http://anton-pirker.at



--
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.


[android-developers] Re: Button in ListView

2010-03-19 Thread Anton Pirker
Hi!

Thanks for the help!
I have now implemented it the way you suggested, but the onSingleTapUp
is not firing.

This is what i have done:

// defined my own gesture detector:
class MyGestureDetector extends SimpleOnGestureListener {
@Override
public boolean onSingleTapUp(MotionEvent e) {
Log.d(Config.LOG_TAG, TABTAB);
return super.onSingleTapUp(e);
}
}

// created the gesture listener:
GestureDetector gestureDetector = new GestureDetector(new
MyGestureDetector());

View.OnTouchListener gestureListener = new View.OnTouchListener() {
public boolean onTouch(View v, MotionEvent event) {
boolean b = gestureDetector.onTouchEvent(event);
Log.d(Config.LOG_TAG, PLAY:  + b);
return b;
}
};


// add the gesture listener to my button:
ToggleButton playBtn =
(ToggleButton)v.findViewById(R.id.btn_list_play);
playBtn.setClickable(false);
playBtn.setOnTouchListener(gestureListener);


The onTouch() in gestureListener is fired. The call to
gestureDetector.onTouchEvent() always returns false.
The onSingleTapUp() in MyGestureDetector is never fired. If i
implement a onDown() in MyGestureDetector it IS fired.
Can anyone explain me why?

Thanks,
Anton







On Mar 15, 10:03 am, NapoleonLiu liuwa...@neusoft.com wrote:
 Hi
   I have the same problem , at last i do it like this
 I write two GestureListener, implement onSingleTapUp method.
 set both the button and other view's clickable to false
 and set them OnTouchListener(NOT onClickListener) with GestureListener.
 if you haven't used GestureListener, you can learn it from ApiDemos.



 On Mon, 15 Mar 2010 16:26:32 +0800,AntonPirker an...@ignaz.at wrote:
  Hello List!

  I have a problem that some other people on this list (and other android  
  sites) also have/had, but was unable to find a solution.
  I have a ListView with a custom view for the row which looks like this:

  RelativeLayout
      ToggleButton/
      TextView/
  /RelativeLayout

  Its basically a list of songs that i show. What i want to achieve:

  If the user clicks on the ToggleButton the song should be played.
  If the user clicks somewhere else on the row, the details intent of the  
  song should be launched.

  So I want to have two events on every row, event1: the button click,  
  event2: click somewhere except on the button.

  Right now i have a custom adapter where i call .setOnClickListener() on  
  the button. Now the button works (event1 works), the song is played, but  
  the rest of the row is not clickable (event2 does not work). If i remove  
  the call to setOnClickListener() the row is clickable (event1 works) and  
  the details are displayed as suppossed, but the button is not working.  
  (event1 does not work)

  There are apps out there, that have buttons in lists so this must be  
  possible.
  Could someone please tell me how to have more than one click event on a  
  lists row?

  I have found a solution that reads: You have to use TouchDelegate But  
  i do not have a clue how! If someone knows how a solution with  
  TouchDelegate looks like, please explain it to me!

  Thanks,
 Anton

 ---
 Confidentiality Notice: The information contained in this e-mail and any 
 accompanying attachment(s)
 is intended only for the use of the intended recipient and may be 
 confidential and/or privileged of
 Neusoft Corporation, its subsidiaries and/or its affiliates. If any reader of 
 this communication is
 not the intended recipient, unauthorized use, forwarding, printing,  storing, 
 disclosure or copying
 is strictly prohibited, and may be unlawful.If you have received this 
 communication in error,please
 immediately notify the sender by return e-mail, and delete the original 
 message and all copies from
 your system. Thank you.
 ---

-- 
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.


[android-developers] Button in ListView

2010-03-15 Thread Anton Pirker

Hello List!

I have a problem that some other people on this list (and other android 
sites) also have/had, but was unable to find a solution.

I have a ListView with a custom view for the row which looks like this:

RelativeLayout
   ToggleButton/
   TextView/
/RelativeLayout

Its basically a list of songs that i show. What i want to achieve:

If the user clicks on the ToggleButton the song should be played.
If the user clicks somewhere else on the row, the details intent of the 
song should be launched.


So I want to have two events on every row, event1: the button click, 
event2: click somewhere except on the button.


Right now i have a custom adapter where i call .setOnClickListener() on 
the button. Now the button works (event1 works), the song is played, but 
the rest of the row is not clickable (event2 does not work). If i remove 
the call to setOnClickListener() the row is clickable (event1 works) and 
the details are displayed as suppossed, but the button is not working. 
(event1 does not work)


There are apps out there, that have buttons in lists so this must be 
possible.
Could someone please tell me how to have more than one click event on a 
lists row?


I have found a solution that reads: You have to use TouchDelegate But 
i do not have a clue how! If someone knows how a solution with 
TouchDelegate looks like, please explain it to me!


Thanks,
Anton

--
DI(FH) Anton Pirker

--
cross platform mobile software
burggasse 123/53
a-1070 wien
tel: +43 699 1234 0 456
skype: antonpirker

http://anton-pirker.at



--
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


Re: [android-developers] ADC2 Results?

2009-11-30 Thread Anton Pirker
Hi all!

Robert Green wrote:
 According to their last email, today is the day.  Has anyone received
 news about their ADC2 entry yet
I still do not have any information whether i have won or not. Is it 
just me or are others also still waiting for the google email?

Anton


-- 
DI(FH) Anton Pirker

--
cross platform mobile software
burggasse 123/53
a-1070 wien
tel: +43 699 1234 0 456
skype: antonpirker

http://anton-pirker.at



-- 
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: HTC Hero + requestFeature() must be called

2009-11-13 Thread Anton Pirker
Hi Shane!

Have you solved your Problem? I think i have the same one!


Thanks for any information,
Anton


On Oct 18, 6:55 am, Shane shanemenchi...@gmail.com wrote:
 I am getting a requestFeature() must be called before adding content
 but only on HTC Hero phones.  This error nevers occurs on G1s, Magic
 but only on the Hero.

 I think it occurs (but not sure) when a progress dialog is shown to
 the user.  Weird thing is, the progress dialog is shown two or three
 times on the Hero with no problems.  On the third or forth time it is
 shown to the user, the error above occurs.

 Why only on the Hero?  Any suggestions?

             case DIALOG3_KEY:
                 progressDialog.setMessage(getString
 (R.string.deletefilewait));
                 progressDialog.setIndeterminate(true);
                 progressDialog.setCancelable(true);
                 return progressDialog;

 FYI - progressDialog is a global variable  - private ProgressDialog
 progressDialog;

 Thanks,

 Shane

-- 
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] showDialog() and requestFeature() must be called before adding content Error

2009-11-13 Thread Anton Pirker
Hi fellow Android guys and girls!

I have following problem.
In my Activity I want to show in onResume() and ProgressDialog.

I do this call (where Constants.DIALOG_GET_POSITION is just an integer 
value):
showDialog(Constants.DIALOG_GET_POSITION);



in my onCreateDialog() callback (in the same Activity) I have following 
code:

protected Dialog onCreateDialog(int id) {
Dialog dialog;
AlertDialog.Builder builder = null;

switch(id) {  
case Constants.DIALOG_GET_POSITION:
dialog = ProgressDialog.show(this, , Trying to detect 
your location. Please wait..., true);
break;
   
default:
dialog = null;
}
return dialog;  
}


When I run my activity i get an AndroidRuntimeException: 
requestFeature() must be called before adding content
This error is on the line where I call showDialog();

Here the Stacktrace:

11-13 10:25:02.195: ERROR/AndroidRuntime(3266): Uncaught handler: thread 
main exiting due to uncaught exception
11-13 10:25:02.345: ERROR/AndroidRuntime(3266): 
java.lang.RuntimeException: Unable to resume activity 
{at.ignaz.UrbanGolf/at.ignaz.UrbanGolf.Activity.SetupActivity}: 
android.util.AndroidRuntimeException: requestFeature() must be called 
before adding content
11-13 10:25:02.345: ERROR/AndroidRuntime(3266): at 
android.app.ActivityThread.performResumeActivity(ActivityThread.java:2632)
11-13 10:25:02.345: ERROR/AndroidRuntime(3266): at 
android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2647)
11-13 10:25:02.345: ERROR/AndroidRuntime(3266): at 
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2287)
11-13 10:25:02.345: ERROR/AndroidRuntime(3266): at 
android.app.ActivityThread.access$1800(ActivityThread.java:112)
11-13 10:25:02.345: ERROR/AndroidRuntime(3266): at 
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1692)
11-13 10:25:02.345: ERROR/AndroidRuntime(3266): at 
android.os.Handler.dispatchMessage(Handler.java:99)
11-13 10:25:02.345: ERROR/AndroidRuntime(3266): at 
android.os.Looper.loop(Looper.java:123)
11-13 10:25:02.345: ERROR/AndroidRuntime(3266): at 
android.app.ActivityThread.main(ActivityThread.java:3948)
11-13 10:25:02.345: ERROR/AndroidRuntime(3266): at 
java.lang.reflect.Method.invokeNative(Native Method)
11-13 10:25:02.345: ERROR/AndroidRuntime(3266): at 
java.lang.reflect.Method.invoke(Method.java:521)
11-13 10:25:02.345: ERROR/AndroidRuntime(3266): at 
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:782)
11-13 10:25:02.345: ERROR/AndroidRuntime(3266): at 
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540)
11-13 10:25:02.345: ERROR/AndroidRuntime(3266): at 
dalvik.system.NativeStart.main(Native Method)
11-13 10:25:02.345: ERROR/AndroidRuntime(3266): Caused by: 
android.util.AndroidRuntimeException: requestFeature() must be called 
before adding content
11-13 10:25:02.345: ERROR/AndroidRuntime(3266): at 
com.android.internal.policy.impl.PhoneWindow.requestFeature(PhoneWindow.java:286)
11-13 10:25:02.345: ERROR/AndroidRuntime(3266): at 
com.android.internal.app.AlertController.installContent(AlertController.java:198)
11-13 10:25:02.345: ERROR/AndroidRuntime(3266): at 
android.app.AlertDialog.onCreate(AlertDialog.java:251)
11-13 10:25:02.345: ERROR/AndroidRuntime(3266): at 
android.app.ProgressDialog.onCreate(ProgressDialog.java:176)
11-13 10:25:02.345: ERROR/AndroidRuntime(3266): at 
android.app.Dialog.dispatchOnCreate(Dialog.java:287)
11-13 10:25:02.345: ERROR/AndroidRuntime(3266): at 
android.app.Activity.showDialog(Activity.java:2402)
11-13 10:25:02.345: ERROR/AndroidRuntime(3266): at 
at.ignaz.UrbanGolf.Activity.SetupActivity.onResume(SetupActivity.java:247)
11-13 10:25:02.345: ERROR/AndroidRuntime(3266): at 
android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1229)
11-13 10:25:02.345: ERROR/AndroidRuntime(3266): at 
android.app.Activity.performResume(Activity.java:3530)
11-13 10:25:02.345: ERROR/AndroidRuntime(3266): at 
android.app.ActivityThread.performResumeActivity(ActivityThread.java:2619)
11-13 10:25:02.345: ERROR/AndroidRuntime(3266): ... 12 more


What am I doing wrong? I could swear that this code was working already.
Any hints or tips?

Thanks in advance,
Anton Pirker

-- 
DI(FH) Anton Pirker

--
cross platform mobile software
burggasse 123/53
a-1070 wien
tel: +43 699 1234 0 456
skype: antonpirker

http://anton-pirker.at



-- 
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


Re: [android-developers] Application design - using threads

2009-11-13 Thread Anton Pirker
Hi!

Maybe this is what you are looking for:
http://www.youtube.com/watch?v=U4Bk5rmIpic

Its a talk about developing real-time games for android.
Has a lot of best practices in it!

Enjoy,
Anton



Neilz wrote:
 Hi all. I've been reading the developer guide, the sections on
 designing for performance and responsiveness. It's great stuff, and
 I'm going to go through all my code and refactor everything I can to
 meet these suggestions.

 One line stood out for me: For games specifically, do calculations
 for moves in a child thread.

 Could someone possibly elaborate on this a little? If you had a game
 where the screen was being refreshed continuously, with calculations
 being made on every refresh, does this mean starting and ending a
 thread every time this happens? Or is one thread created at the start,
 which stays open for the duration of the game?

 And would this be an inner class extending Thread with a run() method
 as usual, or are there better ways of handling it? I recently used an
 AsyncTask to handle a background task, would that be something that
 could be of use here?

 Many thanks for any help.

   


-- 
DI(FH) Anton Pirker

--
cross platform mobile software
burggasse 123/53
a-1070 wien
tel: +43 699 1234 0 456
skype: antonpirker

http://anton-pirker.at



-- 
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: showDialog() and requestFeature() must be called before adding content Error

2009-11-13 Thread Anton Pirker
I have more information:

The exception is thrown on my htc magic with android 1.5
But on a htc tattoo with android 1.6 everything works fine.

The code is compiled with Android SDK 1.5r2


Maybe there is a problem with the sdk version? I need to get it to
work on android 1.5, so i thought the best thing would be to compile
it with sdk 1.5, right?

Any ideas?

regards,
Anton




On Nov 13, 10:41 am, Anton Pirker an...@ignaz.at wrote:
 Hi fellow Android guys and girls!

 I have following problem.
 In my Activity I want to show in onResume() and ProgressDialog.

 I do this call (where Constants.DIALOG_GET_POSITION is just an integer
 value):
     showDialog(Constants.DIALOG_GET_POSITION);

 in my onCreateDialog() callback (in the same Activity) I have following
 code:

     protected Dialog onCreateDialog(int id) {
         Dialog dialog;
         AlertDialog.Builder builder = null;

         switch(id) {              
             case Constants.DIALOG_GET_POSITION:
                 dialog = ProgressDialog.show(this, , Trying to detect
 your location. Please wait..., true);
                 break;

             default:
                 dialog = null;
         }
         return dialog;      
     }

 When I run my activity i get an AndroidRuntimeException:
 requestFeature() must be called before adding content
 This error is on the line where I call showDialog();

 Here the Stacktrace:

 11-13 10:25:02.195: ERROR/AndroidRuntime(3266): Uncaught handler: thread
 main exiting due to uncaught exception
 11-13 10:25:02.345: ERROR/AndroidRuntime(3266):
 java.lang.RuntimeException: Unable to resume activity
 {at.ignaz.UrbanGolf/at.ignaz.UrbanGolf.Activity.SetupActivity}:
 android.util.AndroidRuntimeException: requestFeature() must be called
 before adding content
 11-13 10:25:02.345: ERROR/AndroidRuntime(3266):     at
 android.app.ActivityThread.performResumeActivity(ActivityThread.java:2632)
 11-13 10:25:02.345: ERROR/AndroidRuntime(3266):     at
 android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2647)
 11-13 10:25:02.345: ERROR/AndroidRuntime(3266):     at
 android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2287)
 11-13 10:25:02.345: ERROR/AndroidRuntime(3266):     at
 android.app.ActivityThread.access$1800(ActivityThread.java:112)
 11-13 10:25:02.345: ERROR/AndroidRuntime(3266):     at
 android.app.ActivityThread$H.handleMessage(ActivityThread.java:1692)
 11-13 10:25:02.345: ERROR/AndroidRuntime(3266):     at
 android.os.Handler.dispatchMessage(Handler.java:99)
 11-13 10:25:02.345: ERROR/AndroidRuntime(3266):     at
 android.os.Looper.loop(Looper.java:123)
 11-13 10:25:02.345: ERROR/AndroidRuntime(3266):     at
 android.app.ActivityThread.main(ActivityThread.java:3948)
 11-13 10:25:02.345: ERROR/AndroidRuntime(3266):     at
 java.lang.reflect.Method.invokeNative(Native Method)
 11-13 10:25:02.345: ERROR/AndroidRuntime(3266):     at
 java.lang.reflect.Method.invoke(Method.java:521)
 11-13 10:25:02.345: ERROR/AndroidRuntime(3266):     at
 com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:782)
 11-13 10:25:02.345: ERROR/AndroidRuntime(3266):     at
 com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540)
 11-13 10:25:02.345: ERROR/AndroidRuntime(3266):     at
 dalvik.system.NativeStart.main(Native Method)
 11-13 10:25:02.345: ERROR/AndroidRuntime(3266): Caused by:
 android.util.AndroidRuntimeException: requestFeature() must be called
 before adding content
 11-13 10:25:02.345: ERROR/AndroidRuntime(3266):     at
 com.android.internal.policy.impl.PhoneWindow.requestFeature(PhoneWindow.java:286)
 11-13 10:25:02.345: ERROR/AndroidRuntime(3266):     at
 com.android.internal.app.AlertController.installContent(AlertController.java:198)
 11-13 10:25:02.345: ERROR/AndroidRuntime(3266):     at
 android.app.AlertDialog.onCreate(AlertDialog.java:251)
 11-13 10:25:02.345: ERROR/AndroidRuntime(3266):     at
 android.app.ProgressDialog.onCreate(ProgressDialog.java:176)
 11-13 10:25:02.345: ERROR/AndroidRuntime(3266):     at
 android.app.Dialog.dispatchOnCreate(Dialog.java:287)
 11-13 10:25:02.345: ERROR/AndroidRuntime(3266):     at
 android.app.Activity.showDialog(Activity.java:2402)
 11-13 10:25:02.345: ERROR/AndroidRuntime(3266):     at
 at.ignaz.UrbanGolf.Activity.SetupActivity.onResume(SetupActivity.java:247)
 11-13 10:25:02.345: ERROR/AndroidRuntime(3266):     at
 android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1229)
 11-13 10:25:02.345: ERROR/AndroidRuntime(3266):     at
 android.app.Activity.performResume(Activity.java:3530)
 11-13 10:25:02.345: ERROR/AndroidRuntime(3266):     at
 android.app.ActivityThread.performResumeActivity(ActivityThread.java:2619)
 11-13 10:25:02.345: ERROR/AndroidRuntime(3266):     ... 12 more

 What am I doing wrong? I could swear that this code was working already.
 Any hints or tips?

 Thanks in advance,AntonPirker

 --
 DI(FH)AntonPirker

 --
 cross platform mobile software

Re: [android-developers] Re: showDialog() and requestFeature() must be called before adding content Error

2009-11-13 Thread Anton Pirker
You are awesome!

Calling the .show() method was completely stupid. In your 
onCreateDialog() callback method you just create the dialog and then 
return it. The rest is done by Android.

Now everything works fine!


Thanks a million,
Anton



TreKing wrote:
 I've seen this error when trying to set the view on a Dialog after 
 it's been created. Setting the view as part of the construction 
 process using the Builder makes it go away.

 Maybe try creating the ProgressDialog with the constructor first (new 
 ProgressDialog(title, msg, ...), then using the show() method with no 
 arguments?

 -
 TreKing - Chicago transit tracking app for Android-powered devices
 http://sites.google.com/site/rezmobileapps/treking


 On Fri, Nov 13, 2009 at 8:36 AM, Anton Pirker l...@ignaz.at 
 mailto:l...@ignaz.at wrote:

 I have more information:

 The exception is thrown on my htc magic with android 1.5
 But on a htc tattoo with android 1.6 everything works fine.

 The code is compiled with Android SDK 1.5r2


 Maybe there is a problem with the sdk version? I need to get it to
 work on android 1.5, so i thought the best thing would be to compile
 it with sdk 1.5, right?

 Any ideas?

 regards,
 Anton




 On Nov 13, 10:41 am, Anton Pirker an...@ignaz.at
 mailto:an...@ignaz.at wrote:
  Hi fellow Android guys and girls!
 
  I have following problem.
  In my Activity I want to show in onResume() and ProgressDialog.
 
  I do this call (where Constants.DIALOG_GET_POSITION is just an
 integer
  value):
  showDialog(Constants.DIALOG_GET_POSITION);
 
  in my onCreateDialog() callback (in the same Activity) I have
 following
  code:
 
  protected Dialog onCreateDialog(int id) {
  Dialog dialog;
  AlertDialog.Builder builder = null;
 
  switch(id) {  
  case Constants.DIALOG_GET_POSITION:
  dialog = ProgressDialog.show(this, , Trying
 to detect
  your location. Please wait..., true);
  break;
 
  default:
  dialog = null;
  }
  return dialog;  
  }
 
  When I run my activity i get an AndroidRuntimeException:
  requestFeature() must be called before adding content
  This error is on the line where I call showDialog();
 
  Here the Stacktrace:
 
  11-13 10:25:02.195: ERROR/AndroidRuntime(3266): Uncaught
 handler: thread
  main exiting due to uncaught exception
  11-13 10:25:02.345: ERROR/AndroidRuntime(3266):
  java.lang.RuntimeException: Unable to resume activity
  {at.ignaz.UrbanGolf/at.ignaz.UrbanGolf.Activity.SetupActivity}:
  android.util.AndroidRuntimeException: requestFeature() must be
 called
  before adding content
  11-13 10:25:02.345: ERROR/AndroidRuntime(3266): at
 
 android.app.ActivityThread.performResumeActivity(ActivityThread.java:2632)
  11-13 10:25:02.345: ERROR/AndroidRuntime(3266): at
 
 android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2647)
  11-13 10:25:02.345: ERROR/AndroidRuntime(3266): at
 
 android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2287)
  11-13 10:25:02.345: ERROR/AndroidRuntime(3266): at
  android.app.ActivityThread.access$1800(ActivityThread.java:112)
  11-13 10:25:02.345: ERROR/AndroidRuntime(3266): at
  android.app.ActivityThread$H.handleMessage(ActivityThread.java:1692)
  11-13 10:25:02.345: ERROR/AndroidRuntime(3266): at
  android.os.Handler.dispatchMessage(Handler.java:99)
  11-13 10:25:02.345: ERROR/AndroidRuntime(3266): at
  android.os.Looper.loop(Looper.java:123)
  11-13 10:25:02.345: ERROR/AndroidRuntime(3266): at
  android.app.ActivityThread.main(ActivityThread.java:3948)
  11-13 10:25:02.345: ERROR/AndroidRuntime(3266): at
  java.lang.reflect.Method.invokeNative(Native Method)
  11-13 10:25:02.345: ERROR/AndroidRuntime(3266): at
  java.lang.reflect.Method.invoke(Method.java:521)
  11-13 10:25:02.345: ERROR/AndroidRuntime(3266): at
 
 
 com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:782)
  11-13 10:25:02.345: ERROR/AndroidRuntime(3266): at
  com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540)
  11-13 10:25:02.345: ERROR/AndroidRuntime(3266): at
  dalvik.system.NativeStart.main(Native Method)
  11-13 10:25:02.345: ERROR/AndroidRuntime(3266): Caused by:
  android.util.AndroidRuntimeException: requestFeature() must be
 called
  before adding content
  11-13 10:25:02.345: ERROR/AndroidRuntime(3266

Re: [android-developers] Re: second dialog in activity is not showing

2009-11-01 Thread Anton Pirker
Hi Lance!

Thanks for the links! Now it's working!
(And I learned something about thread save UI in Android)

Thanks again,
Anton


Lance Nanek wrote:
 The UI is not thread safe and calling related methods from a
 background thread like that run by java.util.Timer can cause trouble.
 There's a good blog post on ways to schedule work on the UI thread or
 communicate back to it here:
 http://android-developers.blogspot.com/2009/05/painless-threading.html

 There's also an example of communicating back to the UI thread called
 Example ProgressDialog with a second thread on this page:
 http://developer.android.com/intl/fr/guide/topics/ui/dialogs.html

 On Oct 31, 4:42 pm, Anton Pirker an...@ignaz.at wrote:
   
 Hi android guys and girls!

 I have a really strange problem. I have an activity which displays a map
 and a marker with the users current location on that maps.

 Right now my code is something like this: (in onCreate of the activity)

 1) display a progress dialog with the text detecting your location,
 please wait...

 2) request location updates. (activity implements LocationListener)
 locationManager.requestLocationUpdates(provider,
 (long)Constants.MIN_TIME, (float)Constants.MIN_DISTANCE, this);

 3) right after the line above i have following:
 timer.schedule(new GetLastLocation(this), 5000);
 which means: wait 5 sec and then call GetLastLocation().run()

 GetLastLocation looks like this:

 class GetLastLocation extends TimerTask {
 private SetupActivity parent;
 public GetLastLocation(SetupActivity act) {
 parent = act;
 }
 public void run() {
 removeDialog(DIALOG_GET_POSITION);
 parent.showMessage();
 }
 }

 So if 5 seconds pass by, i dismiss(remove) the dialog i displayed in 1)

 4) now i want to show an AlertDialog with the message could not find
 your location, taking the last known
 parent.showMessage() looks like this:
 public void showMessage() {
 Log.e(###, showMessage 1/2);
 showDialog(DIALOG_GET_POSITION);
 Log.e(###, showMessage 2/2);
 }

 and here the first log message showMessage 1/2 is printed to the log,
 but not the second one showMessage 2/2.
 And there is no exception and nothing that tells me what is wrong...

 Could someone please help me?
 Maybe there is a better way to get he location and if no location is
 delivered show a message!

 Thankful for every hint,
 Anton

 --
 DI(FH) Anton Pirker

 --
 cross platform mobile software
 burggasse 123/53
 a-1070 wien
 tel: +43 699 1234 0 456
 skype: antonpirker

 http://anton-pirker.at
 

   


-- 
DI(FH) Anton Pirker

--
cross platform mobile software
burggasse 123/53
a-1070 wien
tel: +43 699 1234 0 456
skype: antonpirker

http://anton-pirker.at



-- 
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] second dialog in activity is not showing

2009-10-31 Thread Anton Pirker
Hi android guys and girls!

I have a really strange problem. I have an activity which displays a map 
and a marker with the users current location on that maps.

Right now my code is something like this: (in onCreate of the activity)

1) display a progress dialog with the text detecting your location, 
please wait...

2) request location updates. (activity implements LocationListener)
locationManager.requestLocationUpdates(provider, 
(long)Constants.MIN_TIME, (float)Constants.MIN_DISTANCE, this);

3) right after the line above i have following:
timer.schedule(new GetLastLocation(this), 5000);
which means: wait 5 sec and then call GetLastLocation().run()

GetLastLocation looks like this:

class GetLastLocation extends TimerTask {
private SetupActivity parent;
public GetLastLocation(SetupActivity act) {
parent = act;
}
public void run() {
removeDialog(DIALOG_GET_POSITION);
parent.showMessage();
}
}

So if 5 seconds pass by, i dismiss(remove) the dialog i displayed in 1)

4) now i want to show an AlertDialog with the message could not find 
your location, taking the last known
parent.showMessage() looks like this:
public void showMessage() {
Log.e(###, showMessage 1/2);
showDialog(DIALOG_GET_POSITION);
Log.e(###, showMessage 2/2);
}


and here the first log message showMessage 1/2 is printed to the log, 
but not the second one showMessage 2/2.
And there is no exception and nothing that tells me what is wrong...


Could someone please help me?
Maybe there is a better way to get he location and if no location is 
delivered show a message!


Thankful for every hint,
Anton

-- 
DI(FH) Anton Pirker

--
cross platform mobile software
burggasse 123/53
a-1070 wien
tel: +43 699 1234 0 456
skype: antonpirker

http://anton-pirker.at



-- 
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] Disable 2g and 3g networks

2009-10-30 Thread Anton Pirker

Hi all!

I am developing an application that is used for a sort of tournaments.
The requirements are that if the application is running it should be
impossible to make and receive phone calls.

Can i disable 2g/3g from within my app?
(Airplane mode is no option, because i still need GPS)

Thanks in advance!
Anton


--~--~-~--~~~---~--~~
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] In-App purchasing

2009-10-19 Thread Anton Pirker

Hi fellow androids!

I have a android app that is for free.
Now I want the users of my application to have the ability to buy extra 
features from within the application.

I thought about something like this:

-) user wants to have extra features.
-) she clicks on the corresponding button
-) she is prompted to enter some payment information (like credentials 
for paypal oder google checkout)
-) if the payment is ok she is displayed a unlock-code
-) she enters the unlock-code into the application
-) she has more features in her app.


So now my questions:

-) which payment service (paypal, google checkout, etc) should i use? 
there should be no big costs in setup
-) is the process i described above good for in app purchasing?
-) can I have a 'link' in the payments success page that opens my app 
and gives the unlock code to it, so the user has not to enter it manually?
-) have you done this already, and how did you solve it?


Any hints/comments welcome!

Thanks in advance,
Anton



-- 
DI(FH) Anton Pirker

--
cross platform mobile software
burggasse 123/53
a-1070 wien
tel: +43 699 1234 0 456
skype: antonpirker

http://anton-pirker.at




--~--~-~--~~~---~--~~
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: In-App purchasing

2009-10-19 Thread Anton Pirker

Hi Mark!

Thanks for the link! I read it an this is the part that's interesting:

3.3 ... You may not collect future charges from users for copies of the 
Products that those users were initially allowed to download for free. 
This is not intended to prevent distribution of free trial versions of 
the Product with an “upsell” option to obtain the full version of the 
Product: Such free trials for Products are encouraged. However, if you 
want to collect fees after the free trial expires, you must collect all 
fees for the full version of the Product through the Payment Processor 
on the Market. In this Agreement, “free” means there are no charges or 
fees of any kind for use of the Product. All fees received by Developers 
for Products distributed via the Market must be processed by the 
Market’s Payment Processor.



So I am allowed to charge for extra features in a free app as long as 
these fees are _processed by the Market’s Payment Processor._
And now the big question: how can I do just this? How do I talk to 
Googles Market Payment Processor from within my app?

Thanks,
Anton




Mark Murphy wrote:
 Anton Pirker wrote:
   
 I have a android app that is for free.
 Now I want the users of my application to have the ability to buy extra 
 features from within the application.

 I thought about something like this:

 -) user wants to have extra features.
 -) she clicks on the corresponding button
 -) she is prompted to enter some payment information (like credentials 
 for paypal oder google checkout)
 -) if the payment is ok she is displayed a unlock-code
 -) she enters the unlock-code into the application
 -) she has more features in her app.
 

 If you are distributing through the Android Market, I recommend that you
 and your legal counsel review the Android Market Developer Distribution
 Agreement:

 http://www.android.com/us/developer-distribution-agreement.html

 There are many terms in there that pertain directly to the model you are
 describing.

 Similarly, if you are distributing through other channels, review their
 equivalent documents, to ensure that you are complying with their terms
 and conditions.

 If you are distributing the app yourself through your own Web site, you
 are welcome to do whatever you want in the area of in-app purchases, of
 course.

   


-- 
DI(FH) Anton Pirker

--
cross platform mobile software
burggasse 123/53
a-1070 wien
tel: +43 699 1234 0 456
skype: antonpirker

http://anton-pirker.at




--~--~-~--~~~---~--~~
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] Gears support for Androids WebView

2009-10-13 Thread Anton Pirker

Hi List!

I want to write an offline web application but unfortunately the WebKit 
engine of Androids WebView does not support this Html5 feature.
I have tried the offline detection[1] on my Android 1.5 phone and on the 
Android 1.6 emulator and both do not support offline web applications. 
But on an iPhone (which also employs WebKit for its web rendering) it works.

The WebView does not support Google Gears either, but the built in web 
browser _does_!

So my idea now is, that we subclass the WebView and add the gears 
support from the built in web browser. So we at least have gears support 
on the WebView. I looked around the android code and I think I found the 
browser code here [2].

So my questions now are:
-) Has anyone of you planed something similar?
-) Has anyone of you messed around with the Android browser code?
-) What do you think in general of my idea?

Grateful for useful pointers and comments!
Anton


[1] http://www.diveintohtml5.org/detect.html#offline
(under the image on the right you can read whether your browser supports 
offline web application or not.)

[2] 
http://android.git.kernel.org/?p=platform/packages/apps/Browser.git;a=tree;f=src/com/android/browser;h=d01bd23d6c0065ddccc301737f1ec49309a4a3e4;hb=HEAD

--~--~-~--~~~---~--~~
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] Usage of WebView.addJavascriptInterface()

2009-10-12 Thread Anton Pirker

Hey List!

I have an Application that displays a Website in an WebView.  This is 
working quite good.
Now i want give the Website access to a Class of my Android Project with
WebView.addJavascriptInterface() [1]

This is my Java Code (in an Activity)


public void onCreate(Bundle savedInstanceState) {
FileUtil fu = new FileUtil();

WebView appView = (WebView) findViewById(R.id.appView);
appView.getSettings().setJavaScriptEnabled(true);
appView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
appView.addJavascriptInterface(fu, FileUtil);
appView.loadUrl(someUrl);
}

// The FileUtils class is a very basic test-class:
public class FileUtil {
public FileUtils() { }

public int read() {
   return 99;
}
}


And now i have a index.html accessable via the url someUrl
In this html page i try to call window.FileUtil.read() but nothing happens.
Then I displayed all members of the window object and my FileUtil is 
missing.

Have i forgot anything? How can i make my Java methods accessable from 
Javascript?


Thanks in advance!
Anton, Freelance Android Developer

[1] 
http://developer.android.com/reference/android/webkit/WebView.html#addJavascriptInterface(java.lang.Object,%20java.lang.String)

--~--~-~--~~~---~--~~
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: Usage of WebView.addJavascriptInterface()

2009-10-12 Thread Anton Pirker

Hey Mark!

Mark Murphy wrote:

 Dump the window. -- just reference FileUtil directly.

   
 Then I displayed all members of the window object and my FileUtil is 
 missing.
 

 It's not supposed to be there. You do not get an actual Javascript
 object from addJavascriptInterface().

 It is a bit more like you get a new Javascript keyword -- you can write
 FileUtil.read(), and the Javascript interpreter will interpret it, but
 there is no FileUtil object.
   


Ah, i see! That's why it is called addJavascriptINTERFACE() and not 
addJavascriptObject ;)

I am trying to create a file on the sd card from the website and i was 
testing on my phone that was connected to the notebook with an usb cable 
and the usb sharing was activated. and it seems if all this is true i 
cannot write to the sd-card! took my quite a while to find out about that.


Thanks for your hints!
Anton


--~--~-~--~~~---~--~~
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] Android WebView and HTML5

2009-10-09 Thread Anton Pirker

Hey fellow Androids!

I am experimenting with Androids WebView[1] and its HTML5 features.
I have written a little webpage with does the features detection like 
described here:
http://diveintohtml5.org/detect.html

And now I see (I am on a SDK1.6 Emulator) that the LocalStorage, the 
WebWorkers and Offline Web Applications are not supported!

Does anyone know when these features will be supported? Or does anyone 
know the exact version (or build) of the webkit engine, that is used in 
Android 1.6?

Any hints are greatly appreciated!

Thanks,
Anton

[1] http://developer.android.com/reference/android/webkit/WebView.html

--~--~-~--~~~---~--~~
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: Android WebView and HTML5

2009-10-09 Thread Anton Pirker

As a explanation.

I have written an app which displays an WebView that loads my html
page with the features-testing scripts describet here:
http://diveintohtml5.org/detect.html

As a workaround for the missing features i had the idea that i could
write my own WebView with an nightly version of webkit.
Do you think this is a good idea to do? I do not know how big a
compiled version of webkit is and if android has its own optimized
version of webkit.
Has anyone done something similiar?

Thanks,
Anton



On Oct 9, 12:37 pm, Anton Pirker an...@ignaz.at wrote:
 Hey fellow Androids!

 I am experimenting with Androids WebView[1] and its HTML5 features.
 I have written a little webpage with does the features detection like
 described here:http://diveintohtml5.org/detect.html

 And now I see (I am on a SDK1.6 Emulator) that the LocalStorage, the
 WebWorkers and Offline Web Applications are not supported!

 Does anyone know when these features will be supported? Or does anyone
 know the exact version (or build) of the webkit engine, that is used in
 Android 1.6?

 Any hints are greatly appreciated!

 Thanks,
 Anton

 [1]http://developer.android.com/reference/android/webkit/WebView.html
--~--~-~--~~~---~--~~
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: Android WebView and HTML5

2009-10-09 Thread Anton Pirker

Hi Mark!

Thanks for the reply!


Mark Murphy wrote:
 Anton Pirker wrote:
   
 As a workaround for the missing features i had the idea that i could
 write my own WebView with an nightly version of webkit.
 Do you think this is a good idea to do?
 

 Only if you have a team of ~10 engineers and a substantial budget.

   
 I do not know how big a
 compiled version of webkit is and if android has its own optimized
 version of webkit.
 

 Android has a number of optimizations for its use of WebKit, not the
 least of which is using Skia for the rendering engine.
   
Ok, so i skip that idea ;)

   
 And now I see (I am on a SDK1.6 Emulator) that the LocalStorage, the
 WebWorkers and Offline Web Applications are not supported!
   

 LocalStorage might work with the full Browser application with Google
 Gears enabled -- I'm a little fuzzy as to whether Gears offers official
 HTML5 LocalStorage support.

 WebView does not support Gears.

   
It should be possible without gears. The iphones version of webkit does 
in fact support LocalStorage and Offlien Web Applications.

 Does anyone know when these features will be supported?
   

 The Android project is not fond of forward-looking statements like
 project plans and timelines. I have to imagine it is relatively high on
 their list, since Google as a whole is seriously behind HTML5 (see
 Google Wave). However, even then, I imagine that some features (e.g.,
 Offline Web Applications) might be a wee bit tricky to add to Android,
 so complete HTML5 support may not be easy.
   

yes, google never tells stuff about release plans (not even on the 
developer days)
so we are in the dark here...
   
 Or does anyone
 know the exact version (or build) of the webkit engine, that is used in
 Android 1.6?
   

 I am under the impression that there is a way to determine this, as
 somebody mentioned a WebKit version in passing at MOTODEV Summit, but I
 don't remember what he said the version was nor how to figure it out.
 Sorry I don't have any more info on that facet of your question.
   

Thanks for all your comments.


Have a nice day,
Anton





--~--~-~--~~~---~--~~
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: Request to official ADC2 team.

2009-09-15 Thread Anton Pirker

+

Mobidev wrote:
 .   Once upon a time, we had this little group…
 http://groups.google.com/group/android-challenge Android Challenge:
 Discuss the Android Developer Challenge, including questions on
 contest details. You can also seek other developers to join a team
 effort.
…then came this message…
 http://groups.google.com/group/android-challenge/browse_thread/thread/c95216dc28b8f74c
…and the group was closed for ever.

 A humble request to ADC2 team to officially start and moderate a new
 ADC2 group similar to the previous android-challenge group. ADC2
 messages are scattered in android-developers and android-discuss
 groups. ADC2 discussions does not fit in either of these groups. There
 will be hundreds of queries, comments, news and PR pitches once the
 ADC2 judging app goes live. So please could you start a ADC2
 discussion group at the earliest.

 Thanks.
 P.S. Droids of the planet please vote with '+' or '–' for this
 request.

 
   


--~--~-~--~~~---~--~~
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] How to design a light and a full version of android app.

2009-09-03 Thread Anton Pirker

Hello Androids!


I have done a small app for the ADC2 and now i want to make a free light 
version for the Android market and one full version that will cost some 
cents.

My question now to all who have done something similar: How have you 
designed your application(s)?
I have thought about a few solutions to this problem:

1.) Duplicate the code in two different android projects
Not a very good idea, duplicate code is always bad.

2.) Create some sort of library to use in two different projects.
With this i could share the business logic of my app, but not the 
activities (at least this is what i think)
And using the activities from one project in another project would be great.

3.) Include all needed code (business logic, activities, ...) from one 
project (the full version) in my light version.
This way i would achieve some sort of new view to the code basis. This 
would be the best solution i think, but i do not know how to achieve this.

So to everybody who has done a full and light version of one and the 
same app: How have you done this?

In advance: Thanks for sharing!
Anton


--~--~-~--~~~---~--~~
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: Hmm... at last ADC2 is out of our way ... tell about your app and experience

2009-09-02 Thread Anton Pirker

Hi!

I also submitted a little app to the android developer challenge 2. I am 
from Austria and we started working on our app about two and a half 
months ago. I did the main development one of my apartment mates did 
also some coding and a friend from Brazil did the artwork.

It's a golf game called UrbanGolf where your phone is your golf club 
and your city is the golf course. It is played on a Google map and uses 
all the Sensors on your phone and GPS for the location and the swing.

With the deadline coming closer and closer we got more an more problems. 
First my friend from Brazil is moving right now to Germany and was 
unable to complete the artwork. So we developers had to become designers 
and make the best of what we had. (Three days before deadline)

The second bad thing that was happening was, that i found a pretty nasty 
bug on midnight the night before the deadline (due to my different 
timezone my deadline was 1th Sept, 9:00am) So i tried to fix the bug. It 
took me until 2:30am. I checked everything in, tested it a little and 
thought. Ok, lets upload it. After a little hassle with the signing (at 
that time i was very hungry and tired and my brain was just a bowl of 
soaked cornflakes) i managed to upload my app.

After submitting we went out for a Kebab and a celebration beer. The 
next day i woke up after the submission deadline and tried some stuff on 
my app and discovered a big bug i must have introduced the night before! 
So if you end up judging UrbanGolf light _please_ ignore the fact, 
that if you try to find your golf ball the player-icon and the accuracy 
circle is painted several times on the map and not just once.

Does anyone know if there is the possibility to upload a newer versions 
between the two judging rounds? (like it was in ADC1)
Please, just ignore this bug. If we win some money we can implement all 
the features we had to cut out for the sake of making the deadline!

Cheers,
Anton


Lout wrote:
 While you developers relax... would you mind sharing what apps to
 expect through this challenge.. and anything else you wish to share
 about ADC2 submissions... well anything including the fact: 'thank
 God, no more sleep less nights'!

 Am collecting information about the challenge (ADC2) for a news
 article as am with cnet (and AP). Pitch your app if you have already
 published or would soon publish on the market too.

 Your app name and description, web link if any, experience with
 ADC2, ... anything would be useful for our article(s).

 And do you feel that there would have been more submissions than in
 ADC1?
 Is the competition going to be tougher or less profound as you were
 allowed to put up apps not published before 1st Aug only?

 Do you think that all apps that didn't try for ADC1 should have had a
 chance?

 Congratulations on your submissions while you wait for the next
 phase.
 Thanks,
 Lout Reilly
 ps: Moderators we request you to let this through so that you too get
 some feedback.

 
   


--~--~-~--~~~---~--~~
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: Map view

2009-09-01 Thread Anton Pirker

Hi Sasi!

Have a look at the Hello-mapView Sample Code from Google:
http://developer.android.com/guide/tutorials/views/hello-mapview.html

There is everything you need!

regards,
Anton


Sasi Kumar wrote:
 Can any one help to create map view with a marker.

 When we are clicking marker it should display info window.

 By clicking that info window it shoul goto another layout.


 Ple. reply me.


 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] Activate GPS service

2009-08-26 Thread Anton Pirker

Hey list!

I have written an android app that needs the GPS capabilities of the phone.
If GPS is activated everything works fine, but if it is not i get an error.

So my question: Is it possible to write code that is activating GPS on 
the phone?
I found a forum post that it is not possible because of security 
reasons. Is this true?

Is it possible that i open the phones settings screen for gps so the 
user can activate GPS from within my application?


Thanks in advance,
Anton

-- 
DI(FH) Anton Pirker

---
ignaz software services
burggasse 123/53
a-1070 wien
tel: +43 699 1234 0 456
skype: antonpirker

http://anton-pirker.at
http://shnitzl.org




--~--~-~--~~~---~--~~
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: Set bearing in MapView (rotate MapView)

2009-08-18 Thread Anton Pirker

Hello again!

Has really no one a pointer to information on how to rotate a mapview
in sdk1.5?

Any help is greatly appreciated!
Anton




On Aug 14, 12:25 pm, Anton Pirker an...@ignaz.at wrote:
 Hello List!

 I am trying to implement amapthat rotates with the bearing i get
 from the built in compass of the htc magic.
 I have searched the web but found no good solution. Some are outdated
 (ex override onDraw() in MapView) or just not working for me (because
 the zoom controls or marker are also rotated.

 What i want to have:

 Amapthat rotates with the user, so if the user looks north, on hismapnorth is 
 up, if he looks west, on hismapwest is up.
 The zoom Controls should be always on the same spot.
 If i point marker images on themapthey should there position should
 be moved with the rotation but the image it self should not be
 rotated.

 Is there someone in here who has a point by point explanation, or even
 some sample code on how to achieve this?
 Or maybe is there a new version of MapView where i just can call a
 setBearing() or something? (Because i think a _lot_ of people want to
 do exactly this.)

 Thanks in advance,
 Anton
--~--~-~--~~~---~--~~
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: Set bearing in MapView (rotate MapView)

2009-08-18 Thread Anton Pirker

Hey String!

Thanks for your reply!

String wrote:
 I don't think there's a reasonable way to do it. Someone may jump in
 and prove me wrong, but that's my belief. Just because it's a common
 request doesn't mean that Google has implemented it.

 You could achieve something similar with the v3 Google Maps JavaScript
 API in a webview. FWIW, here's an example (not mine) of the JS maps
 rotating:
 http://googlemaps.googlermania.com/en_examples/compass/the%20compass.html
 Note that it has issues; map dragging doesn't rotate along with the
 map image.

 Also, doesn't the GMaps app for iPhone already do this? That means
 Google is probably working on it, and it's only a matter of time until
 that feature makes it into the Android app, and (eventually) the SDK.
   
Exactly that was what i was afraid of. Because i would need this feature 
for the Developer Challenge which has its deadline on Aug 31th.
But what the heck, I will just skip the map rotation and see how i can 
do my app without it.

Cheers,
Anton


 But for now, I think you're on your own.

 String


 
   


-- 
DI(FH) Anton Pirker

---
ignaz software services
burggasse 123/53
a-1070 wien
tel: +43 699 1234 0 456
skype: antonpirker

http://anton-pirker.at
http://shnitzl.org




--~--~-~--~~~---~--~~
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] Turn on light of trackball on HTC magic

2009-08-14 Thread Anton Pirker

Hey list!

I have a HTC Magic and just love the glowing trackball if you have
missed a call.

So i wanted to use the trackball light in my own android apps, but i
can not find anything on how to make it glow.
Does anyone know how to turn the light of the trackball on and of?

Thanks in advance,
Anton

--~--~-~--~~~---~--~~
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: which is a true Android phone?

2009-08-14 Thread Anton Pirker

Hi!

You can buy one of these:

HTC G1
the first one, with keyboard, quite old but good enough to test your 
apps. you can update the android version to the newest one

HTC Magic
http://www.htc.com/de/product/magic/overview.html
successor of G1, only on-screen keyboard. i have that one and i am very 
happy with it.

HTC Hero
http://www.htc.com/de/product/hero/overview.html
The new kid on the blog, very cool Android GUI

Samsung I7500
http://www.engadget.com/2009/04/27/samsung-i7500-oled-handset-powered-by-android-dreams/
The first android hand set from Samsung. Can not say if it is good, 
never have seen it live but it looks promising.


All of the above should be fine. If they have a old version of Android, 
you can update it to the newest versions.

Hope this helps a little

Cheers,
Anton



**
-v- wrote:
 Hi,
 I am planning to a buy an android phone to test my app for ADC II. But
 the ones sold by google is a lil too expensive for me so I am thinking
 of buying one off of Craigslist...but am confused which one to buy...
 some of them say - Non Android OS..what does that mean? Does it mean
 my app may not run on it?
 Also I see there are some HTC G1 for sale..I am presuming that these
 are an year old...can I use them and upgrade them to latest android?
 how is the adroid SDK 1.5 related to the Actual Android OS version?
 Please help.
 Thanks in advance.
 -v-
 
   


-- 
DI(FH) Anton Pirker

---
ignaz software services
burggasse 123/53
a-1070 wien
tel: +43 699 1234 0 456
skype: antonpirker

http://anton-pirker.at
http://shnitzl.org




--~--~-~--~~~---~--~~
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] Set bearing in MapView (rotate MapView)

2009-08-14 Thread Anton Pirker

Hello List!

I am trying to implement a map that rotates with the bearing i get
from the built in compass of the htc magic.
I have searched the web but found no good solution. Some are outdated
(ex override onDraw() in MapView) or just not working for me (because
the zoom controls or marker are also rotated.

What i want to have:

A map that rotates with the user, so if the user looks north, on his
map north is up, if he looks west, on his map west is up.
The zoom Controls should be always on the same spot.
If i point marker images on the map they should there position should
be moved with the rotation but the image it self should not be
rotated.

Is there someone in here who has a point by point explanation, or even
some sample code on how to achieve this?
Or maybe is there a new version of MapView where i just can call a
setBearing() or something? (Because i think a _lot_ of people want to
do exactly this.)

Thanks in advance,
Anton

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---