[android-developers] ExpandableListView help

2010-11-02 Thread titleist
Hello,
I'm trying to create a ExpandableListView in one activity. I've looked
in apis demos, and I've created ExpandableListView. The problem is,
that I need to have this  ExpandableListView in activity that is
already created, and not in a new one. I've used this code:


/*
 * Copyright (C) 2007 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the License);
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an AS IS BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */



/**
 * Demonstrates expandable lists backed by a Simple Map-based adapter
 */
public class ExpandableList3 extends ExpandableListActivity {
private static final String NAME = NAME;
private static final String IS_EVEN = IS_EVEN;

public ExpandableListAdapter mAdapter;

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ListMapString, String groupData = new
ArrayListMapString, String();
ListListMapString, String childData = new
ArrayListListMapString, String();
for (int i = 0; i  20; i++) {
MapString, String curGroupMap = new HashMapString,
String();
groupData.add(curGroupMap);
curGroupMap.put(NAME, Group  + i);
curGroupMap.put(IS_EVEN, (i % 2 == 0) ? This group is
even : This group is odd);

ListMapString, String children = new
ArrayListMapString, String();
for (int j = 0; j  15; j++) {
MapString, String curChildMap = new HashMapString,
String();
children.add(curChildMap);
curChildMap.put(NAME, Child  + j);
curChildMap.put(IS_EVEN, (j % 2 == 0) ? This child is
even : This child is odd);
}
childData.add(children);
}

// Set up our adapter
mAdapter = new SimpleExpandableListAdapter(
this,
groupData,
android.R.layout.simple_expandable_list_item_1,
new String[] { NAME, IS_EVEN },
new int[] { android.R.id.text1, android.R.id.text2 },
childData,
android.R.layout.simple_expandable_list_item_2,
new String[] { NAME, IS_EVEN },
new int[] { android.R.id.text1, android.R.id.text2 }
);
setListAdapter(mAdapter);
}

}




In my current activity I have one spinner(on top) and two buttons(on
bottom). My ExpendableListView would have to be below spinner, but I
don't know how to set up padding for ExpandableListView, or how can i
use this class(ExpandableList3) in my current activity (some other
class). This class(ExpandableList3) only works if i open it as new
activity :/




Regards,
Tadej

-- 
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] Fill GridView with data from array

2010-11-02 Thread titleist
Hello,
I have one question. How can i fill GridView with data from String
array? My code for adapter is :
ArrayAdapterString adapter2 = new ArrayAdapterString(this,
android.R.layout.simple_list_item_1, tmpx);
gridview.setAdapter(adapter2);

where tmpx is array with strings.
But my app crashes, when i want to run activity.

LogCat error log:


11-02 14:14:12.932: DEBUG/dalvikvm(2156): GC_FOR_MALLOC freed 7180
objects / 664840 bytes in 109ms
11-02 14:14:12.952: ERROR/AndroidRuntime(2156): FATAL EXCEPTION: main
11-02 14:14:12.952: ERROR/AndroidRuntime(2156):
java.lang.RuntimeException: Unable to start activity
ComponentInfo{si.trendnet.android.terra/
si.trendnet.android.terra.page1}: java.lang.NullPointerException
11-02 14:14:12.952: ERROR/AndroidRuntime(2156): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
2663)
11-02 14:14:12.952: ERROR/AndroidRuntime(2156): at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:
2679)
11-02 14:14:12.952: ERROR/AndroidRuntime(2156): at
android.app.ActivityThread.access$2300(ActivityThread.java:125)
11-02 14:14:12.952: ERROR/AndroidRuntime(2156): at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
11-02 14:14:12.952: ERROR/AndroidRuntime(2156): at
android.os.Handler.dispatchMessage(Handler.java:99)
11-02 14:14:12.952: ERROR/AndroidRuntime(2156): at
android.os.Looper.loop(Looper.java:123)
11-02 14:14:12.952: ERROR/AndroidRuntime(2156): at
android.app.ActivityThread.main(ActivityThread.java:4627)
11-02 14:14:12.952: ERROR/AndroidRuntime(2156): at
java.lang.reflect.Method.invokeNative(Native Method)
11-02 14:14:12.952: ERROR/AndroidRuntime(2156): at
java.lang.reflect.Method.invoke(Method.java:521)
11-02 14:14:12.952: ERROR/AndroidRuntime(2156): at
com.android.internal.os.ZygoteInit
$MethodAndArgsCaller.run(ZygoteInit.java:868)
11-02 14:14:12.952: ERROR/AndroidRuntime(2156): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
11-02 14:14:12.952: ERROR/AndroidRuntime(2156): at
dalvik.system.NativeStart.main(Native Method)
11-02 14:14:12.952: ERROR/AndroidRuntime(2156): Caused by:
java.lang.NullPointerException
11-02 14:14:12.952: ERROR/AndroidRuntime(2156): at
si.trendnet.android.terra.page1.onCreate(page1.java:252)
11-02 14:14:12.952: ERROR/AndroidRuntime(2156): at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:
1047)
11-02 14:14:12.952: ERROR/AndroidRuntime(2156): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
2627)
11-02 14:14:12.952: ERROR/AndroidRuntime(2156): ... 11 more


I would be very grateful if anyone could help me.

Regards,
Tadej

-- 
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: Passing arguments to JSON c# .net web service

2010-09-29 Thread titleist
The logcat log:




