well not to sound like a smartass, but your code is not so good for
copying arrays. use System.arrayCopy() or clone() instead.

String[] vector= new String[4];
System.arrayCopy(list,0, vector, 0, blah.vector);

or

String[] vector = (String[]) list.clone();

also, using names "list" or "vector" is not appropriate for array variables.


On Wed, Oct 8, 2008 at 1:40 PM, Stefano <[EMAIL PROTECTED]> wrote:
>
> 1)  Sorry, I closed my post involuntarily.
>
>    Keeping at point 1),   here is the server-side code:
>
>    import java.util.Vector;
>    import com.google.gwt.user.server.rpc.RemoteServiceServlet;
>
>    public class ListServiceImpl extends RemoteServiceServlet
> implements ListService {
>
>        private String[] list = {"thank","you","for","help"};
>
>        public String[] listService() {
>                String[] vector = {"","","",""};
>                for (int i=0; i < list.length; i++){
>                        vector[i] = list[i];
>                }
>                return vector;
>        }
>    }
>
>
>    Obviously you have to define also a ListService and a
> ListServiceAsync interface on client-side:
>
>    import com.google.gwt.core.client.GWT;
>    import com.google.gwt.user.client.rpc.RemoteService;
>    import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
>    import com.google.gwt.user.client.rpc.ServiceDefTarget;
>
>   @RemoteServiceRelativePath("ListService")
>   public interface ListService extends RemoteService {
>        public String[] listService();
>                public static class Util {
>                public static ListServiceAsync getInstance() {
>                        return GWT.create(ListService.class);
>                }
>        }
>   }
>
>
>
>   import com.google.gwt.user.client.rpc.AsyncCallback;
>   public interface ListServiceAsync {
>        public void listService(AsyncCallback<String[]> callback);
>   }
>
>
>
>   I can say that differently from version alpha of Android (and from
> many browsers I used), the beta version of Android has an exception on
> the abovementioned code:
>   [WARN] StandardContext[]Exception while dispatching incoming RPC
> call
>   java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
>
>   I don't understand why
>
>
>
> 2)  I often neither can click on simple list-boxes with 'static'
> content (invoking no services no server-side). See for reference the
> following GWT code:
>     here I have programmed a very simple and ugly UI. I cannot either
> click (on Android version beta)  on the listbox which is on the top of
> the UI.
>     I remove the problem if only I remove the invocation
> mainPanel.setBorderWidth(1): WHY???
>
>     import com.google.gwt.core.client.EntryPoint;
>     import com.google.gwt.core.client.GWT;
>     import com.google.gwt.user.client.rpc.AsyncCallback;
>     import com.google.gwt.user.client.rpc.ServiceDefTarget;
>     import com.google.gwt.user.client.ui.Button;
>     import com.google.gwt.user.client.ui.Image;
>     import com.google.gwt.user.client.ui.ListBox;
>     import com.google.gwt.user.client.ui.RootPanel;
>     import com.google.gwt.user.client.ui.TextArea;
>     import com.google.gwt.user.client.ui.VerticalPanel;
>
>
>    public class NewAndroid implements EntryPoint {
>
>                public VerticalPanel backPanel = new VerticalPanel();
>                public VerticalPanel mainPanel = new VerticalPanel();
>                public ListBox actList = new ListBox();
>                public TextArea textSendBox = new TextArea();
>                public TextArea textReceiveBox = new TextArea();
>                public Button button = new Button ("Send");
>                public Image img = new Image("");
>
>
>                public void onModuleLoad(){
>                            RootPanel.get().add(mainPanel);
>                    mainPanel.setBorderWidth(1);
>                    
> mainPanel.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER);
>
> mainPanel.setVerticalAlignment(VerticalPanel.ALIGN_MIDDLE);
>
>                            mainPanel.setSpacing(15);
>                            actList.setWidth("100%");
>                            mainPanel.add(img);
>
>                            mainPanel.add(actList);
>                            textReceiveBox.setReadOnly(true);
>                            textReceiveBox.setVisibleLines(5);
>                            textReceiveBox.setWidth("100%");
>                            mainPanel.add(textReceiveBox);
>                            textSendBox.setVisibleLines(2);
>                            textSendBox.setWidth("100%");
>                            mainPanel.add(textSendBox);
>                            mainPanel.add(button);
>        }
>
> Thank you in advance,
> Stefano
>
> On 8 Ott, 19:01, Stefano <[EMAIL PROTECTED]> wrote:
>> I have worked all this afternoon on test applications, trying to
>> understand my problem.
>> I would like to explain my results, hoping to receive your help and
>> also to be useful to somebody.
>> So, usingGWT1.5.1 and anAndroid(beta version) emulator, I have
>> noticed that
>>
>> 1) I have problems transferring listboxes with dynamic content toAndroid
>>     For instance, in case I fill my listbox by invoking a remote-
>> procedure-call (RPC) to a service,
>>     I cannot open the listbox properly. Here is the client-side code
>>
>> import com.google.gwt.core.client.EntryPoint;
>> import com.google.gwt.core.client.GWT;
>> import com.google.gwt.user.client.rpc.AsyncCallback;
>> import com.google.gwt.user.client.rpc.ServiceDefTarget;
>> import com.google.gwt.user.client.ui.Button;
>> import com.google.gwt.user.client.ui.Image;
>> import com.google.gwt.user.client.ui.ListBox;
>> import com.google.gwt.user.client.ui.RootPanel;
>> import com.google.gwt.user.client.ui.TextArea;
>> import com.google.gwt.user.client.ui.VerticalPanel;
>>
>> public class NewAndroid implements EntryPoint {
>>
>>         public VerticalPanel backPanel = new VerticalPanel();
>>         public VerticalPanel mainPanel = new VerticalPanel();
>>         public ListBox actList = new ListBox();
>>         public TextArea textSendBox = new TextArea();
>>         public TextArea textReceiveBox = new TextArea();
>>         public Button button = new Button ("Send");
>>         public Image img = new Image("");
>>
>>         public void onModuleLoad(){
>>
>>         RootPanel.get().add(mainPanel);
>>
>>         mainPanel.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER);
>>         mainPanel.setVerticalAlignment(VerticalPanel.ALIGN_MIDDLE);
>>
>>         mainPanel.setSpacing(15);
>>         actList.setWidth("100%");
>>         mainPanel.add(img);
>>
>>         listService();
>>
>>         mainPanel.add(actList);
>>         textReceiveBox.setVisibleLines(5);
>>         textReceiveBox.setWidth("100%");
>>         mainPanel.add(textReceiveBox);
>>         textSendBox.setVisibleLines(2);
>>         textSendBox.setWidth("100%");
>>         mainPanel.add(textSendBox);
>>         mainPanel.add(button);
>>         }
>>
>>         public void listService (){
>>            ListServiceAsync service = 
>> (ListServiceAsync)GWT.create(ListService.class);
>>            service.listService(new ListCallback());
>>         }
>>
>>         public class ListCallback implements AsyncCallback {
>>         public void onFailure(Throwable caught) {
>>                                GWT.log("Error ", caught);
>>                                 caught.printStackTrace();
>>                                 System.out.println("Unsuccessfull service");
>>                         }
>>                         public void onSuccess(Object result) {
>>                                 System.out.println("Successfull service");
>>                                 String[] list = (String[]) result;
>>                                 for (int i = 0; i < list.length; i++) {
>>                                         actList.addItem(list[i]);
>>                                 }
>>                         }
>>                 }
>>
>> }
>>
>> On 8 Ott, 00:17, Mark Murphy <[EMAIL PROTECTED]> wrote:
>>
>>
>>
>> > Stefano Cannata wrote:
>> > > Actually I haven't published yet my webapp on a url,
>>
>> > Hopefully, somebody on this list both has your version ofGWTinstalled
>> > and the time to build a test app.
>>
>> > --
>> > Mark Murphy (a Commons Guy)http://commonsware.com
>>
>> > AndroidTraining on the Ranch! -- Mar 16-20, 
>> > 2009http://www.bignerdranch.com/schedule.shtml- Nascondi testo citato
>>
>> - Mostra testo citato -
> >
>

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

Reply via email to