09-29 06:42:03.480: DEBUG/AndroidRuntime(399): 
AndroidRuntime START 
09-29 06:42:03.490: DEBUG/AndroidRuntime(399): CheckJNI is ON
09-29 06:42:03.920: DEBUG/AndroidRuntime(399): --- registering native
functions ---
09-29 06:42:05.740: DEBUG/dalvikvm(190): GC_EXPLICIT freed 130
objects / 6960 bytes in 101ms
09-29 06:42:05.920: DEBUG/PackageParser(60): Scanning package: /data/
app/vmdl59209.tmp
09-29 06:42:06.460: INFO/PackageManager(60): Removing non-system
package:si.trendnet.android.terra
09-29 06:42:06.460: INFO/ActivityManager(60): Force stopping package
si.trendnet.android.terra uid=10032
09-29 06:42:06.540: INFO/Process(60): Sending signal. PID: 388 SIG: 9
09-29 06:42:06.609: INFO/WindowManager(60): WIN DEATH: Window{440035a0
si.trendnet.android.terra/si.trendnet.android.terra.Home paused=false}
09-29 06:42:06.739: INFO/UsageStats(60): Unexpected resume of
com.android.launcher while already resumed in
si.trendnet.android.terra
09-29 06:42:07.010: WARN/InputManagerService(60): Got RemoteException
sending setActive(false) notification to pid 388 uid 10032
09-29 06:42:07.539: DEBUG/PackageManager(60): Scanning package
si.trendnet.android.terra
09-29 06:42:07.549: INFO/PackageManager(60): Package
si.trendnet.android.terra codePath changed from /data/app/
si.trendnet.android.terra-1.apk to /data/app/
si.trendnet.android.terra-2.apk; Retaining data and using new
09-29 06:42:07.559: INFO/PackageManager(60): /data/app/
si.trendnet.android.terra-2.apk changed; unpacking
09-29 06:42:07.599: DEBUG/installd(35): DexInv: --- BEGIN '/data/app/
si.trendnet.android.terra-2.apk' ---
09-29 06:42:08.869: DEBUG/dalvikvm(406): DexOpt: load 119ms, verify
688ms, opt 23ms
09-29 06:42:08.900: DEBUG/installd(35): DexInv: --- END '/data/app/
si.trendnet.android.terra-2.apk' (success) ---
09-29 06:42:08.909: WARN/PackageManager(60): Code path for pkg :
si.trendnet.android.terra changing from /data/app/
si.trendnet.android.terra-1.apk to /data/app/
si.trendnet.android.terra-2.apk
09-29 06:42:08.909: WARN/PackageManager(60): Resource path for pkg :
si.trendnet.android.terra changing from /data/app/
si.trendnet.android.terra-1.apk to /data/app/
si.trendnet.android.terra-2.apk
09-29 06:42:08.909: DEBUG/PackageManager(60):   Activities:
si.trendnet.android.terra.Home si.trendnet.android.terra.page1
si.trendnet.android.terra.main_menu
si.trendnet.android.terra.Mobile_Status_History
si.trendnet.android.terra.Service_Desk
si.trendnet.android.terra.Configuration
si.trendnet.android.terra.Settings_Info
si.trendnet.android.terra.settings_login
si.trendnet.android.terra.settings_url
09-29 06:42:08.919: INFO/ActivityManager(60): Force stopping package
si.trendnet.android.terra uid=10032
09-29 06:42:09.179: INFO/installd(35): move /data/dalvik-cache/
d...@app@si.trendnet.android.terra-2@classes.dex - /data/dalvik-
cache/d...@app@si.trendnet.android.terra-2@classes.dex
09-29 06:42:09.199: DEBUG/PackageManager(60): New package installed
in /data/app/si.trendnet.android.terra-2.apk
09-29 06:42:09.529: DEBUG/dalvikvm(60): GC_FOR_MALLOC freed 10054
objects / 573032 bytes in 177ms
09-29 06:42:09.759: INFO/ActivityManager(60): Force stopping package
si.trendnet.android.terra uid=10032
09-29 06:42:09.899: DEBUG/dalvikvm(134): GC_EXPLICIT freed 68
objects / 2992 bytes in 115ms
09-29 06:42:10.160: DEBUG/dalvikvm(164): GC_EXPLICIT freed 1653
objects / 83952 bytes in 201ms
09-29 06:42:10.579: DEBUG/dalvikvm(60): GC_EXPLICIT freed 5248
objects / 277888 bytes in 219ms
09-29 06:42:10.579: INFO/installd(35): unlink /data/dalvik-cache/
d...@app@si.trendnet.android.terra-1@classes.dex
09-29 06:42:10.629: WARN/RecognitionManagerService(60): no available
voice recognition services found
09-29 06:42:10.649: DEBUG/AndroidRuntime(399): Shutting down VM
09-29 06:42:10.659: DEBUG/dalvikvm(399): Debugger has detached; object
registry had 1 entries
09-29 06:42:10.759: INFO/AndroidRuntime(399): NOTE: attach of thread
'Binder Thread #3' failed
09-29 06:42:12.039: DEBUG/AndroidRuntime(412): 
AndroidRuntime START 
09-29 06:42:12.039: DEBUG/AndroidRuntime(412): CheckJNI is ON
09-29 06:42:12.459: DEBUG/AndroidRuntime(412): --- registering native
functions ---
09-29 06:42:13.809: INFO/ActivityManager(60): Starting activity:
Intent { act=android.intent.action.MAIN
cat=[android.intent.category.LAUNCHER] flg=0x1000
cmp=si.trendnet.android.terra/.Home }
09-29 06:42:13.909: DEBUG/AndroidRuntime(412): Shutting down VM
09-29 06:42:13.929: DEBUG/dalvikvm(412): Debugger has detached; object
registry had 1 entries
09-29 06:42:14.059: INFO/AndroidRuntime(412): NOTE: attach of thread
'Binder Thread #3' failed
09-29 06:42:14.319: INFO/ActivityManager(60): Start proc
si.trendnet.android.terra for activity
si.trendnet.android.terra/.Home: pid=419 uid=10032 gids={3003}
09-29 06:42:15.680: ERROR/WebGetURL:(419): 172.17.1.62/JSON.asmx/Hello?
password=1234username=tadej
09-29 06:42:15.750: ERROR/Groshie:(419): Target host must not be null,
or set in 

[android-developers] Re: Passing arguments to JSON c# .net web service

2010-09-29 Thread titleist
Now when i start my application i get som result from webservice but
not the one i hoped. It seems that i can't configure port like:
http://172.17.1.62:58207/JSON.asmx. If I enter only my ip address in
emulator i get the default page of IIS, but if I enter ip:port/method
it doesn't work. I assume that port have to be set up in a different
way? Do you have any ideas maybe how to set up port?



Regards,
Tadej

-- 
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: Passing arguments to JSON c# .net web service

2010-09-29 Thread titleist
 Now I figured that all parameters in url are ok, because when i
debuged my application, i hovered mouse over the  response =
httpClient.execute(httpGet); I saw that (on httpGet) path, port.. are
all in right place and i get exception: connection time out


logcat log is:


09-29 09:49:44.109: DEBUG/AndroidRuntime(1306): 
AndroidRuntime START 
09-29 09:49:44.119: DEBUG/AndroidRuntime(1306): CheckJNI is ON
09-29 09:49:44.479: DEBUG/AndroidRuntime(1306): --- registering native
functions ---
09-29 09:49:45.479: DEBUG/dalvikvm(1298): Debugger has detached;
object registry had 432 entries
09-29 09:49:45.479: INFO/dalvikvm(1298): ignoring registerObject
request in thread=1
09-29 09:49:45.479: INFO/dalvikvm(1298): ignoring registerObject
request in thread=1
09-29 09:49:45.479: ERROR/Groshie:(1298): Connect to /
172.17.1.62:5 timed out
09-29 09:49:45.869: DEBUG/Error:(1298): Failed parsing JSON source:
java.io.stringrea...@43e72600 to Json
09-29 09:49:47.039: INFO/ActivityManager(60): Displayed activity
si.trendnet.android.terra/.Home: 373022 ms (total 753357 ms)
09-29 09:49:47.889: DEBUG/dalvikvm(190): GC_EXPLICIT freed 111
objects / 6072 bytes in 886ms
09-29 09:49:48.039: DEBUG/PackageParser(60): Scanning package: /data/
app/vmdl59235.tmp
09-29 09:49:48.580: INFO/PackageManager(60): Removing non-system
package:si.trendnet.android.terra
09-29 09:49:48.580: INFO/ActivityManager(60): Force stopping package
si.trendnet.android.terra uid=10032
09-29 09:49:48.689: INFO/Process(60): Sending signal. PID: 1298 SIG: 9
09-29 09:49:48.749: INFO/UsageStats(60): Unexpected resume of
com.android.launcher while already resumed in
si.trendnet.android.terra
09-29 09:49:48.830: INFO/WindowManager(60): WIN DEATH: Window{43fe8fc0
si.trendnet.android.terra/si.trendnet.android.terra.Home paused=false}
09-29 09:49:49.149: WARN/InputManagerService(60): Got RemoteException
sending setActive(false) notification to pid 1298 uid 10032
09-29 09:49:49.909: DEBUG/PackageManager(60): Scanning package
si.trendnet.android.terra
09-29 09:49:49.909: INFO/PackageManager(60): Package
si.trendnet.android.terra codePath changed from /data/app/
si.trendnet.android.terra-1.apk to /data/app/
si.trendnet.android.terra-2.apk; Retaining data and using new
09-29 09:49:49.939: INFO/PackageManager(60): /data/app/
si.trendnet.android.terra-2.apk changed; unpacking
09-29 09:49:49.980: DEBUG/installd(35): DexInv: --- BEGIN '/data/app/
si.trendnet.android.terra-2.apk' ---
09-29 09:49:51.230: DEBUG/dalvikvm(1313): DexOpt: load 127ms, verify
714ms, opt 25ms
09-29 09:49:51.270: DEBUG/installd(35): DexInv: --- END '/data/app/
si.trendnet.android.terra-2.apk' (success) ---
09-29 09:49:51.280: WARN/PackageManager(60): Code path for pkg :
si.trendnet.android.terra changing from /data/app/
si.trendnet.android.terra-1.apk to /data/app/
si.trendnet.android.terra-2.apk
09-29 09:49:51.280: WARN/PackageManager(60): Resource path for pkg :
si.trendnet.android.terra changing from /data/app/
si.trendnet.android.terra-1.apk to /data/app/
si.trendnet.android.terra-2.apk
09-29 09:49:51.280: DEBUG/PackageManager(60):   Activities:
si.trendnet.android.terra.Home si.trendnet.android.terra.page1
si.trendnet.android.terra.main_menu
si.trendnet.android.terra.Mobile_Status_History
si.trendnet.android.terra.Service_Desk
si.trendnet.android.terra.Configuration
si.trendnet.android.terra.Settings_Info
si.trendnet.android.terra.settings_login
si.trendnet.android.terra.settings_url
09-29 09:49:51.300: INFO/ActivityManager(60): Force stopping package
si.trendnet.android.terra uid=10032
09-29 09:49:51.560: INFO/installd(35): move /data/dalvik-cache/
d...@app@si.trendnet.android.terra-2@classes.dex - /data/dalvik-
cache/d...@app@si.trendnet.android.terra-2@classes.dex
09-29 09:49:51.560: DEBUG/PackageManager(60): New package installed
in /data/app/si.trendnet.android.terra-2.apk
09-29 09:49:51.769: DEBUG/dalvikvm(60): GC_FOR_MALLOC freed 8598
objects / 524136 bytes in 184ms
09-29 09:49:52.240: INFO/ActivityManager(60): Force stopping package
si.trendnet.android.terra uid=10032
09-29 09:49:52.390: DEBUG/dalvikvm(134): GC_EXPLICIT freed 153
objects / 6960 bytes in 120ms
09-29 09:49:52.800: WARN/RecognitionManagerService(60): no available
voice recognition services found
09-29 09:49:53.310: DEBUG/dalvikvm(60): GC_EXPLICIT freed 5153
objects / 278536 bytes in 469ms
09-29 09:49:53.680: INFO/installd(35): unlink /data/dalvik-cache/
d...@app@si.trendnet.android.terra-1@classes.dex
09-29 09:49:53.710: DEBUG/AndroidRuntime(1306): Shutting down VM
09-29 09:49:53.740: DEBUG/dalvikvm(1306): Debugger has detached;
object registry had 1 entries
09-29 09:49:53.780: INFO/AndroidRuntime(1306): NOTE: attach of thread
'Binder Thread #3' failed
09-29 09:49:54.890: DEBUG/AndroidRuntime(1319): 
AndroidRuntime START 
09-29 09:49:54.890: DEBUG/AndroidRuntime(1319): CheckJNI is ON
09-29 09:49:55.410: DEBUG/AndroidRuntime(1319): --- registering native
functions ---
09-29 09:49:57.040: 

[android-developers] Re: Passing arguments to JSON c# .net web service

2010-09-29 Thread titleist
172.17.1.62 is my local ip address, port 5 is the port of asp.net
development server on my computer, and is 100% correct. I checked it
few times and there is no mistake with ip or port in android
application.

On 29 sep., 12:12, Kostya Vasilyev kmans...@gmail.com wrote:
   29.09.2010 13:53, titleist пишет:

  09-29 09:50:09.370: ERROR/Groshie:(1327): Connect to /
  172.17.1.62:5 timed out

 Your connection is timing out, not connecting. Check the IP and port.

  09-29 09:50:09.540: DEBUG/Error:(1327): Failed parsing JSON source:
  java.io.stringrea...@43e71b80 to Json

 You are not correctly passing data to JSON library code.

 Google for Failed parsing JSON source.

 --
 Kostya Vasilyev -- WiFi Manager + pretty widget 
 --http://kmansoft.wordpress.com

-- 
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: Passing arguments to JSON c# .net web service

2010-09-29 Thread titleist
I selected properties of my web service and i selected web tab, than
server and i selected specific port and i entered it(5). On the
bottom right side (where the clock is by default in windows) when i
expand, i see that development server is running on port 5. If I
enter only IP address in the emulators browser it returns me the
default page of IIS. And if I enter the address in my computer browser
it works. example: 
http://localhost:5/JSON.asmx/LogInUser?password=1234username=tadej
(I get both, the username and password back from web service, like i
should).



Regards,
Tadej


On 29 sep., 12:54, Kostya Vasilyev kmans...@gmail.com wrote:
   Ok, that's good.

 How are you making sure this IP address is reachable from the phone?

 And how are you opening the port on the development computer?

 -- Kostya

 29.09.2010 14:24, titleist пишет:





  172.17.1.62 is my local ip address, port 5 is the port of asp.net
  development server on my computer, and is 100% correct. I checked it
  few times and there is no mistake with ip or port in android
  application.

  On 29 sep., 12:12, Kostya Vasilyevkmans...@gmail.com  wrote:
     29.09.2010 13:53, titleist пишет:

  09-29 09:50:09.370: ERROR/Groshie:(1327): Connect to /
  172.17.1.62:5 timed out
  Your connection is timing out, not connecting. Check the IP and port.

  09-29 09:50:09.540: DEBUG/Error:(1327): Failed parsing JSON source:
  java.io.stringrea...@43e71b80 to Json
  You are not correctly passing data to JSON library code.

  Google for Failed parsing JSON source.

  --
  Kostya Vasilyev -- WiFi Manager + pretty widget 
  --http://kmansoft.wordpress.com

 --
 Kostya Vasilyev -- WiFi Manager + pretty widget 
 --http://kmansoft.wordpress.com

-- 
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: Passing arguments to JSON c# .net web service

2010-09-29 Thread titleist
I think that this problem appears because input is not in appropriate
format. If I comment these lines for parsing I still get error for
connection.. And in logcat it's now the only error still left. Once
again logcat:



09-29 12:30:54.389: DEBUG/dalvikvm(190): GC_EXPLICIT freed 226
objects / 15152 bytes in 111ms
09-29 12:30:54.569: DEBUG/PackageParser(60): Scanning package: /data/
app/vmdl59240.tmp
09-29 12:30:55.189: INFO/PackageManager(60): Removing non-system
package:si.trendnet.android.terra
09-29 12:30:55.189: INFO/ActivityManager(60): Force stopping package
si.trendnet.android.terra uid=10032
09-29 12:30:55.289: INFO/Process(60): Sending signal. PID: 1511 SIG: 9
09-29 12:30:55.349: INFO/WindowManager(60): WIN DEATH: Window{44043510
si.trendnet.android.terra/si.trendnet.android.terra.Home paused=false}
09-29 12:30:55.399: INFO/UsageStats(60): Unexpected resume of
com.android.launcher while already resumed in
si.trendnet.android.terra
09-29 12:30:55.759: DEBUG/dalvikvm(60): GC_FOR_MALLOC freed 13092
objects / 688072 bytes in 288ms
09-29 12:30:55.949: WARN/InputManagerService(60): Got RemoteException
sending setActive(false) notification to pid 1511 uid 10032
09-29 12:30:56.799: DEBUG/PackageManager(60): Scanning package
si.trendnet.android.terra
09-29 12:30:56.820: INFO/PackageManager(60): Package
si.trendnet.android.terra codePath changed from /data/app/
si.trendnet.android.terra-2.apk to /data/app/
si.trendnet.android.terra-1.apk; Retaining data and using new
09-29 12:30:56.829: INFO/PackageManager(60): /data/app/
si.trendnet.android.terra-1.apk changed; unpacking
09-29 12:30:56.879: DEBUG/installd(35): DexInv: --- BEGIN '/data/app/
si.trendnet.android.terra-1.apk' ---
09-29 12:30:58.379: DEBUG/dalvikvm(1526): DexOpt: load 130ms, verify
840ms, opt 28ms
09-29 12:30:58.479: DEBUG/installd(35): DexInv: --- END '/data/app/
si.trendnet.android.terra-1.apk' (success) ---
09-29 12:30:58.490: WARN/PackageManager(60): Code path for pkg :
si.trendnet.android.terra changing from /data/app/
si.trendnet.android.terra-2.apk to /data/app/
si.trendnet.android.terra-1.apk
09-29 12:30:58.490: WARN/PackageManager(60): Resource path for pkg :
si.trendnet.android.terra changing from /data/app/
si.trendnet.android.terra-2.apk to /data/app/
si.trendnet.android.terra-1.apk
09-29 12:30:58.490: DEBUG/PackageManager(60):   Activities:
si.trendnet.android.terra.Home si.trendnet.android.terra.page1
si.trendnet.android.terra.main_menu
si.trendnet.android.terra.Mobile_Status_History
si.trendnet.android.terra.Service_Desk
si.trendnet.android.terra.Configuration
si.trendnet.android.terra.Settings_Info
si.trendnet.android.terra.settings_login
si.trendnet.android.terra.settings_url
09-29 12:30:58.509: INFO/ActivityManager(60): Force stopping package
si.trendnet.android.terra uid=10032
09-29 12:30:58.919: INFO/installd(35): move /data/dalvik-cache/
d...@app@si.trendnet.android.terra-1@classes.dex - /data/dalvik-
cache/d...@app@si.trendnet.android.terra-1@classes.dex
09-29 12:30:58.929: DEBUG/PackageManager(60): New package installed
in /data/app/si.trendnet.android.terra-1.apk
09-29 12:30:59.279: INFO/ActivityManager(60): Force stopping package
si.trendnet.android.terra uid=10032
09-29 12:30:59.449: DEBUG/dalvikvm(134): GC_EXPLICIT freed 322
objects / 16400 bytes in 138ms
09-29 12:30:59.739: DEBUG/dalvikvm(1421): GC_EXPLICIT freed 1549
objects / 78272 bytes in 242ms
09-29 12:31:00.180: WARN/RecognitionManagerService(60): no available
voice recognition services found
09-29 12:31:00.639: DEBUG/dalvikvm(60): GC_EXPLICIT freed 7592
objects / 477664 bytes in 210ms
09-29 12:31:01.020: INFO/installd(35): unlink /data/dalvik-cache/
d...@app@si.trendnet.android.terra-2@classes.dex
09-29 12:31:01.250: DEBUG/AndroidRuntime(1519): Shutting down VM
09-29 12:31:01.270: DEBUG/dalvikvm(1519): Debugger has detached;
object registry had 1 entries
09-29 12:31:02.580: DEBUG/AndroidRuntime(1532): 
AndroidRuntime START 
09-29 12:31:02.580: DEBUG/AndroidRuntime(1532): CheckJNI is ON
09-29 12:31:03.010: DEBUG/AndroidRuntime(1532): --- registering native
functions ---
09-29 12:31:04.750: INFO/ActivityManager(60): Starting activity:
Intent { act=android.intent.action.MAIN
cat=[android.intent.category.LAUNCHER] flg=0x1000
cmp=si.trendnet.android.terra/.Home }
09-29 12:31:04.900: DEBUG/AndroidRuntime(1532): Shutting down VM
09-29 12:31:04.920: DEBUG/dalvikvm(1532): Debugger has detached;
object registry had 1 entries
09-29 12:31:05.010: INFO/AndroidRuntime(1532): NOTE: attach of thread
'Binder Thread #3' failed
09-29 12:31:05.060: INFO/ActivityManager(60): Start proc
si.trendnet.android.terra for activity
si.trendnet.android.terra/.Home: pid=1539 uid=10032 gids={3003}
09-29 12:31:06.590: ERROR/WebGetURL:(1539):
http://172.17.1.62:5/JSON.asmx/LogInUser?password=1234username=tadej
09-29 12:31:14.851: WARN/ActivityManager(60): Launch timeout has
expired, giving up wake lock!
09-29 12:31:15.785: WARN/ActivityManager(60): Activity idle timeout

[android-developers] Re: Passing arguments to JSON c# .net web service

2010-09-29 Thread titleist
Now it works! Why 10.0.2.2? Now i have to work on parsing error.. I've
uncommented those two lines for parsing and the error is still there.
But still, this is a big break :)  Thank you! I appreciate it.



Regards,
Tadej

On 29 sep., 14:58, Kostya Vasilyev kmans...@gmail.com wrote:
   What happens if you change the address in your Android code to
 10.0.2.2? Keep the port number, just change the address.

 -- Kostya

 29.09.2010 16:35, titleist пишет:





  I think that this problem appears because input is not in appropriate
  format. If I comment these lines for parsing I still get error for
  connection.. And in logcat it's now the only error still left. Once
  again logcat:

  09-29 12:30:54.389: DEBUG/dalvikvm(190): GC_EXPLICIT freed 226
  objects / 15152 bytes in 111ms
  09-29 12:30:54.569: DEBUG/PackageParser(60): Scanning package: /data/
  app/vmdl59240.tmp
  09-29 12:30:55.189: INFO/PackageManager(60): Removing non-system
  package:si.trendnet.android.terra
  09-29 12:30:55.189: INFO/ActivityManager(60): Force stopping package
  si.trendnet.android.terra uid=10032
  09-29 12:30:55.289: INFO/Process(60): Sending signal. PID: 1511 SIG: 9
  09-29 12:30:55.349: INFO/WindowManager(60): WIN DEATH: Window{44043510
  si.trendnet.android.terra/si.trendnet.android.terra.Home paused=false}
  09-29 12:30:55.399: INFO/UsageStats(60): Unexpected resume of
  com.android.launcher while already resumed in
  si.trendnet.android.terra
  09-29 12:30:55.759: DEBUG/dalvikvm(60): GC_FOR_MALLOC freed 13092
  objects / 688072 bytes in 288ms
  09-29 12:30:55.949: WARN/InputManagerService(60): Got RemoteException
  sending setActive(false) notification to pid 1511 uid 10032
  09-29 12:30:56.799: DEBUG/PackageManager(60): Scanning package
  si.trendnet.android.terra
  09-29 12:30:56.820: INFO/PackageManager(60): Package
  si.trendnet.android.terra codePath changed from /data/app/
  si.trendnet.android.terra-2.apk to /data/app/
  si.trendnet.android.terra-1.apk; Retaining data and using new
  09-29 12:30:56.829: INFO/PackageManager(60): /data/app/
  si.trendnet.android.terra-1.apk changed; unpacking
  09-29 12:30:56.879: DEBUG/installd(35): DexInv: --- BEGIN '/data/app/
  si.trendnet.android.terra-1.apk' ---
  09-29 12:30:58.379: DEBUG/dalvikvm(1526): DexOpt: load 130ms, verify
  840ms, opt 28ms
  09-29 12:30:58.479: DEBUG/installd(35): DexInv: --- END '/data/app/
  si.trendnet.android.terra-1.apk' (success) ---
  09-29 12:30:58.490: WARN/PackageManager(60): Code path for pkg :
  si.trendnet.android.terra changing from /data/app/
  si.trendnet.android.terra-2.apk to /data/app/
  si.trendnet.android.terra-1.apk
  09-29 12:30:58.490: WARN/PackageManager(60): Resource path for pkg :
  si.trendnet.android.terra changing from /data/app/
  si.trendnet.android.terra-2.apk to /data/app/
  si.trendnet.android.terra-1.apk
  09-29 12:30:58.490: DEBUG/PackageManager(60):   Activities:
  si.trendnet.android.terra.Home si.trendnet.android.terra.page1
  si.trendnet.android.terra.main_menu
  si.trendnet.android.terra.Mobile_Status_History
  si.trendnet.android.terra.Service_Desk
  si.trendnet.android.terra.Configuration
  si.trendnet.android.terra.Settings_Info
  si.trendnet.android.terra.settings_login
  si.trendnet.android.terra.settings_url
  09-29 12:30:58.509: INFO/ActivityManager(60): Force stopping package
  si.trendnet.android.terra uid=10032
  09-29 12:30:58.919: INFO/installd(35): move /data/dalvik-cache/
  d...@a...@si.trendnet.android.terra-1@classes.dex -  /data/dalvik-
  cache/d...@a...@si.trendnet.android.terra-1@classes.dex
  09-29 12:30:58.929: DEBUG/PackageManager(60): New package installed
  in /data/app/si.trendnet.android.terra-1.apk
  09-29 12:30:59.279: INFO/ActivityManager(60): Force stopping package
  si.trendnet.android.terra uid=10032
  09-29 12:30:59.449: DEBUG/dalvikvm(134): GC_EXPLICIT freed 322
  objects / 16400 bytes in 138ms
  09-29 12:30:59.739: DEBUG/dalvikvm(1421): GC_EXPLICIT freed 1549
  objects / 78272 bytes in 242ms
  09-29 12:31:00.180: WARN/RecognitionManagerService(60): no available
  voice recognition services found
  09-29 12:31:00.639: DEBUG/dalvikvm(60): GC_EXPLICIT freed 7592
  objects / 477664 bytes in 210ms
  09-29 12:31:01.020: INFO/installd(35): unlink /data/dalvik-cache/
  d...@a...@si.trendnet.android.terra-2@classes.dex
  09-29 12:31:01.250: DEBUG/AndroidRuntime(1519): Shutting down VM
  09-29 12:31:01.270: DEBUG/dalvikvm(1519): Debugger has detached;
  object registry had 1 entries
  09-29 12:31:02.580: DEBUG/AndroidRuntime(1532):
  AndroidRuntime START
  09-29 12:31:02.580: DEBUG/AndroidRuntime(1532): CheckJNI is ON
  09-29 12:31:03.010: DEBUG/AndroidRuntime(1532): --- registering native
  functions ---
  09-29 12:31:04.750: INFO/ActivityManager(60): Starting activity:
  Intent { act=android.intent.action.MAIN
  cat=[android.intent.category.LAUNCHER] flg=0x1000
  cmp=si.trendnet.android.terra/.Home }
  09-29 12:31:04.900: DEBUG/AndroidRuntime(1532): Shutting down VM

[android-developers] Re: Passing arguments to JSON c# .net web service

2010-09-28 Thread titleist
I have function in c# like: LogInUser(string username, string
password). Now i would have to pass those two arguments from android
JSON web service to server (JSON c# web service.)

-- 
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: Passing arguments to JSON c# .net web service

2010-09-28 Thread titleist
When i debug my application when the  httpGet = new HttpGet(getUrl);
is executed nothing happens :/

My WebGet function looks like:


  public String webGet(String methodName, MapString, String params)
{
String getUrl = webServiceUrl + methodName;

int i = 0;
for (Map.EntryString, String param : params.entrySet())
{
if(i == 0){
getUrl += ?;
}
else{
getUrl += ;
}

try {
getUrl += param.getKey() + = +
URLEncoder.encode(param.getValue(),UTF-8);
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

i++;
}

httpGet = new HttpGet(getUrl);
- when this
executes nothing else is executed, like i would exit function...

Log.e(WebGetURL: ,getUrl);

try {
response = httpClient.execute(httpGet);
} catch (Exception e) {
Log.e(Groshie:, e.getMessage());
}

// we assume that the response body contains the error message
try {
if(response != null)
ret = EntityUtils.toString(response.getEntity());
else
ret = error;
} catch (IOException e) {
Log.e(Groshie:, e.getMessage());
}

return ret;
}



I call webservice function like:


 WebService logInService = new WebService(172.17.1.62:58207/
JSON.asmx);


MapString, String params = new HashMapString, String();
params.put(username, USERNAME);
params.put(password, 1234);
logInService.webGet(LogInUser, params);
LogInUser is function in
c# .net web service
String response1 = logInService.webGet(LogInUser, params);


and my c# login function looks like:


  public void LogInUser() {
string username = Context.Request.Params[username];
string password = Context.Request.Params[password];

if (username != null  password != null) {
 .
 .
 .
 .
 .

 }

}

-- 
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: Passing arguments to JSON c# .net web service

2010-09-28 Thread titleist
I noticed that whenever httpPost is called, the exception is thrown:



// Compiled from DexFile.java (version 1.5 : 49.0, super bit)
public final class dalvik.system.DexFile {

  // Method descriptor #8 (Ljava/io/File;)V
  // Stack: 3, Locals: 2
  public DexFile(java.io.File file) throws java.io.IOException;
 0  aload_0 [this]
 1  invokespecial java.lang.Object() [1]
 4  new java.lang.RuntimeException [2]
 7  dup
 8  ldc String Stub! [3]
10  invokespecial java.lang.RuntimeException(java.lang.String) [4]
13  athrow
  Line numbers:
[pc: 0, line: 4]
  Local variable table:
[pc: 0, pc: 14] local: this index: 0 type:
dalvik.system.DexFile
[pc: 0, pc: 14] local: file index: 1 type: java.io.File

  // Method descriptor #18 (Ljava/lang/String;)V
  // Stack: 3, Locals: 2
  public DexFile(java.lang.String fileName) throws
java.io.IOException;
 0  aload_0 [this]
 1  invokespecial java.lang.Object() [1]
 4  new java.lang.RuntimeException [2]
 7  dup
 8  ldc String Stub! [3]
10  invokespecial java.lang.RuntimeException(java.lang.String) [4]
13  athrow
  Line numbers:
[pc: 0, line: 5]
  Local variable table:
[pc: 0, pc: 14] local: this index: 0 type:
dalvik.system.DexFile
[pc: 0, pc: 14] local: fileName index: 1 type:
java.lang.String

  // Method descriptor #22 (Ljava/lang/String;Ljava/lang/
String;I)Ldalvik/system/DexFile;
  // Stack: 3, Locals: 3
  public static dalvik.system.DexFile loadDex(java.lang.String
sourcePathName, java.lang.String outputPathName, int flags) throws
java.io.IOException;
 0  new java.lang.RuntimeException [2]
 3  dup
 4  ldc String Stub! [3]
 6  invokespecial java.lang.RuntimeException(java.lang.String) [4]
 9  athrow
  Line numbers:
[pc: 0, line: 6]
  Local variable table:
[pc: 0, pc: 10] local: sourcePathName index: 0 type:
java.lang.String
[pc: 0, pc: 10] local: outputPathName index: 1 type:
java.lang.String
[pc: 0, pc: 10] local: flags index: 2 type: int

  // Method descriptor #28 ()Ljava/lang/String;
  // Stack: 3, Locals: 1
  public java.lang.String getName();
 0  new java.lang.RuntimeException [2]
 3  dup
 4  ldc String Stub! [3]
 6  invokespecial java.lang.RuntimeException(java.lang.String) [4]
 9  athrow
  Line numbers:
[pc: 0, line: 7]
  Local variable table:
[pc: 0, pc: 10] local: this index: 0 type:
dalvik.system.DexFile

  // Method descriptor #30 ()V
  // Stack: 3, Locals: 1
  public void close() throws java.io.IOException;
 0  new java.lang.RuntimeException [2]
 3  dup
 4  ldc String Stub! [3]
 6  invokespecial java.lang.RuntimeException(java.lang.String) [4]
 9  athrow
  Line numbers:
[pc: 0, line: 8]
  Local variable table:
[pc: 0, pc: 10] local: this index: 0 type:
dalvik.system.DexFile

  // Method descriptor #32 (Ljava/lang/String;Ljava/lang/
ClassLoader;)Ljava/lang/Class;
  // Stack: 3, Locals: 3
  public java.lang.Class loadClass(java.lang.String name,
java.lang.ClassLoader loader);
 0  new java.lang.RuntimeException [2]
 3  dup
 4  ldc String Stub! [3]
 6  invokespecial java.lang.RuntimeException(java.lang.String) [4]
 9  athrow
  Line numbers:
[pc: 0, line: 9]
  Local variable table:
[pc: 0, pc: 10] local: this index: 0 type:
dalvik.system.DexFile
[pc: 0, pc: 10] local: name index: 1 type: java.lang.String
[pc: 0, pc: 10] local: loader index: 2 type:
java.lang.ClassLoader

  // Method descriptor #37 ()Ljava/util/Enumeration;
  // Signature: ()Ljava/util/EnumerationLjava/lang/String;;
  // Stack: 3, Locals: 1
  public java.util.Enumeration entries();
 0  new java.lang.RuntimeException [2]
 3  dup
 4  ldc String Stub! [3]
 6  invokespecial java.lang.RuntimeException(java.lang.String) [4]
 9  athrow
  Line numbers:
[pc: 0, line: 10]
  Local variable table:
[pc: 0, pc: 10] local: this index: 0 type:
dalvik.system.DexFile

  // Method descriptor #30 ()V
  // Stack: 3, Locals: 1
  protected void finalize() throws java.io.IOException;
 0  new java.lang.RuntimeException [2]
 3  dup
 4  ldc String Stub! [3]
 6  invokespecial java.lang.RuntimeException(java.lang.String) [4]
 9  athrow
  Line numbers:
[pc: 0, line: 11]
  Local variable table:
[pc: 0, pc: 10] local: this index: 0 type:
dalvik.system.DexFile

  // Method descriptor #42 (Ljava/lang/String;)Z
  public static native boolean isDexOptNeeded(java.lang.String arg0)
throws java.io.FileNotFoundException, java.io.IOException;
}




Does anyone have any ideas what could cause that?  I'm really stuck..
Do i have to include some external jars or libraries?





Regards

-- 
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] Passing arguments to JSON c# .net web service

2010-09-27 Thread titleist
Hello,
i searched the net to find something about how to pass arguments to
JSON c# .net web service, but i didn't find anything useful for me. I
have to pass arguments like GUID or at least Username and Password.
Is
params.put(var, ); the right thing? How do i pass multiple
parameters like this, let's say username and password?




Regards,
Tadej

-- 
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] Autocomplete with suggestions in Custom Dialog

2010-08-11 Thread titleist
Hi,
I'm having problem with creating AutocompleteTextView in custom
dialog. In every example i saw, the autocomplete feature is only in
the classes that extends activity. I need to have autocomplete in
custom dialog that I created. The problem is that this:


 AutoCompleteTextView textView = (AutoCompleteTextView)
findViewById(R.id.autocomplete_country);
ArrayAdapterString adapter = new 
ArrayAdapterString(this,
R.layout.list_item, COUNTRIES);
textView.setAdapter(adapter);

should be in onCreate method that I don't have.
The errors are:

Multiple markers at this line
- COUNTRIES cannot be resolved to a variable
- The constructor ArrayAdapterString(quickfind, int, String[]) is
 undefined


My entire code for quickfind.java:

import android.R.string;
import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.view.View.OnClickListener;
import android.widget.ArrayAdapter;

/** Class Must extends with Dialog */
/** Implement onClickListener to dismiss dialog when OK Button is
pressed */
public class quickfind extends Dialog implements OnClickListener {
Button okButton;

public quickfind(Context context) {
super(context);
/** 'Window.FEATURE_NO_TITLE' - Used to hide the title */
requestWindowFeature(Window.FEATURE_NO_TITLE);
/** Design the dialog in main.xml file */
setContentView(R.layout.quickfind);
okButton = (Button) findViewById(R.id.close);
okButton.setOnClickListener(this);


 AutoCompleteTextView textView = (AutoCompleteTextView)
findViewById(R.id.autocomplete_country);
ArrayAdapterString adapter = new 
ArrayAdapterString(this,
R.layout.list_item, COUNTRIES);
textView.setAdapter(adapter);

}

static final String[] COUNTRIES = new String[] {
  Afghanistan, Albania, Algeria, American Samoa, 
Andorra,
  Angola, Anguilla, Antarctica, Antigua and Barbuda,
Argentina,
  Armenia, Aruba, Australia, Austria, Azerbaijan,
  Bahrain, Bangladesh, Barbados, Belarus, Belgium
};


@Override
public void onClick(View v) {
/** When OK Button is clicked, dismiss the dialog */
if (v == okButton)
dismiss();
}

}



quickfind.xml:

?xml version=1.0 encoding=utf-8?
LinearLayout xmlns:android=http://schemas.android.com/apk/res/
android
android:orientation=vertical
android:layout_width=fill_parent
android:layout_height=fill_parent



TextView
android:layout_width=wrap_content
android:layout_height=wrap_content
android:text=Vpišite iskani niz: /
AutoCompleteTextView android:id=@+id/autocomplete_country
android:layout_width=fill_parent
android:layout_height=wrap_content
android:layout_marginLeft=5dp/


 Button android:id=@+id/close
android:layout_width=150px
android:layout_height=wrap_content
android:layout_alignParentBottom=true
android:text=@string/title_close
android:layout_marginTop = 50px
android:layout_gravity =center
/
   /LinearLayout


and list_item.xml:

?xml version=1.0 encoding=utf-8?
TextView xmlns:android=http://schemas.android.com/apk/res/android;
android:layout_width=fill_parent
android:layout_height=fill_parent
android:padding=10dp
android:textSize=16sp
android:textColor=#000
/TextView



Later, when the errors are gone, the countries list will be replaced
with data  from json webservice. I'm a beginner in java..


P.S.
Sorry for mistakes in my English



Regards,
Tadej




-- 
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: Autocomplete with suggestions in Custom Dialog

2010-08-11 Thread titleist
Thanks, my quickfind now works. I will correct names in my
appplication, it will even look better :)


Regards,
Tadej

On 11 avg., 19:27, viktor victor.scherb...@gmail.com wrote:
 This code: ArrayAdapterString adapter = new
 ArrayAdapterString(this, R.layout.list_item, COUNTRIES);

 Be carefully, if you use autocomplete in Dialog, you should passing
 Context as 1st arg of constructor, ArrayAdapterT(Context,
 R.layout.list_item, COUNTRIES)()

 Please read Java Code Style, How did you compile your code, your class
 name is wrong (quickfind -- Quickfind).

 On 11 Сер, 14:58, titleist tadej.ore...@gmail.com wrote:



  Hi,
  I'm having problem with creating AutocompleteTextView in custom
  dialog. In every example i saw, the autocomplete feature is only in
  the classes that extends activity. I need to have autocomplete in
  custom dialog that I created. The problem is that this:

   AutoCompleteTextView textView = (AutoCompleteTextView)
  findViewById(R.id.autocomplete_country);
                      ArrayAdapterString adapter = new 
  ArrayAdapterString(this,
  R.layout.list_item, COUNTRIES);
                      textView.setAdapter(adapter);

  should be in onCreate method that I don't have.
  The errors are:

  Multiple markers at this line
          - COUNTRIES cannot be resolved to a variable
          - The constructor ArrayAdapterString(quickfind, int, String[]) is
           undefined

  My entire code for quickfind.java:

  import android.R.string;
  import android.app.Dialog;
  import android.content.Context;
  import android.os.Bundle;
  import android.view.View;
  import android.view.Window;
  import android.view.View.OnClickListener;
  import android.widget.ArrayAdapter;

  /** Class Must extends with Dialog */
  /** Implement onClickListener to dismiss dialog when OK Button is
  pressed */
  public class quickfind extends Dialog implements OnClickListener {
          Button okButton;

                              public quickfind(Context context) {
                  super(context);
                  /** 'Window.FEATURE_NO_TITLE' - Used to hide the title */
                  requestWindowFeature(Window.FEATURE_NO_TITLE);
                  /** Design the dialog in main.xml file */
                  setContentView(R.layout.quickfind);
                  okButton = (Button) findViewById(R.id.close);
                  okButton.setOnClickListener(this);

                   AutoCompleteTextView textView = (AutoCompleteTextView)
  findViewById(R.id.autocomplete_country);
                      ArrayAdapterString adapter = new 
  ArrayAdapterString(this,
  R.layout.list_item, COUNTRIES);
                      textView.setAdapter(adapter);

          }

          static final String[] COUNTRIES = new String[] {
                    Afghanistan, Albania, Algeria, American Samoa, 
  Andorra,
                    Angola, Anguilla, Antarctica, Antigua and Barbuda,
  Argentina,
                    Armenia, Aruba, Australia, Austria, Azerbaijan,
                    Bahrain, Bangladesh, Barbados, Belarus, Belgium
                  };

          @Override
          public void onClick(View v) {
                  /** When OK Button is clicked, dismiss the dialog */
                  if (v == okButton)
                          dismiss();
          }

  }

  quickfind.xml:

  ?xml version=1.0 encoding=utf-8?
  LinearLayout xmlns:android=http://schemas.android.com/apk/res/
  android
      android:orientation=vertical
      android:layout_width=fill_parent
      android:layout_height=fill_parent

      

      TextView
          android:layout_width=wrap_content
          android:layout_height=wrap_content
          android:text=Vpišite iskani niz: /
      AutoCompleteTextView android:id=@+id/autocomplete_country
          android:layout_width=fill_parent
          android:layout_height=wrap_content
          android:layout_marginLeft=5dp/

   Button android:id=@+id/close
      android:layout_width=150px
      android:layout_height=wrap_content
      android:layout_alignParentBottom=true
      android:text=@string/title_close
      android:layout_marginTop = 50px
      android:layout_gravity =center
      /
     /LinearLayout

  and list_item.xml:

  ?xml version=1.0 encoding=utf-8?
  TextView xmlns:android=http://schemas.android.com/apk/res/android;
      android:layout_width=fill_parent
      android:layout_height=fill_parent
      android:padding=10dp
      android:textSize=16sp
      android:textColor=#000
  /TextView

  Later, when the errors are gone, the countries list will be replaced
  with data  from json webservice. I'm a beginner in java..

  P.S.
  Sorry for mistakes in my English

  Regards,
  Tadej- Skrij navedeno besedilo -

 - Prikaži citirano besedilo -

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

[android-developers] Re: How to create new page / form

2010-08-03 Thread titleist
The default page and the first page is screen I see (main.xml).  When
I replaced the getApplicationContext(); with this, it started
working.
Thanks again for your help.



Regards,
Tadej
On 3 avg., 07:53, titleist tadej.ore...@gmail.com wrote:
 Thank you for your help,

 Regards

 On 3 avg., 05:21, Ed edscha...@gmail.com wrote:



  I think we're possibly overlooking the simplicity of the question (I
  may be wrong).

  My assumption is that the page you are referring to is the first
  screen you see (main.xml).

  In your code at the moment you have a Class that extends Activity. In
  this class you will have a method called onCreate that is calling
  something like: setContentView(R.layout.main);

  If you want another screen:
  1.createanewlayout in /res/layout  (e.g. myLayout.xml)
  2.createanewclass that extends Activity (e.g. MyActivity)
  3. in the onCreate of MyActivity add
  setContentView(R.layout.myLayout);
  4. in AndroidManifest.xml inside the application node add activity
  android:name=.MyActivity/activity   (NB: there is a full-stop
  before the class name)
  5. in the onClick of your button in your original activity (the one
  that calls setContentView(R.layout.main); and has the button)  call
  startActivity(newIntent(this, MyActivity.class));
  6. run it and hopefully it will work.

  Cheers,

  Ed

  On Aug 3, 5:47 am, Bob Kerns r...@acm.org wrote:

   Also -- have you tried using the debugger to debug your problem?

   It doesn't sound like it. Had you done this basic step, I think:

   1) You might have found the solution to your problem yourself
   2) If not, you would be able to ask a much more specific question.

   On Aug 2, 11:50 am, TreKing treking...@gmail.com wrote:

On Mon, Aug 2, 2010 at 6:56 AM, titleist tadej.ore...@gmail.com wrote:
 I want to open /createnewpage (just like first page / default page but
 with other functionalities) on button click.

What is a newpage, first page, and default page?

 I've tried tocreatecustom dialog like on this page:
http://developer.android.com/guide/topics/ui/dialogs.html#AlertDialog
 but when i clicked the button my application always crashed.

What is the stack trace for the crash? How are we supposed to help 
without
that key information?

Although I can probably guess since you're using 
getApplicationContext() ...
don't use that function. Use this.

  Is Custom dialog solution to my problem or should Icreatenewlayout?

Depends on what your problem is, which I don't really understand. You 
should
clarify what you're trying to do.

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

-- 
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: How to create new page / form

2010-08-03 Thread titleist
The first page and the default page is the page I see (main.xml). When
I replaced getApplicationContext(); with this, the application
started to work.
Thank you all for your help.

Regards,
Tadej

On 2 avg., 20:50, TreKing treking...@gmail.com wrote:
 On Mon, Aug 2, 2010 at 6:56 AM, titleist tadej.ore...@gmail.com wrote:
  I want to open / create new page (just like first page / default page but
  with other functionalities) on button click.

 What is a new page, first page, and default page?

  I've tried to create custom dialog like on this page:
 http://developer.android.com/guide/topics/ui/dialogs.html#AlertDialog
  but when i clicked the button my application always crashed.

 What is the stack trace for the crash? How are we supposed to help without
 that key information?

 Although I can probably guess since you're using getApplicationContext() ...
 don't use that function. Use this.

   Is Custom dialog solution to my problem or should I create new layout?

 Depends on what your problem is, which I don't really understand. You should
 clarify what you're trying to do.

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

-- 
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 create new page / form

2010-08-02 Thread titleist
Hello,
I'm working on some application for android and I can't find anything
useful for my problem. I want to open / create new page (just like
first page / default page but with other functionalities) on button
click. I've tried to create custom dialog like on this page:
http://developer.android.com/guide/topics/ui/dialogs.html#AlertDialog
but when i clicked the button my application always crashed.



My code for custom dialog:

 protected Dialog onCreateDialog(int id) {
Dialog dialog=null;
switch(id) {
case DIALOG_PAGE2_ID:
// do the work to define the PAGE2
break;
case DIALOG_PAGE_DEFAULT_ID:
// do the work to define the PAGE DEFAULT
Context mContext = getApplicationContext();
dialog = new Dialog(mContext);

dialog.setContentView(R.layout.page1);
dialog.setTitle(Custom Dialog);
TextView text = (TextView) dialog.findViewById(R.id.text);
text.setText(Default page);

break;
default:
dialog = null;
}
 return dialog;
}




Here i want to open / call it:

this.LogIN = (Button)this.findViewById(R.id.LogIN);
this.LogIN.setOnClickListener(new OnClickListener1() {
public void onClick(View v) {
 showDialog(DIALOG_PAGE_DEFAULT_ID);
   }

});


Is Custom dialog solution to my problem or should I create new
layout?

P.S.
Sorry for mistakes in my English


Regards,
Tadej

-- 
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: How to create new page / form

2010-08-02 Thread titleist
Thank you for your help,


Regards

On 3 avg., 05:21, Ed edscha...@gmail.com wrote:
 I think we're possibly overlooking the simplicity of the question (I
 may be wrong).

 My assumption is that the page you are referring to is the first
 screen you see (main.xml).

 In your code at the moment you have a Class that extends Activity. In
 this class you will have a method called onCreate that is calling
 something like: setContentView(R.layout.main);

 If you want another screen:
 1.createanewlayout in /res/layout  (e.g. myLayout.xml)
 2.createanewclass that extends Activity (e.g. MyActivity)
 3. in the onCreate of MyActivity add
 setContentView(R.layout.myLayout);
 4. in AndroidManifest.xml inside the application node add activity
 android:name=.MyActivity/activity   (NB: there is a full-stop
 before the class name)
 5. in the onClick of your button in your original activity (the one
 that calls setContentView(R.layout.main); and has the button)  call
 startActivity(newIntent(this, MyActivity.class));
 6. run it and hopefully it will work.

 Cheers,

 Ed

 On Aug 3, 5:47 am, Bob Kerns r...@acm.org wrote:



  Also -- have you tried using the debugger to debug your problem?

  It doesn't sound like it. Had you done this basic step, I think:

  1) You might have found the solution to your problem yourself
  2) If not, you would be able to ask a much more specific question.

  On Aug 2, 11:50 am, TreKing treking...@gmail.com wrote:

   On Mon, Aug 2, 2010 at 6:56 AM, titleist tadej.ore...@gmail.com wrote:
I want to open /createnewpage (just like first page / default page but
with other functionalities) on button click.

   What is a newpage, first page, and default page?

I've tried tocreatecustom dialog like on this page:
   http://developer.android.com/guide/topics/ui/dialogs.html#AlertDialog
but when i clicked the button my application always crashed.

   What is the stack trace for the crash? How are we supposed to help without
   that key information?

   Although I can probably guess since you're using getApplicationContext() 
   ...
   don't use that function. Use this.

 Is Custom dialog solution to my problem or should Icreatenewlayout?

   Depends on what your problem is, which I don't really understand. You 
   should
   clarify what you're trying to do.

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

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