[android-developers] Re: Help needed -- There is no linked app associated with this client ID.

2014-02-15 Thread Robert Auger
I have the same problem. I don't understand how to register 2 client ID 
(one for debug and one for production) in the Games services console.
If the answer is known, please let me know.

Le dimanche 27 octobre 2013 10:50:48 UTC+1, FReDD a écrit :

 Hi all,

 I'm becoming crazy with this one. I just published a game on Google Play 
 and the game uses the Google Play Games services.

 Sign-in and leaderboards / achievements worked fined with the application 
 signed with the debug key, but since I built and
 published my app using my release key, Google+ sign-on is impossible. I 
 always get the infamous error 
 *E/SignInIntentService(25004): There is no linked app associated with 
 this client ID.*

 I double- and triple-checked everything : my app is published, the package 
 name and SHA1 fingerprint are correct and match
 what I extracted from the release APK, I unlinked and relinked the app in 
 the Google Play Console multiple times, but nothing
 works.

 Ideas, anyone ?

 Thanks


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


[android-developers] Re: help needed.......

2013-08-03 Thread Lew
ramesh babu wrote:

 suggest me a project in android [sic] which is not application 
 oriented??and it may be a ieee [sic] journal paper of 2013


- What possibly could you mean by not application oriented? Isn't 
anything you do on a computer an 
  application by definition?

- Shouldn't a journal paper be based on active research in which you are 
already engaged, 
  and represent a contribution to the state of the art?

- What is in it for the person making the suggestion?

- How much do you already know about Android programming? (It must be a lot 
if you are 
  contemplating submitting a paper to the IEEE.) This will help us target 
any suggestions we 
  might make.

- Please respect the spelling at least for proper nouns and trademarks.

- What is the context for your request?

-- 
Lew

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




[android-developers] Re: help needed for raw developer like me

2013-04-24 Thread Piren


 . Is there any book or web site of collections of all classes and methods 
 well explained,


really??
http://developer.android.com/develop/index.html 

On Thursday, April 18, 2013 6:51:11 AM UTC+3, Arun Karkare wrote:

 Hello dear expert programmers!
 I am extremely new and very raw to Android development, but keen to learn 
 Android Applications development.I have so far understood the anatomy of 
 Android application and now know  basics of eclipse IDE and what is src, 
 package, manifest, res, gen, etc folders. I can understand very basic 
 program like Hello world. But I am unable 
 to understand more complecated programs like app-widget-provider, intents 
 etc, I wonder how expert programmer know all the Android classes and 
 methods included there in.How the programmer chooses what class to use 
 where. Is there any book or web site of collections of all classes and 
 methods well explained, so that I can select and use an appropriate class, 
 method for my application whenever I will write one? I tried to find on 
 google search, also tried to understand' developer.android'  site but could 
 find what I really need.Please help.Arun Karkare

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




[android-developers] Re: help needed

2013-03-16 Thread Jason
You need a google maps key because access to the google maps API is rate 
limited.

On Friday, March 15, 2013 10:41:25 PM UTC-7, ramesh babu wrote:

 for developing google map application why do we required sha1 key??... 


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




[android-developers] Re: help needed

2013-03-16 Thread Tamilarasi Sivaraj
you need  *MD5 Finger Print key* for developing Google map application..

Regards
Android developer
Trinay Technology Solutions
www.trinaytech.com
5705750475

On Saturday, March 16, 2013 11:11:25 AM UTC+5:30, ramesh babu wrote:

 for developing google map application why do we required sha1 key??... 


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




Re: [android-developers] Re: help needed

2013-03-16 Thread ramesh babu
thank u jasontamilarasi sivaraj,and here is another problem while
developing apps,that is i can't import  the packages in the program

import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.MapFragment;

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




Re: [android-developers] Re: help needed

2013-03-16 Thread Tamilarasi Sivaraj

have you put this *uses-library android:required=true 
android:name=com.google.android.maps /* line into your manifest file.

Regards
Android developer
Trinay Technology Solutions
www.trinaytech.com
5705750475

On Saturday, March 16, 2013 3:20:30 PM UTC+5:30, ramesh babu wrote:

 thank u jasontamilarasi sivaraj,and here is another problem while 
 developing apps,that is i can't import  the packages in the program 

 import com.google.android.gms.maps.GoogleMap; 
 import com.google.android.gms.maps.MapFragment; 


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




Re: [android-developers] Re: help needed

2013-03-16 Thread ramesh babu
yes,i have those lines in manifest file,but i can't import those files
in my application and the coding are


Manifest file:-
?xml version=1.0 encoding=utf-8?
manifest xmlns:android=http://schemas.android.com/apk/res/android;
package=com.ramesh.map
android:versionCode=1
android:versionName=1.0 

uses-sdk
android:minSdkVersion=9
android:targetSdkVersion=17 /
   uses-feature
android:glEsVersion=0x0002
android:required=true /

uses-permission android:name=android.permission.INTERNET /
uses-permission android:name=android.permission.ACCESS_NETWORK_STATE /
uses-permission android:name=android.permission.WRITE_EXTERNAL_STORAGE /
uses-permission
android:name=com.google.android.providers.gsf.permission.READ_GSERVICES
/
!--
 The following two permissions are not required to use
 Google Maps Android API v2, but are recommended.
--
uses-permission android:name=android.permission.ACCESS_COARSE_LOCATION /
uses-permission android:name=android.permission.ACCESS_FINE_LOCATION /

permission
android:name=com.ram.googlemapsv2.permission.MAPS_RECEIVE
android:protectionLevel=signature /

uses-permission android:name=com.ramesh.map.permission.MAPS_RECEIVE /

application
android:allowBackup=true
android:icon=@drawable/ic_launcher
android:label=@string/app_name
android:theme=@style/AppTheme 
uses-library android:required=true
  android:name=com.google.android.maps /
activity
android:name=com.ramesh.map.Map
android:label=@string/app_name 
intent-filter
action android:name=android.intent.action.MAIN /

category android:name=android.intent.category.LAUNCHER /
/intent-filter
/activity
 meta-data
android:name=com.google.android.maps.v2.API_KEY

android:value=67:18:01:96:8C:3C:A3:F9:3B:E9:14:96:10:DC:BB:D5:CF:E9:3C:21
/

/application

/manifest

and src is:-

package com.ramesh.map;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.os.Bundle;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.MapFragment;
public class Map extends Activity {

 GoogleMap map;
 @SuppressLint(NewApi)
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_map);


map = ((MapFragment) 
getFragmentManager().findFragmentById(R.id.map))
.getMap();
  // map.setMapType(GoogleMap.MAP_TYPE_HYBRID);
  // map.setMapType(GoogleMap.MAP_TYPE_NONE);
  map.setMapType(GoogleMap.MAP_TYPE_NORMAL);
  // 
map.setMapType(GoogleMap.MAP_TYPE_SATELLITE);
  // map.setMapType(GoogleMap.MAP_TYPE_TERRAIN);
 }
}

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




Re: [android-developers] Re: help needed

2013-03-16 Thread Tamilarasi Sivaraj
have you install the Google play service from the sdk?

On Saturday, March 16, 2013 4:10:28 PM UTC+5:30, ramesh babu wrote:

 yes,i have those lines in manifest file,but i can't import those files 
 in my application and the coding are 


 Manifest file:- 
 ?xml version=1.0 encoding=utf-8? 
 manifest xmlns:android=http://schemas.android.com/apk/res/android; 
 package=com.ramesh.map 
 android:versionCode=1 
 android:versionName=1.0  

 uses-sdk 
 android:minSdkVersion=9 
 android:targetSdkVersion=17 / 
uses-feature 
 android:glEsVersion=0x0002 
 android:required=true / 

 uses-permission android:name=android.permission.INTERNET / 
 uses-permission 
 android:name=android.permission.ACCESS_NETWORK_STATE / 
 uses-permission 
 android:name=android.permission.WRITE_EXTERNAL_STORAGE / 
 uses-permission 
 android:name=com.google.android.providers.gsf.permission.READ_GSERVICES 
 / 
 !-- 
  The following two permissions are not required to use 
  Google Maps Android API v2, but are recommended. 
 -- 
 uses-permission 
 android:name=android.permission.ACCESS_COARSE_LOCATION / 
 uses-permission 
 android:name=android.permission.ACCESS_FINE_LOCATION / 

 permission 
 android:name=com.ram.googlemapsv2.permission.MAPS_RECEIVE 
 android:protectionLevel=signature / 

 uses-permission android:name=com.ramesh.map.permission.MAPS_RECEIVE 
 / 

 application 
 android:allowBackup=true 
 android:icon=@drawable/ic_launcher 
 android:label=@string/app_name 
 android:theme=@style/AppTheme  
 uses-library android:required=true 
   android:name=com.google.android.maps / 
 activity 
 android:name=com.ramesh.map.Map 
 android:label=@string/app_name  
 intent-filter 
 action android:name=android.intent.action.MAIN / 

 category android:name=android.intent.category.LAUNCHER 
 / 
 /intent-filter 
 /activity 
  meta-data 
 android:name=com.google.android.maps.v2.API_KEY 
 
 android:value=67:18:01:96:8C:3C:A3:F9:3B:E9:14:96:10:DC:BB:D5:CF:E9:3C:21 
 / 

 /application 

 /manifest 

 and src is:- 

 package com.ramesh.map; 

 import android.annotation.SuppressLint; 
 import android.app.Activity; 
 import android.os.Bundle; 
 import com.google.android.gms.maps.GoogleMap; 
 import com.google.android.gms.maps.MapFragment; 
 public class Map extends Activity { 

  GoogleMap map; 
  @SuppressLint(NewApi) 
 protected void onCreate(Bundle savedInstanceState) { 
 super.onCreate(savedInstanceState); 
 setContentView(R.layout.activity_map); 
  
  
 map = ((MapFragment) 
 getFragmentManager().findFragmentById(R.id.map)) 
 .getMap(); 
   // 
 map.setMapType(GoogleMap.MAP_TYPE_HYBRID); 
   // 
 map.setMapType(GoogleMap.MAP_TYPE_NONE); 
  
  map.setMapType(GoogleMap.MAP_TYPE_NORMAL); 
   // 
 map.setMapType(GoogleMap.MAP_TYPE_SATELLITE); 
   // 
 map.setMapType(GoogleMap.MAP_TYPE_TERRAIN); 
  } 
 } 


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




Re: [android-developers] Re: help needed

2013-03-16 Thread ramesh babu
s i have installed it

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




Re: [android-developers] Re: help needed

2013-03-10 Thread ramesh babu
thank u bob.

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




[android-developers] Re: help needed

2013-03-08 Thread bob
Here is an example of how to use the TimePickerDialog:

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
* TimePickerDialog dialog = new TimePickerDialog(this, null, 0, 0, false);*
* dialog.show();*
}

Thanks.





On Friday, March 8, 2013 12:12:17 AM UTC-6, ramesh babu wrote:

 hi.., 

 in TimepickerDialog 

 display.setText()  function is not working in my android app.is 
 there any other procedure to execute it... 


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




[android-developers] Re: Help needed

2013-03-05 Thread Gabriel Augusto
Check strings.xml in 'values' folder

Em terça-feira, 5 de março de 2013 07h40min20s UTC-3, ramesh babu escreveu:

 hi frnds, 
i am just start learning about android,while i am 
 developing a simple app i got stuck with these error: Error: No 
 resource found that matches the given name (at 'title' with value 
 '@string/action_settings'). 


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




Re: [android-developers] Re: Help needed

2013-03-05 Thread naresh pedagani
Hi,
remove the code like android:text='@string/action_settings in xml file and
clean the project.then add the code android:text='@string/action_settings,
then it will work.it happens some time if R.java file is not updated.
ThanksRegards,
Naresh


On Tue, Mar 5, 2013 at 5:15 PM, Gabriel Augusto
gabrielaugust...@gmail.comwrote:

 Check strings.xml in 'values' folder

 Em terça-feira, 5 de março de 2013 07h40min20s UTC-3, ramesh babu escreveu:

 hi frnds,
i am just start learning about android,while i am
 developing a simple app i got stuck with these error: Error: No
 resource found that matches the given name (at 'title' with value
 '@string/action_settings').

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




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




Re: [android-developers] Re: Help needed

2013-03-05 Thread ramesh babu
thanks bro's problem has been recovered

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




Re: [android-developers] Re: Help needed

2013-03-05 Thread ramesh babu
for what purpose findViewById is used

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




Re: [android-developers] Re: Help needed

2013-03-05 Thread naresh pedagani
Hi ,
   findViewById() method is used to get the object of the view.
*example*:
*main.xml* contain one button i want to provide the action for this button,
so we need to create the object in the java file by passing id.
Button
android:id=@+id/btn_New
android:layout_width=wrap_content
android:layout_height=wrap_content
   android:text=new
   /

*MainActivity .java*
public class MainActivity extends Activity {

   protected void onCreate(Bundle icicle) {
   super.onCreate(icicle);
//creation of button object
*Button buttonclickme=(Button)findViewById(r.id.btn_New);*


once we crate the object of the button we can provide action

buttonclickme.setOnClickListener(new View.OnClickListener()
{

 public void onClick(View v)
 {

//here we have to write the code to execute when button clicked.

}}


RegardsRegards,
Naresh.


On Tue, Mar 5, 2013 at 6:06 PM, ramesh babu rameshbabu...@gmail.com wrote:

 for what purpose findViewById is used

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




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




Re: [android-developers] Re: Help needed

2013-03-05 Thread ramesh babu
thanks naresh bro

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




[android-developers] Re: Help Needed: Cannot Setup Android Source

2012-05-15 Thread bsquared
Thank you.  I appreciate the clarification.

Regards,
Brian

On May 15, 10:39 am, Justin Anderson magouyaw...@gmail.com wrote:
 This forum is for questions about developing android apps with the SDK
 Your question should be asked elsewhere, like one of the groups on this
 page:http://source.android.com/community/index.html

 Thanks,
 Justin Anderson
 MagouyaWare Developerhttp://sites.google.com/site/magouyaware







 On Tue, May 15, 2012 at 10:35 AM, bsquared bwcod...@gmail.com wrote:
  Just setting up environment and I get this error.

  $ repo init -uhttps://android.googlesource.com/platform/manifest
   File /home/android-dev/bin/repo, line 184
     except OSError, e:
                   ^
  I looked at repo script and found that the error occurs here:
   if not os.path.isdir(repodir):
     try:
       os.mkdir(repodir)
     except OSError, e:
       print sys.stderr, \
             'fatal: cannot make %s directory: %s' % (
             repodir, e.strerror)
       # Don't faise CloneFailure; that would delete the
       # name. Instead exit immediately.
       #
       sys.exit(1)

  However, the message does not print.

  My system:
  $ uname -a
  Linux bw-desktop 3.0.29-1-lts #1 SMP PREEMPT Mon Apr 23 10:02:22 UTC
  2012 i686 Intel(R) Pentium(R) 4 CPU 3.00GHz GenuineIntel GNU/Linux

  $ git --version
  git version 1.7.10.1

  I added a new user: android-dev
  and 'su android-dev'

  Then I followed the directions on source.android.com/source/
  downloading.html

  Thank you.

  Regards,
  Brian

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

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


[android-developers] Re: Help needed with GPS/TTS app

2011-12-08 Thread gjs
Hi,

You will probably want to use a Service ( with a PARTIAL WAKE LOCK )
rather than an Activity assuming you are not already.

GPS will keep going ok, not sure about TTS in a Service.

Regards

On Dec 8, 8:41 am, gotok ken0g...@gmail.com wrote:
 First of all, I am very much a beginner working on my first app, and I
 am stuck on  a problem. My app uses GPS and TTS and is intended for
 use when I am skiing. It has a single screen which displays speed,
 odometer, altitude, and GPS coordinates. It also uses TTS to speak
 speed, odometer, altitude, and time at user selected intervals. I have
 it typically set to speak speed at 5mph intervals. So whenever the
 speed crosses 5mph, 10,mph, 15mph, etc either on the way up or down,
 the speed is spoken. Similarly, odomenter is spoken every mile,
 altitude every 1000ft, and time every quarter hour. It is implemented
 as a single activity and built for API level 8. The target device is a
 Samsung YP-G70CW MP3 player which runs Froyo 2.2.2. Everything works
 as intended when the screen is on. However, the behavior is not
 consistent with the screen off (the primary use mode), either by
 timeout or directly with the power button. Sometimes the TTS reporting
 continues to work fine just as with the screen on. More likely, it
 runs at a reduced rate where the odometer and time reports occur on
 time, but the speed reports are much less frequent than normal and are
 delayed. When the screen goes off, it will get into one of these two
 modes and then stay that way. When in the slow mode, if I turn the
 screen back on, it speeds up to normal. I have diagnostic TTS reports,
 pausing in the onPause override, and resuming in the onResume
 override, so I can hear that it pauses when the screen goes off. Now
 my many questions:
 1. My app is paused, but it continues to run, either at full or
 partial speed. So what does it mean for an app to be paused? Is it
 reasonable to implement this kind of app as an activity, or is a
 service required?
 2. What all happens when the screen goes off? The Android
 documentation notes that one function, Proximity alerts, are slowed
 down when the screen is off. Are other GPS functions slowed down also?
 3. I have tried a PARTIAL_WAKE_LOCK acquired in the onCreate override,
 and released at the onDestroy override, but it seems to have no
 affect. I also added diagnostic TTS such that when I report time I
 also check whether the wake lock is held or not. Sometimes it is not
 held, so who could be releasing the wake lock?
 I would really appreciate any comments/advice to help me solve this
 problem.
 thanks...

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


[android-developers] Re: Help needed to troubleshoot code

2011-10-26 Thread naman
Can someone help me out please ...

I have tried everything but am unable to run the thread in the code posted
at this question...

Thanks

On Mon, Oct 24, 2011 at 1:48 AM, naman namankoh...@gmail.com wrote:

 Hello all,

 I am trying to build an app for android and am having issues with HTTP
 authentication I have asked the same question at stackoverflow but
 unfortunately have not recieved any responses to it...

 The question is here stackoverflow queshttp://stackoverflow.com/q/7860268
 .

 Can someone help me with this regard... Please note that I have checked the
 basic errors that could be there by setting the permissions in the manifest
 file etc but I have observed that neither the thread nor the code for
 sending the data runs.

 Thanks
 --
 Naman




-- 
Naman

-- 
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: Help needed to troubleshoot code

2011-10-26 Thread Studio LFP
Couple of things here...

1. You are calling run() on the thread, not the one you have defined in 
your activity.
2. You don't want to call run() on the thread, you want to call start().
3. You either need to create a Runnable to post to the thread or you need 
to extend Thread and insert your own code.

Try this:

private void doLogin()
{
LoginThread ltNew = new LoginThread();
ltNew.start();
}

private class LoginThread extends Thread
{
@Override
public void run()
{
// Your login code here
}
}

That is one option. Give it a try and see if it does what you need it to.

Steven
Studio LFP
http://www.studio-lfp.com


On Wednesday, October 26, 2011 11:07:46 AM UTC-5, nk wrote:

 Can someone help me out please ...

 I have tried everything but am unable to run the thread in the code posted 
 at this question...

 Thanks 

 On Mon, Oct 24, 2011 at 1:48 AM, naman naman...@gmail.com wrote:

 Hello all,

 I am trying to build an app for android and am having issues with HTTP 
 authentication I have asked the same question at stackoverflow but 
 unfortunately have not recieved any responses to it...

 The question is here stackoverflow queshttp://stackoverflow.com/q/7860268
 .

 Can someone help me with this regard... Please note that I have checked 
 the basic errors that could be there by setting the permissions in the 
 manifest file etc but I have observed that neither the thread nor the code 
 for sending the data runs.

 Thanks
 -- 
 Naman
  



 -- 
 Naman
  

-- 
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: Help needed on BUtton CLick

2011-09-06 Thread DangerDaku
Try

android:layout_marginRight=5dp attribute in ur xml file to get
spacing on the right of the button.

So somthing lik

Button android:id=@+id/button1 android:layout_height=wrap_content
android:layout_width=wrap_content android:layout_marginRight=5dp/


On Sep 5, 2:57 am, sam hotdude...@gmail.com wrote:
 I got it fixed Ratheesh , i had a mistake in ma manifest file ..

 Can u please guide me how to set the space between the buttons ???

 Regards,
 Sam

 On Sep 5, 11:53 am, Ratheesh Valamchuzhy android...@gmail.com wrote:







  hi SAM

  public void onClick(View v)
         {
                 switch(v.getId())
                 {
                 case R.id.button1:

                         startActivity(new Intent(Screen1.this,Screen2.
  class));
                          break;

                 case R.id.button3:
                           startActivity(new Intent(Screen1.this,Screen3.
  class));
                          break;
                  }
         }

  try this

-- 
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: Help needed on BUtton CLick

2011-09-06 Thread DangerDaku
In your screen1.xml file, add android:layout_marginTop=5dp,
android:layout_marginBottom=5dp .. etc for top, bottom, left and
right spacing. This is added as an attribute to ur Button tag.

so you can have somthing like

Button android:id=@+id/button1 android:layout_width=wrap_content
android:layout_height=wrap_content android:layout_marginTop=5dp
android:text=Buttom 1/

to have 5dp space on top of your button.

Try it =)

On Sep 5, 2:57 am, sam hotdude...@gmail.com wrote:
 I got it fixed Ratheesh , i had a mistake in ma manifest file ..

 Can u please guide me how to set the space between the buttons ???

 Regards,
 Sam

 On Sep 5, 11:53 am, Ratheesh Valamchuzhy android...@gmail.com wrote:







  hi SAM

  public void onClick(View v)
         {
                 switch(v.getId())
                 {
                 case R.id.button1:

                         startActivity(new Intent(Screen1.this,Screen2.
  class));
                          break;

                 case R.id.button3:
                           startActivity(new Intent(Screen1.this,Screen3.
  class));
                          break;
                  }
         }

  try this

-- 
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: Help needed on BUtton CLick

2011-09-05 Thread sam
Hi Michael ,

i was able to create two screen using Intent but i'm having a problem

I have Screen1,Screen2,Screen3

In Screen1 i have two button, were clicking the button1 will take to
the second screen and clicking the button2 will take to the third
screen.

When i click on the first button it takes me to the second screen ,
but when i click on the button2 it force closes..

package com.sai.android;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class Screen1 extends Activity implements OnClickListener{
/** Called when the activity is first created. */

Button b1;
Button b3;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.screen1);

 b1=(Button)findViewById(R.id.button1);
 b3=(Button)findViewById(R.id.button3);
 b1.setOnClickListener(this);
 b3.setOnClickListener(this);

}


@Override
public void onClick(View v) {
// TODO Auto-generated method stub
if(b1==v){
startActivity(new 
Intent(Screen1.this,Screen2.class));
}

else
{
startActivity(new 
Intent(Screen1.this,Screen3.class));


}

}


}

On Sep 4, 12:45 am, Michael Banzon mich...@banzon.dk wrote:
 On Sat, Sep 3, 2011 at 7:46 PM, sam hotdude...@gmail.com wrote:
  How do i call the ImageGallery class after theButtonis clicked.

 Hey,

 You need to start the another Activity using an Intent... if this
 makes no sense try to google it ;o)

 --
 Michael Banzonhttp://michaelbanzon.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


Re: [android-developers] Re: Help needed on BUtton CLick

2011-09-05 Thread Ratheesh Valamchuzhy
hi SAM


public void onClick(View v)
   {
   switch(v.getId())
   {
   case R.id.button1:

   startActivity(new Intent(Screen1.this,Screen2.
class));
break;

   case R.id.button3:
 startActivity(new Intent(Screen1.this,Screen3.
class));
break;
}
   }


try this

-- 
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: Help needed on BUtton CLick

2011-09-05 Thread sam
I got it fixed Ratheesh , i had a mistake in ma manifest file ..

Can u please guide me how to set the space between the buttons ???

Regards,
Sam

On Sep 5, 11:53 am, Ratheesh Valamchuzhy android...@gmail.com wrote:
 hi SAM

 public void onClick(View v)
        {
                switch(v.getId())
                {
                case R.id.button1:

                        startActivity(new Intent(Screen1.this,Screen2.
 class));
                         break;

                case R.id.button3:
                          startActivity(new Intent(Screen1.this,Screen3.
 class));
                         break;
                 }
        }

 try this

-- 
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] Re: Help needed on BUtton CLick

2011-09-05 Thread zheng wu
set the margin property of buttoneg:android:layout_margin=''

2011/9/5 sam hotdude...@gmail.com

 I got it fixed Ratheesh , i had a mistake in ma manifest file ..

 Can u please guide me how to set the space between the buttons ???

 Regards,
 Sam

 On Sep 5, 11:53 am, Ratheesh Valamchuzhy android...@gmail.com wrote:
  hi SAM
 
  public void onClick(View v)
 {
 switch(v.getId())
 {
 case R.id.button1:
 
 startActivity(new Intent(Screen1.this,Screen2.
  class));
  break;
 
 case R.id.button3:
   startActivity(new Intent(Screen1.this,Screen3.
  class));
  break;
  }
 }
 
  try this

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


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

[android-developers] Re: Help needed for dealing with NullPointerException when calling functions on a service just after binding it

2011-07-22 Thread Chris Stratton
On Thursday, July 21, 2011 1:26:54 AM UTC-4, Animesh Sinha wrote:

 The issue is that I need to call the service methods as soon as it is 
 connected. 
 So, Is there any way by which I can execute the functions of service 
 JUST AFTER binding is complete ? 

 It takes around 10-20ms for binding, I tried to make use 
 Thread.sleep(30); but it delayed the service from being connected by 
 the same sleep duration, therefore not solving the problem. 


The problem is that android requires you to write event driven code here.  
It can't deliver a new event until you return from the current event.  If 
you sleep, you just delay the return, and thus the new event delivery which 
can only occur after that.

You are going to have to do a lot of re-thinking of how to architect this 
whole process as a chain of events.  Yes, it's painful, but you'll get 
better at that kind of re-shuffling with time.

 

 On Jul 20, 6:33 pm, Mark Murphy mmu...@commonsware.com wrote: 
  On Tue, Jul 19, 2011 at 12:21 PM, animeshsi anime...@gmail.com wrote: 
   Is there some way by which I can make sure that the service binding is 
   complete before any access is made to functions provided by the 
   service ? 
  
  Don't try using the Binder until onServiceConnected() is called. 
 http://commonsware.com/training

-- 
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: Help needed for dealing with NullPointerException when calling functions on a service just after binding it

2011-07-22 Thread gjs
Hi,

You can just start the service via an intent and also pass details
about the function(s) you want executed, but you won't get anything
returned from the function(s) invoked in the service being sent back
to the activity directly, you will have to use the usual interfaces
otherwise.

Regards

On Jul 22, 4:54 pm, Chris Stratton cs07...@gmail.com wrote:
 On Thursday, July 21, 2011 1:26:54 AM UTC-4, Animesh Sinha wrote:
  The issue is that I need to call the service methods as soon as it is
  connected.
  So, Is there any way by which I can execute the functions of service
  JUST AFTER binding is complete ?

  It takes around 10-20ms for binding, I tried to make use
  Thread.sleep(30); but it delayed the service from being connected by
  the same sleep duration, therefore not solving the problem.

 The problem is that android requires you to write event driven code here.  
 It can't deliver a new event until you return from the current event.  If
 you sleep, you just delay the return, and thus the new event delivery which
 can only occur after that.

 You are going to have to do a lot of re-thinking of how to architect this
 whole process as a chain of events.  Yes, it's painful, but you'll get
 better at that kind of re-shuffling with time.







  On Jul 20, 6:33 pm, Mark Murphy mmu...@commonsware.com wrote:
   On Tue, Jul 19, 2011 at 12:21 PM, animeshsi anime...@gmail.com wrote:
Is there some way by which I can make sure that the service binding is
complete before any access is made to functions provided by the
service ?

   Don't try using the Binder until onServiceConnected() is called.
  http://commonsware.com/training

-- 
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: Help needed for dealing with NullPointerException when calling functions on a service just after binding it

2011-07-22 Thread Animesh Sinha
Thanks Chris for replying.

You are right in saying that android requires developers to write an
event-driven code and that effort needs to be put for designing the
whole chain of events.

But for the following case as shown below, I don't think one can get
rid of the NullPointerException thrown in onClick() method of
MyServiceClient; Unless instead of storing Service Interface globally,
one stores it locally.

---
CODE SNIPPET (UPDATED)
---
//class MyServiceClient in separate file - Used for accessing the
service via a wrapper class
class MyServiceClient extends Activity
{
 //store a reference to service interface
 private ISomeServiceInterface mService = null; //
reference stored globally here

 public void onCreate(Bundle savedInstanceState)
 {
//some lines
ServiceWrapperClass svc = new
ServiceWrapperClass(getApplicationContext());
//access the service
mService = svc.getService()//the
getService() method returns null
//Integer someValue = mService.someFunc(1,
2); //Moved the line into onClick() method

//using a button's onClick event to call some function on the
service
Button btn = (Button)findViewById(R.id.someBtn);
btn.setOnClickListener(new OnClickListener() {

@Override
public void onClick(View v) {
Integer someValue = 
mService.someFunc(1, 2); //
NullPointerException still thrown here as mService was null
}
 });
}

}

//class ServiceWrapperClass in separate file - Used for binding to
service and providing the service instance to client
class ServiceWrapperClass
{
private static ISomeServiceInterface myService;

//constructor
public ServiceWrapperClass(Context context) {
//create intent to connect to service
Intent serviceIntent = new Intent(some.uri);
context.bindService(serviceIntent,
progressBarServiceConn,
Context.BIND_AUTO_CREATE);
//access the service
Integer someValue = myService.someFunc(1,
2); // NullPointerException here - How to make sure
service should be running before any function is called on the
service ?
}

private ServiceConnection progressBarServiceConn = new
ServiceConnection(){
@Override
public void onServiceConnected(ComponentName name,
IBinder service)
{
myService =
 
ISomeServiceInterface.Stub.asInterface(service);
}
@Override
public void onServiceDisconnected(ComponentName name)
{
myService = null;
}
};
public ISomeServiceInterface getService()
{
return myService;
}
}

On Jul 22, 11:54 am, Chris Stratton cs07...@gmail.com wrote:
 On Thursday, July 21, 2011 1:26:54 AM UTC-4, Animesh Sinha wrote:
  The issue is that I need to call the service methods as soon as it is
  connected.
  So, Is there any way by which I can execute the functions of service
  JUST AFTER binding is complete ?

  It takes around 10-20ms for binding, I tried to make use
  Thread.sleep(30); but it delayed the service from being connected by
  the same sleep duration, therefore not solving the problem.

 The problem is that android requires you to write event driven code here.  
 It can't deliver a new event until you return from the current event.  If
 you sleep, you just delay the return, and thus the new event delivery which
 can only occur after that.

 You are going to have to do a lot of re-thinking of how to architect this
 whole process as a chain of events.  Yes, it's painful, but you'll get
 better at that kind of re-shuffling with time.







  On Jul 20, 6:33 pm, Mark Murphy mmu...@commonsware.com wrote:
   On Tue, Jul 19, 2011 at 12:21 PM, animeshsi anime...@gmail.com wrote:
Is there some way by which I can make sure that the service binding is
complete before any access is made to functions provided by the
service ?

   Don't try using the Binder until onServiceConnected() is called.
  http://commonsware.com/training

-- 
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] Re: Help needed for dealing with NullPointerException when calling functions on a service just after binding it

2011-07-22 Thread Mark Murphy
On Fri, Jul 22, 2011 at 4:35 AM, Animesh Sinha animeshs...@gmail.com wrote:
 You are right in saying that android requires developers to write an
 event-driven code and that effort needs to be put for designing the
 whole chain of events.

 But for the following case as shown below, I don't think one can get
 rid of the NullPointerException thrown in onClick() method of
 MyServiceClient; Unless instead of storing Service Interface globally,
 one stores it locally.

Developers disable UI widgets until they can be used.

Hence, developers would have R.id.someBtn disabled until
onServiceConnected() is called, at which point they would enable that
widget and thereby allow the user to request actions that involve the
service.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Warescription: Three Android Books, Plus Updates, One Low Price!

-- 
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] Re: Help needed for dealing with NullPointerException when calling functions on a service just after binding it

2011-07-22 Thread rich friedel
I solved a similar issue by broadcasting that my service is actually active 
and running and then if my activity is active it receives that broadcast and 
does what it needs to do. This way the Activity always knows when the 
service is active.

The onBind is not applicable to my situation as my Activity and Service are 
independent of each other. (Activity starts/stops Service but Service does 
not need Activity for anything else)

On Friday, July 22, 2011 6:57:42 AM UTC-4, Mark Murphy (a Commons Guy) 
wrote:

 On Fri, Jul 22, 2011 at 4:35 AM, Animesh Sinha anime...@gmail.com wrote:
  You are right in saying that android requires developers to write an
  event-driven code and that effort needs to be put for designing the
  whole chain of events.
 
  But for the following case as shown below, I don't think one can get
  rid of the NullPointerException thrown in onClick() method of
  MyServiceClient; Unless instead of storing Service Interface globally,
  one stores it locally.

 Developers disable UI widgets until they can be used.

 Hence, developers would have R.id.someBtn disabled until
 onServiceConnected() is called, at which point they would enable that
 widget and thereby allow the user to request actions that involve the
 service.

 -- 
 Mark Murphy (a Commons Guy)
 http://commonsware.com | http://github.com/commonsguy
 http://commonsware.com/blog | http://twitter.com/commonsguy

 Warescription: Three Android Books, Plus Updates, One Low Price!



-- 
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] Re: Help needed for dealing with NullPointerException when calling functions on a service just after binding it

2011-07-21 Thread Mark Murphy
On Thu, Jul 21, 2011 at 1:26 AM, animeshsi animeshs...@gmail.com wrote:
 The issue is that I need to call the service methods as soon as it is
 connected.
 So, Is there any way by which I can execute the functions of service
 JUST AFTER binding is complete ?

Execute those functions in onServiceConnected().

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android Training in London: http://bit.ly/smand1, http://bit.ly/smand2

-- 
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: Help needed for dealing with NullPointerException when calling functions on a service just after binding it

2011-07-21 Thread Animesh Sinha
Executing the function calls in onServiceConnected() method is not
what is wanted as described in following case:


CODE SNIPPET

class ServiceWrapperClass
{
private ISomeServiceInterface myService
..
private ServiceConnection progressBarServiceConn = new
ServiceConnection() {
@Override
public void onServiceConnected(ComponentName name,
IBinder service)
{
myService =
ISomeServiceInterface.Stub.asInterface(service);
}
@Override
public void onServiceDisconnected(ComponentName name)
{
myService = null;
}
};
 public void onCreate(Bundle savedInstanceState) {

//create intent to connect to service
Intent serviceIntent = new Intent(some.uri);
bindService(serviceIntent, progressBarServiceConn,
Context.BIND_AUTO_CREATE);
//access the service
Integer someValue = myService.someFunc(1, 2); //
NullPointerException here - How to make sure service should be
running
before any function is called on the service ?
  }



On Jul 21, 3:16 pm, Mark Murphy mmur...@commonsware.com wrote:
 On Thu, Jul 21, 2011 at 1:26 AM, animeshsi animeshs...@gmail.com wrote:
  The issue is that I need to call the service methods as soon as it is
  connected.
  So, Is there any way by which I can execute the functions of service
  JUST AFTER binding is complete ?

 Execute those functions in onServiceConnected().

 --
 Mark Murphy (a Commons 
 Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy

 Android Training in London:http://bit.ly/smand1,http://bit.ly/smand2

-- 
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: Help needed for dealing with NullPointerException when calling functions on a service just after binding it

2011-07-21 Thread Animesh Sinha
Executing the function calls in onServiceConnected() method is not
what is wanted as described in following case:

There is a Service Wrapper class where the binding/unbinding is
actually done.
The MyServiceClient is an Activity class used for invoking some
functions on the service using the Service Wrapper class, instead of
directly binding/unbinding to service.

In this case, a service client using the wrapper class cannot execute
the function calls on the service in onServiceConnected() method,
which is in a different file.

The NullPointerException is therefore still thrown when any function
is invoked on the service after initializing the service wrapper.

---
CODE SNIPPET (UPDATED)
---
//class MyServiceClient in separate file - Used for accessing the
service via a wrapper class
class MyServiceClient extends Activity
{

public void onCreate(Bundle savedInstanceState) {
//some lines
ServiceWrapperClass svc = new
ServiceWrapperClass(getApplicationContext());

//access the service
Integer someValue = svc.getService().someFunc(1, 2);
 //
NullPointerException here - How to make sure service should be running
before any function is called on the service ?
}
}


//class ServiceWrapperClass in separate file - Used for binding to
service and providing the service instance to client
class ServiceWrapperClass
{
private static ISomeServiceInterface myService;

//constructor
public ServiceWrapperClass(Context context) {
//create intent to connect to service
Intent serviceIntent = new Intent(some.uri);
context.bindService(serviceIntent, progressBarServiceConn,
Context.BIND_AUTO_CREATE);
//access the service
Integer someValue = myService.someFunc(1, 2); //
NullPointerException here - How to make sure service should be running
before any function is called on the service ?
}

private ServiceConnection progressBarServiceConn = new
ServiceConnection(){
@Override
public void onServiceConnected(ComponentName name,
IBinder service)
{
myService =
ISomeServiceInterface.Stub.asInterface(service);
}
@Override
public void onServiceDisconnected(ComponentName name)
{
myService = null;
}
};

public ISomeServiceInterface getService()
{
return myService;
}
}


On Jul 21, 3:16 pm, Mark Murphy mmur...@commonsware.com wrote:
 On Thu, Jul 21, 2011 at 1:26 AM, animeshsi animeshs...@gmail.com wrote:
  The issue is that I need to call the service methods as soon as it is
  connected.
  So, Is there any way by which I can execute the functions of service
  JUST AFTER binding is complete ?

 Execute those functions in onServiceConnected().

 --
 Mark Murphy (a Commons 
 Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy

 Android Training in London:http://bit.ly/smand1,http://bit.ly/smand2

-- 
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: Help needed for dealing with NullPointerException when calling functions on a service just after binding it

2011-07-20 Thread animeshsi
Thanks Mark for replying.

The issue is that I need to call the service methods as soon as it is
connected.
So, Is there any way by which I can execute the functions of service
JUST AFTER binding is complete ?

It takes around 10-20ms for binding, I tried to make use
Thread.sleep(30); but it delayed the service from being connected by
the same sleep duration, therefore not solving the problem.

On Jul 20, 6:33 pm, Mark Murphy mmur...@commonsware.com wrote:
 On Tue, Jul 19, 2011 at 12:21 PM, animeshsi animeshs...@gmail.com wrote:
  Is there some way by which I can make sure that the service binding is
  complete before any access is made to functions provided by the
  service ?

 Don't try using the Binder until onServiceConnected() is called.

 --
 Mark Murphy (a Commons 
 Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy

 Android Training...At Your Office:http://commonsware.com/training

-- 
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] Re: Help needed on porting Flixel Framework to Android. Current issue: switch from canvas draw to opengl es

2011-05-02 Thread Leonardo Zimbres
Hello Mario,

I saw you post on Flixel forum. Its good to hear from you. I do feel a
little crippled because I dont know muchjava, and opengl is very new to me.

First I will try to awser your questions.

- How much of the original Flixel API should be covered?

I dont know, but W. Eraser points out this necessity of using opengles
render instead of canvas render. Looks like a very good point to work on, as
some flixel visual functions dont work or are impossible on canvas.

- How much has been ported so far? I'd actually just rip out the
interfaces/class/method signatures and replace the implementations.

Sorry, cant help much. I saw about a guy, one year ago, ported somekind of
flixel to android, replacing the actionscript syntax with java, and working
only on render and other little issues. That version was a lot bugged, and
this new flixel2 was done by Wing Eraser. Looks like a as3 flixel, added a
d-pad and the canvas render.

The project page has more information. If its not bothering you, can you
point me some books/links to study and get a better idea of your work on
libgdx? Like, to know the roots of the thing? I've read about rendering
using bit blitting, like canvas render, but thats all I know so far.

Really thanks for your interest, if theres something I can do to help,
please ask.

Cheers, Zimbres.
Ps: sorry the late reply. I was working on some deadlines these days.

The more that is already available the better.

2011/4/28 Mario Zechner badlogicga...@gmail.com

 Neat, a Flixel Android port would indeed be a nice to have. I saw that
 the project is actually not an Actionscript 3 project but a Java based
 project. Might i suggest basing the Android Flixel port on libgdx [1]?
 Benefit: it would also run on the desktop (windows, linux, mac) and
 the nasty OpenGL ES stuff is pretty much hidden by the utility classes
 we offer on top of the GLES binding. I played around with Flixel a
 little bit a while ago and the port to libgdx should be very straight
 forward and painless.

 I might even have some time to do this myself. Could you answer me
 some questions?

 - How much of the original Flixel API should be covered?
 - How much has been ported so far? I'd actually just rip out the
 interfaces/class/method signatures and replace the implementations.
 The more that is already available the better.

 Ciao,
 Mario

 [1] http://code.google.com/p/libgdx/ (ignore the fugliness of the
 site, we are working on a dedicated one with super awesome images and
 ajax and web scale and all that jazz...)


 On 27 Apr., 16:59, Leonardo Zimbres leonardozimb...@gmail.com wrote:
  Hello Android Devs,
 
  WingEraser (its how I know him) has been porting Flixel to Android for a
  while.
 
  What is flixel? An actionscript 3.0 game framework. Its very well
 organized
  and have a lot of good stuff into it. Collisions, particles, nice use of
  bitmaps to tiles and sprite animations.
  If someone is curious about flixel, its homepage has some games:
 http://flixel.org/
 
  Abour the porting to android: Theres a lot of good done, but one issue is
  giving certain trouble: to convert the framework render pipeline, from
  canvas draw to opengl es.
 
  Theres someone up to work on that? Im lerarning what I can, but Im a
 little
  new on Java, Android and OpenGL.
 
  Ah, the last threads about flixel-android:
 http://flixel.org/forums/index.php?topic=2848.45
 
  And the project page:http://code.google.com/p/flixel-android/
 
  Thanks, Zimbres.

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




-- 
Leonardo Zimbres
http://zanardiliza.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: Help needed on porting Flixel Framework to Android. Current issue: switch from canvas draw to opengl es

2011-04-28 Thread Mario Zechner
Neat, a Flixel Android port would indeed be a nice to have. I saw that
the project is actually not an Actionscript 3 project but a Java based
project. Might i suggest basing the Android Flixel port on libgdx [1]?
Benefit: it would also run on the desktop (windows, linux, mac) and
the nasty OpenGL ES stuff is pretty much hidden by the utility classes
we offer on top of the GLES binding. I played around with Flixel a
little bit a while ago and the port to libgdx should be very straight
forward and painless.

I might even have some time to do this myself. Could you answer me
some questions?

- How much of the original Flixel API should be covered?
- How much has been ported so far? I'd actually just rip out the
interfaces/class/method signatures and replace the implementations.
The more that is already available the better.

Ciao,
Mario

[1] http://code.google.com/p/libgdx/ (ignore the fugliness of the
site, we are working on a dedicated one with super awesome images and
ajax and web scale and all that jazz...)


On 27 Apr., 16:59, Leonardo Zimbres leonardozimb...@gmail.com wrote:
 Hello Android Devs,

 WingEraser (its how I know him) has been porting Flixel to Android for a
 while.

 What is flixel? An actionscript 3.0 game framework. Its very well organized
 and have a lot of good stuff into it. Collisions, particles, nice use of
 bitmaps to tiles and sprite animations.
 If someone is curious about flixel, its homepage has some 
 games:http://flixel.org/

 Abour the porting to android: Theres a lot of good done, but one issue is
 giving certain trouble: to convert the framework render pipeline, from
 canvas draw to opengl es.

 Theres someone up to work on that? Im lerarning what I can, but Im a little
 new on Java, Android and OpenGL.

 Ah, the last threads about 
 flixel-android:http://flixel.org/forums/index.php?topic=2848.45

 And the project page:http://code.google.com/p/flixel-android/

 Thanks, Zimbres.

-- 
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: Help needed from someone with a Nexus S 2.3.2 system

2011-04-13 Thread Zsolt Vasvari
Thanks, guys.  It wasn't a 2.3.2 issue, so I don't need the help any
more.  Thanks!

On Apr 13, 9:48 pm, Jake Basile jakerbas...@gmail.com wrote:
 By now most Nexus Ses (how do you pluralize that?) are going to be on 2.3.3.
 They do have an unlocked loader, so you can downgrade to 2.3.2. I don't know
 how off the top of my head, but I'm sure xda-developers has some thread on
 it.

-- 
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: Help needed

2011-04-04 Thread Spiral123
I agree with TreKing: you have defined your problem so large that you
will have to understand a huge amount of stuff just to get started.

Decompose your problem into smaller steps, each with a meaningful
goal.  That way you can deliver something small, then improve on it
and allow your understanding to grow at a steady pace.

For Example:

1. Decide on a piece of interesting outdoor artwork that is near to
you.  Find its co-ordinates.
2. Write an app that will display the location of that artwork on a
map.
3. Enhance your app so that it will display and update the phone
location as well as the artwork location.
4. Enhance the app so that pressing a button brings up a text screen
containing information about the artwork.
5. Enhance the app so that pressing a button brings up a text screen
and an audio commentary
6. Enhance the app so that the button appears only when the phone is
within 20 meters of the artwork
7. Enhance the app  you get the idea

You should have a clear idea of where you want to get to in the end -
but reduce the task down to much smaller pieces that are much more
achievable.  It would be better to have a project that does some
simple stuff well rather than a lot of stuff badly or not at all.

Good luck.


On Apr 3, 8:48 am, svr stefanrijnste...@gmail.com wrote:
 Hello,

 I'm building an application for a school project that will allow users
 to create a route along various locations within a chose category.

 The problem is that I have never worked with GPS locations or
 navigation scripts before and I don't really know how to approach this
 build. So I’m hoping someone could provide me whit some useful
 information to get me started.

 The idea is that the user first makes a selection between a couple of
 given categories, like say; Art galleries, Architecture and music.
 after the user has chosen a category, the application will show
 various locations that are relevant to the chosen category.

 Example:
 like for instance say the user chooses the category architecture he
 will get the locations of all the great architectural buildings within
 the given city or village he or she is in.

 the next step is that the user can connect the given locations whit
 one another to create a route between the locations

 Example:
 The user selects the firs location he wants to visit this will mark
 the start point of the route. when the next location is selected, it
 automatically will be connected to the first location and thereby
 creating a route between the locations.

 the final step is that the user will be navigated along the route he
 created. when the user arrives at a location he or she selected the
 application provides the user with information about the object that
 is based on that location. The information is provided in the form of
 audio speech and text information.

 Example:
 the user created a route along several outdoor art pieces he wanted to
 go and see. he starts up the navigation and follows the route. When he
 arrives at one of the selected locations the application provides him
 with relevant information about the out door art piece throughout an
 audio file. That only starts playing when arrives at a selected
 location.

 I’m hoping someone could help me out here because I’m really stuck.

 greetings,

 Stefan

-- 
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: Help needed - Stopped by NoClassDefFoundError when using a java library - JmDNS

2011-02-18 Thread DanH
NoClassDefFoundError should tell you which class it didn't find.  The
reasons for not found' are basically two:
1) The class really doesn't exist (in the exact package/name form
shown in the message).
2) The class was found, but subsequently experienced a verification
error.  This generally occurs when the class was compiled against
version X of some library but is finding (incompatible) version Y when
it loads.  Usually (but not always), if you look up the exception
traceback in this case you'll find mention of the specific error that
triggered the NoClassDefFoundError.

On Feb 16, 7:15 pm, scott_ggle sch...@comcast.net wrote:
 I am writing a test application using JmDNS which is java lib for
 multicast DNS discovery. (downloaded fromhttp://jmdns.sourceforge.net/).

 The exception is thrown at creation of an instance of the class. This
 indicate the class definition is not found as I understand it. So it
 looks like there is problem in including the jar in the project. I
 added the jar file as user library. Here is the steps.

 1. Right-click the project in Eclipse and select “Build Path - Add
 Libraries…”.
 2. Select User Library from the list and click Next.
 3. Click the “User Libraries…” button.
 4. Click “New…” in the User Libraries dialog.
 5. Give the user library a name and select the System library checkbox
 and click OK.
 6. Highlight the newly added user library in the list and click the
 “Add JARs…” button and add the desired jar files.
 7. Click OK on the User Libraries dialog.
 8. Make sure the new user library is checked in the Add Library dialog
 and …

 Additional information:

 - No problem if I build/run the application as Java application
 instead of Andriod application. Tried Eclipse both on Mac and Windows
 got the same error.
 - Got the same error on AVD or on actual device.
 - Tried other form of constructor as well.

 Any ideas would be greatly appreciated.

 Scott

-- 
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: Help needed for Context object: GPS implementation

2010-12-01 Thread cool.manish
My query is as it that at the time of starting GPS listener, I am
sending context from one activity. Now If I have moved to some other
activity then will I be able to use same GPS Listener which had been
started from previous activity.

if context object has relation with application and not with activity
then it will be possible for me to listen from any actvity. So I want
to know about Context object's relation with application or is it
associated with the different component?

On Nov 26, 2:56 am, TreKing treking...@gmail.com wrote:
 On Wed, Nov 24, 2010 at 3:02 AM, cool.manish mannishga...@gmail.com wrote:
  Can I start my GPS listener from one activity and can fetch coordinate in
  some other activity?

 You can start it in one activity then *pass* the information you get to
 another activity, if that's what you mean.

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


Re: [android-developers] Re: Help needed for Context object: GPS implementation

2010-12-01 Thread TreKing
On Wed, Dec 1, 2010 at 8:28 AM, cool.manish mannishga...@gmail.com wrote:

 Now If I have moved to some other activity then will I be able to use same
 GPS Listener which had been started from previous activity.


Just re-set your listeners in each activity as needed.


 if context object has relation with application and not with activity


Activity IS a context.

-
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: Help Needed Getting JSON to Jersey Web Service and Consuming it

2010-07-30 Thread JimBadger
Thanks very much Mr Gies, I'll digest this later and expand upon my
requirements if still required.

Cheers.

On 30 July, 17:25, Brad Gies rbg...@gmail.com wrote:
 To give you good advice, we probably need to know what your server end
 is expecting, and what kind of security you need.

 It could be as simple as what's below (NOTE there is extra stuff you
 don't need in here, but it should at least give you what you need) :

 ListNameValuePair nvps;

          try
          {
              InputStream is = null;

              DefaultHttpClient httpclient = new DefaultHttpClient();
              HttpPost httpPost = new HttpPost(urlString);

              String searchParams = getSearchParams();  // just my
 function to get what I want to pass

               searchParams = URLEncoder.encode(searchParams, HTTP.UTF_8);

               nvps.add(new BasicNameValuePair(category, searchParams));

              httpPost.setHeader(User-Agent, iHotTonight Android
 App);  // I set this so my server logs files are easier to read.
              httpPost.setEntity(new UrlEncodedFormEntity(nvps, HTTP.UTF_8));
              HttpResponse response = httpclient.execute(httpPost);

              HttpEntity entity = response.getEntity();

              if (entity != null)
              {
                  try
                  {
                      is = entity.getContent();

                      String line;
                      StringBuilder builder = new StringBuilder();
                      BufferedReader reader = new BufferedReader(new
 InputStreamReader(is), 8192);
                      while ((line = reader.readLine()) != null)
                      {
                          builder.append(line);
                      }
                      String retStr = builder.toString();
                      // Now get any messages coming back.
                      if (BistroSharedStatic.DEBUGGING_APP)  // I set
 this if I want to log my results.
                          Log.d(GetResults, retStr);

                      if (handler != null)   // if I passed a Handler to
 the create then send the result to the Handler.
                          sharedFunctions.SendMessage(handler,
 HandlerReturnMessage, param1, param2, retStr);

                  }
                  finally
                  {
                      entity.consumeContent();
                      is = null;
                  }
              }

          }
          catch (MalformedURLException e)
          {
              // TODO Auto-generated catch block
              e.printStackTrace();
              if (handler != null)
                  sharedFunctions.SendMessage(handler, 0, 0, 0,
 e.getMessage());  // if I passed in a Handler then send the exception to
 the handler.
          }
          catch (IOException e)
          {
              // TODO Auto-generated catch block
              e.printStackTrace();
              if (handler != null)
                  sharedFunctions.SendMessage(handler, 0, 0, 0,
 e.getMessage());
          }
          catch (Exception e)
          {
              e.printStackTrace();
              if (handler != null)
                  sharedFunctions.SendMessage(handler, 0, 0, 0,
 e.getMessage());
          }

 AND in PHP on the server end:

 $username=$_POST['from'];
 $password=$_POST['theirpassword];
 $json_string=$_POST['searchwords'];

 // do the usual stripslashes and mysql_real_escape_string stuff here.

 // now, process the JSON string
 $json = json_decode($json_string);

 BUT... depending on the security etc... it can be a lot more
 complicated. Hopefully, this is enough to get you started. :)

 On 30/07/2010 7:33 AM, JimBadger wrote:





  Hi,

  I've just recently started out with Android development, and have
  progressed to the point where I have written a very basic Hello World
  Jersey RESTful web service, and successfully called it from within my
  Android App.

  What I want to do now though, is send a new user record (just name and
  password for now) to a web service in JSON format.

  I can create my JSON in the Android app just fine, but I don't know
  how to get it into the HTTP Request in such a way that the
  corresponding web service that @Consumes JSON can get at it.

  So, this is how far I've got:

  1) Create Android App User object...(Tick: done that)
  2) Turn that into JSON...(Tick: done that)
  3) Put it on the HTTP request.(Stuck here! Help!)
  4) Call the web service...(Tick: done that)
  5) Web service retrieve JSON from request...(Stuck here! Help!)
  6) Parse the JSON into server side User object and deal with as I see
  fit...(Don't worry people, I'll be fine with this bit, thanks!)
  7) Profit! ;)

  Guys and Girls, I really appreciate any help given, you dear, dear
  kind souls!

  Cheers,
  James

 --
 Sincerely,

 Brad Gies
 ---
 Bistro Bot - Bistro 
 

Re: [android-developers] Re: Help needed with parsing some XML data !

2010-02-13 Thread Thierry Legras
Hi,

I have a similar problem. I am parsing iso-8859-1 html page with a sax
parser but having trouble to display it on _some_ devices (characters é è
... are replaced by random symbols).
On some devide i have to use myString.getBytes(iso-8859-1) to display it
correctly, and on some other devices, myString will be displayed correctly.

The best solution i cold ifnd so far is to provide a user option like force
utf8 or force iso-8859-1 that the user can check if having problem.

Thierry.


2010/2/4 MobDev developm...@mobilaria.com

 Well,
 to be honest your first idea was also mine :P So I already looked via
 Google but to be honest I haven't found that many clear discussions/
 explanations...
 I also tried idea 2 and this is what I got :

 Congratulations

 The document located at http://x was successfully checked as
 well-formed XML. This means that we were not able to determine the
 exact document type, but that the document passed the XML well-
 formedness syntax check. If you wish to wish to perform formal
 validation of the document, you can use the Document Type: option of
 the validator. 

 But also this has been found, even though I do not know how important
 this is :
 The DOCTYPE Declaration was not recognized or is missing. This
 probably means that the Formal Public Identifier contains a spelling
 error, or that the Declaration is not using correct syntax, or that
 your XML document is not using a DOCTYPE Declaration.

 Validation of the document has been skipped, and a simple check of the
 well-formedness of the XML syntax has been performed instead. 

 Als, just to point out, at this point i CAN read out the XML stream by
 using the
 Xml.parse(is, Xml.Encoding.ISO_8859_1, new ExampleHandler(myAdapter));
 method...
 The only problem that remains is when I try to write on-screen the
 values...
 Btw, is there a way to trasform such a String (for example from a
 Country ID=2 CName=Åland eilanden/  tag) to utf-8 ?
 I have experienced such a problem on the iPhone some time ago, it also
 received the data as ISO-8859-1 but the STring had to be encoded to
 UTF8 to be shown correctly onscreen

 On 4 feb, 11:47, Frank Weiss fewe...@gmail.com wrote:
  I have two ideas for you, Mobdev:
 
  1) Google for not well-formed (invalid token) and see what other people
  have found regarding this error.
  2) Go to validator.w3.org and see if the XML file in question is indeed
  valid or not.
 
  Please let us know what you find out.

 --
 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.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en




-- 
Thierry.

-- 
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: Help Needed With Some Layout - UI Problems

2010-02-09 Thread MobDev
well the idea of a tablelayout with just one row is that I want to
place two items, one on the left side of the screen and one centered
within the screen...
so if you have any idea how to achieve this ? Or will a horizontal
linearlayout fix that ?
I am having a lot of trouble, I love the fact that it's all so
customizable but it's somewhat TOO customizable.. I mena if I place a
Widget onscreen afterwards I got like 40 fields with options to set...
Some are completely criptic, many have a Gravity AND a
Layout_Gravity.. what's up with that ? If I place the gravity on
horizontal_centered it won't work but if I set the property layout
center horizontal to true it will... So I got 3 options, who all seem
to do the same but some will work the others won't and God help us
there is no good explanation/documentation about it... Anyone up to
finding the needle in the haystack ? ;)

On 8 feb, 19:38, TreKing treking...@gmail.com wrote:
 On Mon, Feb 8, 2010 at 8:56 AM, MobDev developm...@mobilaria.com wrote:
  A vertical LinearLayout, which contains first a TableLayout with just
  one TableRow

 What's the point of having a TableLayout with just one row? Why not just use
 a horizontal LinearLayout?

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

-- 
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: Help Needed With Some Layout - UI Problems

2010-02-08 Thread Sekhar
It will work, make sure you have the orientation set to vertical for
the LinearLayout.

On Feb 8, 6:56 am, MobDev developm...@mobilaria.com wrote:
 Hi,
 I'd like to create an UI existing out of the following elements :

 LinearLayout
     TableLayout
         TableRow
            ImageButton
            TextView
         /TableRow
    /TableLayout
    ScrollView
       TableLayout
          TableRow
             ImageButton
             ImageButton
          /TableRow
           TableRow
             ImageButton
             ImageButton
          /TableRow
           TableRow
             ImageButton
             ImageButton
          /TableRow
       /TableLayout
     /ScrollView

 So in short :
 A vertical LinearLayout, which contains first a TableLayout with just
 one TableRow, and afterwards a Scrollable Table...

 If I try it like above I actually will only see the first TableLayout,
 the ScrollView (with it's tabel and tablerows) won't show at all...
 I read that within a ScrollView there should be a LinearLayout and in
 there the TableLayout...
 So I did that and it works but ONLY if I completely remove the first
 TableLayout, which I actually want to keep..

 So is this some kind of know bug, or how could I possibly solve this ?
 Is it possible for a ScrollView to co-exist with another TableLayout
 (on the same XML level) ? Or can it onky exits if it's the only
 child of the base-layout ?

-- 
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: Help needed with parsing some XML data !

2010-02-04 Thread MobDev
hehe,
my bad I said Netbeans but I actually use Eclipse :P
Still used to J2ME with NetBeans thats why I mixed up...
Anyways, I do get the error (exception) which I already posted in one
of my first posts :
At line 40, column 23: not well-formed (invalid token)

They *MUST* be valid printing Unicode
characters. No random control characters -- for example, ISO-8859-1
byte values 0-31 (decimal). This will ALWAYS fail -- it is NOT well-
formed XML. If that's the cause of your exceptions
Well I did paste the error-generating xml entry which for example is :
Country ID=2 CName=Åland eilanden/


It would help
if you posted the URL to the XML 
Unfortunately I am not allowed to do so :( It's a URL which is
actually in use by our already exisiting software...

Also I noticed my previous post was posted three times ! My apologies
for that, I actually can't remember pushing the Send button three
times :P

On 3 feb, 19:02, Bob Kerns r...@acm.org wrote:
 Yeah, that's not what I mean by a test case.

 Seehttp://junit.orgas a starting point.
 (The Android SDK includes some limited version of JUnit I don't
 recognize. It's adequate for this purpose, but the full, modern
 version is better. For non-device testing, you're not restricted to
 the supplied one.)

 Basically, a test case is code that you can run to *automatically*
 test some specific aspect of a system. In this case, checking against
 a known set of XML (so it doesn't change), looking for the known
 desired result, and reporting failures (expected conditions not
 matching) and errors (unexpected exceptions thrown).

 This removes the variables from the equation. You're not depending on
 how things display, either in the UI nor in the log stream and
 windows. You're not dependent on a human to notice a problem.

 An best of all, you can automate it to always run when you build, so
 if you break later, you'll find out right away, while you know what
 you changed. And you can make changes freely, with the security of
 knowing that you won't have to go through some long test/debug cycle.

 I didn't answer your question about getting a stacktrace earlier,
 because you said NetBeans. I'm old enough to remember when NetBeans
 was the hot new thing -- but too old to remember how to do anything
 with it. Try using Eclipse and the ADK. It will show you the stack
 trace in the same way it shows any other stack trace, as if you were
 debugging locally. (I would expect NetBeans to, as well).

 Or you can catch the exception, and use exception.printStackTrace() to
 get it into the log (I'm surprised it's not already there).

 This isn't really an Android problem, and it's not necessary to debug
 it there. If you write your failing test cases, you can debug them on
 your desktop computer, get them working, and you should be set to go
 on the device.

 Another thing to realize is that not all character values you can come
 up with, are legal XML content. They *MUST* be valid printing Unicode
 characters. No random control characters -- for example, ISO-8859-1
 byte values 0-31 (decimal). This will ALWAYS fail -- it is NOT well-
 formed XML. If that's the cause of your exceptions, your two choices
 would be to fix it on the server (probably by encoding this binary
 data) or to preprocess the fake-XML into real XML before you feed it
 to the XML parser.

 \
 On Feb 3, 6:49 am, MobDev developm...@mobilaria.com wrote:

  well to begin with : thx for the expalanation :D
  I was wondering about your statement :
  Try logging to a file. Or better yet, create test cases, and verify
  the correct operation of your code via test suite, rather than via log
  statements. 
  I already tried in a test case, which was to write the incoming data
  to a AlertDialog, but the result was that those characters are shwon
  on-screen with a rectangle with a ? in it... My idea (and test case)
  would be to stream a list of countries, and afterwards show this
  list onscreen so the user can select one...
  Our problem is that the whole system I am using is based on the ISO
  norm and cannot be changed to UTF-8 in a short period of time...
  Or am I misinterpreting your test cases and test suite ? And if so
  how should it have been interpreted ?

  On 3 feb, 13:26, Bob Kerns r...@acm.org wrote:

   Well, you found one way to get the encoding in there. A few more:

   InputSource.setEncoding(iso-8859-1)
   new InputStreamReader(stream, iso-8859-1);

   I'd argue that it should have gotten it from the ?xml...
   encoding=iso-8859-1? -- I'm a bit surprised it didn't. But it's
   something I'd never rely on if I know the encoding.

   Anyway, re: your problem below. It's probably working right, up to the
   point of the log statement.

   The log stream is probably taking those bytes, and then later they're
   being interpreted as UTF-8. or it's taking the characters from the
   string, and interpreting them as UTF-8 (via String.getBytes()) and
   passing them off to a log stream that doesn't know about 

Re: [android-developers] Re: Help needed with parsing some XML data !

2010-02-04 Thread Frank Weiss
I have two ideas for you, Mobdev:

1) Google for not well-formed (invalid token) and see what other people
have found regarding this error.
2) Go to validator.w3.org and see if the XML file in question is indeed
valid or not.

Please let us know what you find out.

-- 
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: Help needed with parsing some XML data !

2010-02-04 Thread MobDev
Well,
to be honest your first idea was also mine :P So I already looked via
Google but to be honest I haven't found that many clear discussions/
explanations...
I also tried idea 2 and this is what I got :

Congratulations

The document located at http://x was successfully checked as
well-formed XML. This means that we were not able to determine the
exact document type, but that the document passed the XML well-
formedness syntax check. If you wish to wish to perform formal
validation of the document, you can use the Document Type: option of
the validator. 

But also this has been found, even though I do not know how important
this is :
The DOCTYPE Declaration was not recognized or is missing. This
probably means that the Formal Public Identifier contains a spelling
error, or that the Declaration is not using correct syntax, or that
your XML document is not using a DOCTYPE Declaration.

Validation of the document has been skipped, and a simple check of the
well-formedness of the XML syntax has been performed instead. 

Als, just to point out, at this point i CAN read out the XML stream by
using the
Xml.parse(is, Xml.Encoding.ISO_8859_1, new ExampleHandler(myAdapter));
method...
The only problem that remains is when I try to write on-screen the
values...
Btw, is there a way to trasform such a String (for example from a
Country ID=2 CName=Åland eilanden/  tag) to utf-8 ?
I have experienced such a problem on the iPhone some time ago, it also
received the data as ISO-8859-1 but the STring had to be encoded to
UTF8 to be shown correctly onscreen

On 4 feb, 11:47, Frank Weiss fewe...@gmail.com wrote:
 I have two ideas for you, Mobdev:

 1) Google for not well-formed (invalid token) and see what other people
 have found regarding this error.
 2) Go to validator.w3.org and see if the XML file in question is indeed
 valid or not.

 Please let us know what you find out.

-- 
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: Help needed with parsing some XML data !

2010-02-04 Thread Bob Kerns
The problem is, I can't reproduce your problem.

I don't know why you don't know how to see a stack trace in Eclipse,
so I'm not quite sure how to tell you how. :=)

* You should be in the Debug perspective.
* Select the Breakpoints view in the Debug perspective.
* Click on the little exclamation point icon on the Breakpoints view
toolbar, and enter Exception, to add a breakpoint on all Exception's
being thrown.
* Debug the program, and do any interactions required to trigger the
problem.
* Stacktrace will appear in the stacktrace window.

If, however, I edit your code to do:
InputSource in = new InputSource(url.openStream());
in.setEncoding(utf-8);
xr.parse(in);

Exception in thread main
com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException:
Invalid byte 2 of 2-byte UTF-8 sequence.
at
com.sun.org.apache.xerces.internal.impl.io.UTF8Reader.invalidByte(UTF8Reader.java:
674)
at
com.sun.org.apache.xerces.internal.impl.io.UTF8Reader.read(UTF8Reader.java:
362)
at
com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.load(XMLEntityScanner.java:
1742)
at
com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.scanLiteral(XMLEntityScanner.java:
1064)
at
com.sun.org.apache.xerces.internal.impl.XMLScanner.scanAttributeValue(XMLScanner.java:
813)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanAttribute(XMLDocumentFragmentScannerImpl.java:
1539)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:
1316)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl
$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2747)

at
com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:
648)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:
510)
at
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:
807)
at
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:
737)
at
com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:
107)
at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:
1205)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl
$JAXPSAXParser.parse(SAXParserImpl.java:522)
at Foo.main(Foo.java:25)

Which isn't the same error at all.

I think the problem may start earlier in the file, and be detected
here. I concur with Frank about validating your XML separately.

But good luck with googling it. Other SAX parsers, notably including
Python, give the same error, plus lots of people have invalid input,
so you get a huge amount of noise. Looking at the SAX source to see
exactly how you get the error might help.

On Feb 4, 1:12 am, MobDev developm...@mobilaria.com wrote:
 hehe,
 my bad I said Netbeans but I actually use Eclipse :P
 Still used to J2ME with NetBeans thats why I mixed up...
 Anyways, I do get the error (exception) which I already posted in one
 of my first posts :
 At line 40, column 23: not well-formed (invalid token)

 They *MUST* be valid printing Unicode
 characters. No random control characters -- for example, ISO-8859-1
 byte values 0-31 (decimal). This will ALWAYS fail -- it is NOT well-
 formed XML. If that's the cause of your exceptions
 Well I did paste the error-generating xml entry which for example is :
 Country ID=2 CName=Åland eilanden/

 It would help
 if you posted the URL to the XML 
 Unfortunately I am not allowed to do so :( It's a URL which is
 actually in use by our already exisiting software...

 Also I noticed my previous post was posted three times ! My apologies
 for that, I actually can't remember pushing the Send button three
 times :P

 On 3 feb, 19:02, Bob Kerns r...@acm.org wrote:



  Yeah, that's not what I mean by a test case.

  Seehttp://junit.orgasa starting point.
  (The Android SDK includes some limited version of JUnit I don't
  recognize. It's adequate for this purpose, but the full, modern
  version is better. For non-device testing, you're not restricted to
  the supplied one.)

  Basically, a test case is code that you can run to *automatically*
  test some specific aspect of a system. In this case, checking against
  a known set of XML (so it doesn't change), looking for the known
  desired result, and reporting failures (expected conditions not
  matching) and errors (unexpected exceptions thrown).

  This removes the variables from the equation. You're not depending on
  how things display, either in the UI nor in the log stream and
  windows. You're not dependent on a human to notice a problem.

  An best of all, you can automate it to always run when you build, so
  if you break later, you'll find out 

[android-developers] Re: Help needed with parsing some XML data !

2010-02-03 Thread MobDev
Actually this is the code for the second approach :

/* Create a URL we want to load some xml-data from. */
URL url = new URL(http://www.myserver.com/xmlstream;);

/* Get a SAXParser from the SAXPArserFactory. */
SAXParserFactory spf = SAXParserFactory.newInstance();
SAXParser sp = spf.newSAXParser();

 /* Get the XMLReader of the SAXParser we created. */
XMLReader xr = sp.getXMLReader();
 /* Create a new ContentHandler and apply it to the XML-Reader*/
ExampleHandler myExampleHandler = new ExampleHandler();
xr.setContentHandler(myExampleHandler);

/* Parse the xml-data from our URL. */
xr.parse(new InputSource(url.openStream()));
/* Parsing has finished. */

And the error I get is :
At line 40, column 23: not well-formed (invalid token)

which is around this XML line :
Country ID=2 CName=Åland eilanden/

So where should I specifiy its an ISO-8859-1 ?
Also I have been debugging the app, but I actually cannot see the
stacktrace, could you please direct me on how to show it on NetBeans ?
Every time I try to look at the exception thrown I will see several
variables but StackTrace will be null...



On 3 feb, 06:17, Bob Kerns r...@acm.org wrote:
 While I would expect your second approach to work, it's important to
 note that IT IS NOT REQUIRED TO WORK.

 The XML standard does not require XML processors to support anything
 other than UTF-8 or UTF-16.

 In this day and age, I would STRONGLY discourage use of anything other
 than UTF-8, or, rarely, UTF-16.

 Another factor to consider is how you're getting access to those
 characters. You must do this one of two ways:

 1) Using a Reader set to read 8859-1
 -or-
 2) Using an input stream, giving the raw bytes to the parser, letting
 it decode the 8859-1 characters.

 You WILL FAIL (and this is probably your problem, would be my guess)
 if you try to read using a Reader that's expecting UTF-8.

 A stacktrace should show which problem you have.

 On Feb 2, 6:42 am, MobDev developm...@mobilaria.com wrote:

  Hi,
  I am downloading a xml-type file from a webserver which starts out
  with :

  ?xml version=1.0 encoding=iso-8859-1 ?

  afterwards I get a list with loads of countries, some countries do
  contain some letters like é and á.

  I have tried to extract the data of the xml in two ways :
  1 - simply download the whole thing into a String, which will result
  in those characters being seen as something like [] or on the Android
  emulator (and device) I will see a triangle with a ? in it...

  2 - fetch the list with the SAXParser and XMLReader which will just
  throw an exception telling me that there is some content error...
  specifically at the line where the first country is with such a
  character...

  So is there some way to get this to work ? Can I read the iso-8859-1
  encoded xml into the Parser ? Or is there some way to encode/decode
  the received data into something actually usable ?
  Any idea where the problem might be ?

  Thanks in advance for any hints, tips, code or explanation :D

-- 
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: Help needed with parsing some XML data !

2010-02-03 Thread MobDev
Btw I also have tried this instead :

 try {
URL url = new URL(http://www.myserver.com/xmlstream;);
URLConnection conn = url.openConnection();
InputStream is = conn.getInputStream();
Xml.parse(is, Xml.Encoding.ISO_8859_1, new ExampleHandler
());
} catch (Exception e)
{
throw new RuntimeException(e);
}


This time it wont just crash but for example if I print the output
(through Log) I get

Found attribute : Ã…land eilanden
and
Found attribute : Albanië instead of Albanié

So any input on this ?


On 3 feb, 10:44, MobDev developm...@mobilaria.com wrote:
 Actually this is the code for the second approach :

 /* Create a URL we want to load some xml-data from. */
 URL url = new URL(http://www.myserver.com/xmlstream;);

 /* Get a SAXParser from the SAXPArserFactory. */
 SAXParserFactory spf = SAXParserFactory.newInstance();
 SAXParser sp = spf.newSAXParser();

  /* Get the XMLReader of the SAXParser we created. */
 XMLReader xr = sp.getXMLReader();
  /* Create a new ContentHandler and apply it to the XML-Reader*/
 ExampleHandler myExampleHandler = new ExampleHandler();
 xr.setContentHandler(myExampleHandler);

 /* Parse the xml-data from our URL. */
 xr.parse(new InputSource(url.openStream()));
 /* Parsing has finished. */

 And the error I get is :
 At line 40, column 23: not well-formed (invalid token)

 which is around this XML line :
 Country ID=2 CName=Åland eilanden/

 So where should I specifiy its an ISO-8859-1 ?
 Also I have been debugging the app, but I actually cannot see the
 stacktrace, could you please direct me on how to show it on NetBeans ?
 Every time I try to look at the exception thrown I will see several
 variables but StackTrace will be null...

 On 3 feb, 06:17, Bob Kerns r...@acm.org wrote:

  While I would expect your second approach to work, it's important to
  note that IT IS NOT REQUIRED TO WORK.

  The XML standard does not require XML processors to support anything
  other than UTF-8 or UTF-16.

  In this day and age, I would STRONGLY discourage use of anything other
  than UTF-8, or, rarely, UTF-16.

  Another factor to consider is how you're getting access to those
  characters. You must do this one of two ways:

  1) Using a Reader set to read 8859-1
  -or-
  2) Using an input stream, giving the raw bytes to the parser, letting
  it decode the 8859-1 characters.

  You WILL FAIL (and this is probably your problem, would be my guess)
  if you try to read using a Reader that's expecting UTF-8.

  A stacktrace should show which problem you have.

  On Feb 2, 6:42 am, MobDev developm...@mobilaria.com wrote:

   Hi,
   I am downloading a xml-type file from a webserver which starts out
   with :

   ?xml version=1.0 encoding=iso-8859-1 ?

   afterwards I get a list with loads of countries, some countries do
   contain some letters like é and á.

   I have tried to extract the data of the xml in two ways :
   1 - simply download the whole thing into a String, which will result
   in those characters being seen as something like [] or on the Android
   emulator (and device) I will see a triangle with a ? in it...

   2 - fetch the list with the SAXParser and XMLReader which will just
   throw an exception telling me that there is some content error...
   specifically at the line where the first country is with such a
   character...

   So is there some way to get this to work ? Can I read the iso-8859-1
   encoded xml into the Parser ? Or is there some way to encode/decode
   the received data into something actually usable ?
   Any idea where the problem might be ?

   Thanks in advance for any hints, tips, code or explanation :D

-- 
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: Help needed with parsing some XML data !

2010-02-03 Thread Bob Kerns
Well, you found one way to get the encoding in there. A few more:

InputSource.setEncoding(iso-8859-1)
new InputStreamReader(stream, iso-8859-1);

I'd argue that it should have gotten it from the ?xml...
encoding=iso-8859-1? -- I'm a bit surprised it didn't. But it's
something I'd never rely on if I know the encoding.

Anyway, re: your problem below. It's probably working right, up to the
point of the log statement.

The log stream is probably taking those bytes, and then later they're
being interpreted as UTF-8. or it's taking the characters from the
string, and interpreting them as UTF-8 (via String.getBytes()) and
passing them off to a log stream that doesn't know about UTF-8.

Try logging to a file. Or better yet, create test cases, and verify
the correct operation of your code via test suite, rather than via log
statements.

But if you have any control or influence over the server -- fix the
problem there. ISO-8859-* should be of purely historical interest in
interpreting old documents. The first draft of ISO-10646 came out
nearly 20 years ago, and UTF-8 has been around for nearly 18 years.
The world is international. It's time to put a stake in the heart of
these national encodings.

On Feb 3, 2:55 am, MobDev developm...@mobilaria.com wrote:
 Btw I also have tried this instead :

  try {
                 URL url = new URL(http://www.myserver.com/xmlstream;);
                 URLConnection conn = url.openConnection();
             InputStream is = conn.getInputStream();
             Xml.parse(is, Xml.Encoding.ISO_8859_1, new ExampleHandler
 ());
         } catch (Exception e)
         {
             throw new RuntimeException(e);
         }

 This time it wont just crash but for example if I print the output
 (through Log) I get

 Found attribute : Ã…land eilanden
 and
 Found attribute : Albanië instead of Albanié

 So any input on this ?

 On 3 feb, 10:44, MobDev developm...@mobilaria.com wrote:



  Actually this is the code for the second approach :

  /* Create a URL we want to load some xml-data from. */
  URL url = new URL(http://www.myserver.com/xmlstream;);

  /* Get a SAXParser from the SAXPArserFactory. */
  SAXParserFactory spf = SAXParserFactory.newInstance();
  SAXParser sp = spf.newSAXParser();

   /* Get the XMLReader of the SAXParser we created. */
  XMLReader xr = sp.getXMLReader();
   /* Create a new ContentHandler and apply it to the XML-Reader*/
  ExampleHandler myExampleHandler = new ExampleHandler();
  xr.setContentHandler(myExampleHandler);

  /* Parse the xml-data from our URL. */
  xr.parse(new InputSource(url.openStream()));
  /* Parsing has finished. */

  And the error I get is :
  At line 40, column 23: not well-formed (invalid token)

  which is around this XML line :
  Country ID=2 CName=Åland eilanden/

  So where should I specifiy its an ISO-8859-1 ?
  Also I have been debugging the app, but I actually cannot see the
  stacktrace, could you please direct me on how to show it on NetBeans ?
  Every time I try to look at the exception thrown I will see several
  variables but StackTrace will be null...

  On 3 feb, 06:17, Bob Kerns r...@acm.org wrote:

   While I would expect your second approach to work, it's important to
   note that IT IS NOT REQUIRED TO WORK.

   The XML standard does not require XML processors to support anything
   other than UTF-8 or UTF-16.

   In this day and age, I would STRONGLY discourage use of anything other
   than UTF-8, or, rarely, UTF-16.

   Another factor to consider is how you're getting access to those
   characters. You must do this one of two ways:

   1) Using a Reader set to read 8859-1
   -or-
   2) Using an input stream, giving the raw bytes to the parser, letting
   it decode the 8859-1 characters.

   You WILL FAIL (and this is probably your problem, would be my guess)
   if you try to read using a Reader that's expecting UTF-8.

   A stacktrace should show which problem you have.

   On Feb 2, 6:42 am, MobDev developm...@mobilaria.com wrote:

Hi,
I am downloading a xml-type file from a webserver which starts out
with :

?xml version=1.0 encoding=iso-8859-1 ?

afterwards I get a list with loads of countries, some countries do
contain some letters like é and á.

I have tried to extract the data of the xml in two ways :
1 - simply download the whole thing into a String, which will result
in those characters being seen as something like [] or on the Android
emulator (and device) I will see a triangle with a ? in it...

2 - fetch the list with the SAXParser and XMLReader which will just
throw an exception telling me that there is some content error...
specifically at the line where the first country is with such a
character...

So is there some way to get this to work ? Can I read the iso-8859-1
encoded xml into the Parser ? Or is there some way to encode/decode
the received data into something actually usable ?
Any idea where the problem might be ?


[android-developers] Re: Help needed with parsing some XML data !

2010-02-03 Thread MobDev
well to begin with : thx for the expalanation :D
I was wondering about your statement :
Try logging to a file. Or better yet, create test cases, and verify
the correct operation of your code via test suite, rather than via log
statements. 
I already tried in a test case, which was to write the incoming data
to a AlertDialog, but the result was that those characters are shwon
on-screen with a rectangle with a ? in it... My idea (and test case)
would be to stream a list of countries, and afterwards show this
list onscreen so the user can select one...
Our problem is that the whole system I am using is based on the ISO
norm and cannot be changed to UTF-8 in a short period of time...
Or am I misinterpreting your test cases and test suite ? And if so
how should it have been interpreted ?

On 3 feb, 13:26, Bob Kerns r...@acm.org wrote:
 Well, you found one way to get the encoding in there. A few more:

 InputSource.setEncoding(iso-8859-1)
 new InputStreamReader(stream, iso-8859-1);

 I'd argue that it should have gotten it from the ?xml...
 encoding=iso-8859-1? -- I'm a bit surprised it didn't. But it's
 something I'd never rely on if I know the encoding.

 Anyway, re: your problem below. It's probably working right, up to the
 point of the log statement.

 The log stream is probably taking those bytes, and then later they're
 being interpreted as UTF-8. or it's taking the characters from the
 string, and interpreting them as UTF-8 (via String.getBytes()) and
 passing them off to a log stream that doesn't know about UTF-8.

 Try logging to a file. Or better yet, create test cases, and verify
 the correct operation of your code via test suite, rather than via log
 statements.

 But if you have any control or influence over the server -- fix the
 problem there. ISO-8859-* should be of purely historical interest in
 interpreting old documents. The first draft of ISO-10646 came out
 nearly 20 years ago, and UTF-8 has been around for nearly 18 years.
 The world is international. It's time to put a stake in the heart of
 these national encodings.

 On Feb 3, 2:55 am, MobDev developm...@mobilaria.com wrote:

  Btw I also have tried this instead :

   try {
                  URL url = new URL(http://www.myserver.com/xmlstream;);
                  URLConnection conn = url.openConnection();
              InputStream is = conn.getInputStream();
              Xml.parse(is, Xml.Encoding.ISO_8859_1, new ExampleHandler
  ());
          } catch (Exception e)
          {
              throw new RuntimeException(e);
          }

  This time it wont just crash but for example if I print the output
  (through Log) I get

  Found attribute : Ã…land eilanden
  and
  Found attribute : Albanië instead of Albanié

  So any input on this ?

  On 3 feb, 10:44, MobDev developm...@mobilaria.com wrote:

   Actually this is the code for the second approach :

   /* Create a URL we want to load some xml-data from. */
   URL url = new URL(http://www.myserver.com/xmlstream;);

   /* Get a SAXParser from the SAXPArserFactory. */
   SAXParserFactory spf = SAXParserFactory.newInstance();
   SAXParser sp = spf.newSAXParser();

    /* Get the XMLReader of the SAXParser we created. */
   XMLReader xr = sp.getXMLReader();
    /* Create a new ContentHandler and apply it to the XML-Reader*/
   ExampleHandler myExampleHandler = new ExampleHandler();
   xr.setContentHandler(myExampleHandler);

   /* Parse the xml-data from our URL. */
   xr.parse(new InputSource(url.openStream()));
   /* Parsing has finished. */

   And the error I get is :
   At line 40, column 23: not well-formed (invalid token)

   which is around this XML line :
   Country ID=2 CName=Åland eilanden/

   So where should I specifiy its an ISO-8859-1 ?
   Also I have been debugging the app, but I actually cannot see the
   stacktrace, could you please direct me on how to show it on NetBeans ?
   Every time I try to look at the exception thrown I will see several
   variables but StackTrace will be null...

   On 3 feb, 06:17, Bob Kerns r...@acm.org wrote:

While I would expect your second approach to work, it's important to
note that IT IS NOT REQUIRED TO WORK.

The XML standard does not require XML processors to support anything
other than UTF-8 or UTF-16.

In this day and age, I would STRONGLY discourage use of anything other
than UTF-8, or, rarely, UTF-16.

Another factor to consider is how you're getting access to those
characters. You must do this one of two ways:

1) Using a Reader set to read 8859-1
-or-
2) Using an input stream, giving the raw bytes to the parser, letting
it decode the 8859-1 characters.

You WILL FAIL (and this is probably your problem, would be my guess)
if you try to read using a Reader that's expecting UTF-8.

A stacktrace should show which problem you have.

On Feb 2, 6:42 am, MobDev developm...@mobilaria.com wrote:

 Hi,
 I am downloading a xml-type file from a webserver which starts 

[android-developers] Re: Help needed with parsing some XML data !

2010-02-03 Thread MobDev
well to begin with : thx for the expalanation :D
I was wondering about your statement :
Try logging to a file. Or better yet, create test cases, and verify
the correct operation of your code via test suite, rather than via log
statements. 
I already tried in a test case, which was to write the incoming data
to a AlertDialog, but the result was that those characters are shwon
on-screen with a rectangle with a ? in it... My idea (and test case)
would be to stream a list of countries, and afterwards show this
list onscreen so the user can select one...
Our problem is that the whole system I am using is based on the ISO
norm and cannot be changed to UTF-8 in a short period of time...
Or am I misinterpreting your test cases and test suite ? And if so
how should it have been interpreted ?

On 3 feb, 13:26, Bob Kerns r...@acm.org wrote:
 Well, you found one way to get the encoding in there. A few more:

 InputSource.setEncoding(iso-8859-1)
 new InputStreamReader(stream, iso-8859-1);

 I'd argue that it should have gotten it from the ?xml...
 encoding=iso-8859-1? -- I'm a bit surprised it didn't. But it's
 something I'd never rely on if I know the encoding.

 Anyway, re: your problem below. It's probably working right, up to the
 point of the log statement.

 The log stream is probably taking those bytes, and then later they're
 being interpreted as UTF-8. or it's taking the characters from the
 string, and interpreting them as UTF-8 (via String.getBytes()) and
 passing them off to a log stream that doesn't know about UTF-8.

 Try logging to a file. Or better yet, create test cases, and verify
 the correct operation of your code via test suite, rather than via log
 statements.

 But if you have any control or influence over the server -- fix the
 problem there. ISO-8859-* should be of purely historical interest in
 interpreting old documents. The first draft of ISO-10646 came out
 nearly 20 years ago, and UTF-8 has been around for nearly 18 years.
 The world is international. It's time to put a stake in the heart of
 these national encodings.

 On Feb 3, 2:55 am, MobDev developm...@mobilaria.com wrote:

  Btw I also have tried this instead :

   try {
                  URL url = new URL(http://www.myserver.com/xmlstream;);
                  URLConnection conn = url.openConnection();
              InputStream is = conn.getInputStream();
              Xml.parse(is, Xml.Encoding.ISO_8859_1, new ExampleHandler
  ());
          } catch (Exception e)
          {
              throw new RuntimeException(e);
          }

  This time it wont just crash but for example if I print the output
  (through Log) I get

  Found attribute : Ã…land eilanden
  and
  Found attribute : Albanië instead of Albanié

  So any input on this ?

  On 3 feb, 10:44, MobDev developm...@mobilaria.com wrote:

   Actually this is the code for the second approach :

   /* Create a URL we want to load some xml-data from. */
   URL url = new URL(http://www.myserver.com/xmlstream;);

   /* Get a SAXParser from the SAXPArserFactory. */
   SAXParserFactory spf = SAXParserFactory.newInstance();
   SAXParser sp = spf.newSAXParser();

    /* Get the XMLReader of the SAXParser we created. */
   XMLReader xr = sp.getXMLReader();
    /* Create a new ContentHandler and apply it to the XML-Reader*/
   ExampleHandler myExampleHandler = new ExampleHandler();
   xr.setContentHandler(myExampleHandler);

   /* Parse the xml-data from our URL. */
   xr.parse(new InputSource(url.openStream()));
   /* Parsing has finished. */

   And the error I get is :
   At line 40, column 23: not well-formed (invalid token)

   which is around this XML line :
   Country ID=2 CName=Åland eilanden/

   So where should I specifiy its an ISO-8859-1 ?
   Also I have been debugging the app, but I actually cannot see the
   stacktrace, could you please direct me on how to show it on NetBeans ?
   Every time I try to look at the exception thrown I will see several
   variables but StackTrace will be null...

   On 3 feb, 06:17, Bob Kerns r...@acm.org wrote:

While I would expect your second approach to work, it's important to
note that IT IS NOT REQUIRED TO WORK.

The XML standard does not require XML processors to support anything
other than UTF-8 or UTF-16.

In this day and age, I would STRONGLY discourage use of anything other
than UTF-8, or, rarely, UTF-16.

Another factor to consider is how you're getting access to those
characters. You must do this one of two ways:

1) Using a Reader set to read 8859-1
-or-
2) Using an input stream, giving the raw bytes to the parser, letting
it decode the 8859-1 characters.

You WILL FAIL (and this is probably your problem, would be my guess)
if you try to read using a Reader that's expecting UTF-8.

A stacktrace should show which problem you have.

On Feb 2, 6:42 am, MobDev developm...@mobilaria.com wrote:

 Hi,
 I am downloading a xml-type file from a webserver which starts 

[android-developers] Re: Help needed with parsing some XML data !

2010-02-03 Thread MobDev
well to begin with : thx for the expalanation :D
I was wondering about your statement :
Try logging to a file. Or better yet, create test cases, and verify
the correct operation of your code via test suite, rather than via log
statements. 
I already tried in a test case, which was to write the incoming data
to a AlertDialog, but the result was that those characters are shwon
on-screen with a rectangle with a ? in it... My idea (and test case)
would be to stream a list of countries, and afterwards show this
list onscreen so the user can select one...
Our problem is that the whole system I am using is based on the ISO
norm and cannot be changed to UTF-8 in a short period of time...
Or am I misinterpreting your test cases and test suite ? And if so
how should it have been interpreted ?

On 3 feb, 13:26, Bob Kerns r...@acm.org wrote:
 Well, you found one way to get the encoding in there. A few more:

 InputSource.setEncoding(iso-8859-1)
 new InputStreamReader(stream, iso-8859-1);

 I'd argue that it should have gotten it from the ?xml...
 encoding=iso-8859-1? -- I'm a bit surprised it didn't. But it's
 something I'd never rely on if I know the encoding.

 Anyway, re: your problem below. It's probably working right, up to the
 point of the log statement.

 The log stream is probably taking those bytes, and then later they're
 being interpreted as UTF-8. or it's taking the characters from the
 string, and interpreting them as UTF-8 (via String.getBytes()) and
 passing them off to a log stream that doesn't know about UTF-8.

 Try logging to a file. Or better yet, create test cases, and verify
 the correct operation of your code via test suite, rather than via log
 statements.

 But if you have any control or influence over the server -- fix the
 problem there. ISO-8859-* should be of purely historical interest in
 interpreting old documents. The first draft of ISO-10646 came out
 nearly 20 years ago, and UTF-8 has been around for nearly 18 years.
 The world is international. It's time to put a stake in the heart of
 these national encodings.

 On Feb 3, 2:55 am, MobDev developm...@mobilaria.com wrote:

  Btw I also have tried this instead :

   try {
                  URL url = new URL(http://www.myserver.com/xmlstream;);
                  URLConnection conn = url.openConnection();
              InputStream is = conn.getInputStream();
              Xml.parse(is, Xml.Encoding.ISO_8859_1, new ExampleHandler
  ());
          } catch (Exception e)
          {
              throw new RuntimeException(e);
          }

  This time it wont just crash but for example if I print the output
  (through Log) I get

  Found attribute : Ã…land eilanden
  and
  Found attribute : Albanië instead of Albanié

  So any input on this ?

  On 3 feb, 10:44, MobDev developm...@mobilaria.com wrote:

   Actually this is the code for the second approach :

   /* Create a URL we want to load some xml-data from. */
   URL url = new URL(http://www.myserver.com/xmlstream;);

   /* Get a SAXParser from the SAXPArserFactory. */
   SAXParserFactory spf = SAXParserFactory.newInstance();
   SAXParser sp = spf.newSAXParser();

    /* Get the XMLReader of the SAXParser we created. */
   XMLReader xr = sp.getXMLReader();
    /* Create a new ContentHandler and apply it to the XML-Reader*/
   ExampleHandler myExampleHandler = new ExampleHandler();
   xr.setContentHandler(myExampleHandler);

   /* Parse the xml-data from our URL. */
   xr.parse(new InputSource(url.openStream()));
   /* Parsing has finished. */

   And the error I get is :
   At line 40, column 23: not well-formed (invalid token)

   which is around this XML line :
   Country ID=2 CName=Åland eilanden/

   So where should I specifiy its an ISO-8859-1 ?
   Also I have been debugging the app, but I actually cannot see the
   stacktrace, could you please direct me on how to show it on NetBeans ?
   Every time I try to look at the exception thrown I will see several
   variables but StackTrace will be null...

   On 3 feb, 06:17, Bob Kerns r...@acm.org wrote:

While I would expect your second approach to work, it's important to
note that IT IS NOT REQUIRED TO WORK.

The XML standard does not require XML processors to support anything
other than UTF-8 or UTF-16.

In this day and age, I would STRONGLY discourage use of anything other
than UTF-8, or, rarely, UTF-16.

Another factor to consider is how you're getting access to those
characters. You must do this one of two ways:

1) Using a Reader set to read 8859-1
-or-
2) Using an input stream, giving the raw bytes to the parser, letting
it decode the 8859-1 characters.

You WILL FAIL (and this is probably your problem, would be my guess)
if you try to read using a Reader that's expecting UTF-8.

A stacktrace should show which problem you have.

On Feb 2, 6:42 am, MobDev developm...@mobilaria.com wrote:

 Hi,
 I am downloading a xml-type file from a webserver which starts 

Re: [android-developers] Re: Help needed with parsing some XML data !

2010-02-03 Thread Frank Weiss
Found attribute : Albanië instead of Albanié

This suggests you are displaying UTF-8 text (which is was logcat does) as
Latin-1. To wit: ë = 0xC3 0xAB which are UTF-8 for Latin1 0xEB. However, é
is 0xEB, not 0xAB, so there's something else afoot.

Also note that when you see the rectangle with the ? in it, most likely
means you are trying to read a Latin-1 encoding as UTF-8. For example, 0xEB
by itself is invalid UTF-8. It would require two additional bytes each with
the top two bits of 10.

But good progress, bring on the data to analyze this problem. It would help
if you posted the URL to the XML

-- 
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: Help needed with parsing some XML data !

2010-02-03 Thread Bob Kerns
Yeah, that's not what I mean by a test case.

See http://junit.org as a starting point.
(The Android SDK includes some limited version of JUnit I don't
recognize. It's adequate for this purpose, but the full, modern
version is better. For non-device testing, you're not restricted to
the supplied one.)

Basically, a test case is code that you can run to *automatically*
test some specific aspect of a system. In this case, checking against
a known set of XML (so it doesn't change), looking for the known
desired result, and reporting failures (expected conditions not
matching) and errors (unexpected exceptions thrown).

This removes the variables from the equation. You're not depending on
how things display, either in the UI nor in the log stream and
windows. You're not dependent on a human to notice a problem.

An best of all, you can automate it to always run when you build, so
if you break later, you'll find out right away, while you know what
you changed. And you can make changes freely, with the security of
knowing that you won't have to go through some long test/debug cycle.

I didn't answer your question about getting a stacktrace earlier,
because you said NetBeans. I'm old enough to remember when NetBeans
was the hot new thing -- but too old to remember how to do anything
with it. Try using Eclipse and the ADK. It will show you the stack
trace in the same way it shows any other stack trace, as if you were
debugging locally. (I would expect NetBeans to, as well).

Or you can catch the exception, and use exception.printStackTrace() to
get it into the log (I'm surprised it's not already there).

This isn't really an Android problem, and it's not necessary to debug
it there. If you write your failing test cases, you can debug them on
your desktop computer, get them working, and you should be set to go
on the device.

Another thing to realize is that not all character values you can come
up with, are legal XML content. They *MUST* be valid printing Unicode
characters. No random control characters -- for example, ISO-8859-1
byte values 0-31 (decimal). This will ALWAYS fail -- it is NOT well-
formed XML. If that's the cause of your exceptions, your two choices
would be to fix it on the server (probably by encoding this binary
data) or to preprocess the fake-XML into real XML before you feed it
to the XML parser.

\
On Feb 3, 6:49 am, MobDev developm...@mobilaria.com wrote:
 well to begin with : thx for the expalanation :D
 I was wondering about your statement :
 Try logging to a file. Or better yet, create test cases, and verify
 the correct operation of your code via test suite, rather than via log
 statements. 
 I already tried in a test case, which was to write the incoming data
 to a AlertDialog, but the result was that those characters are shwon
 on-screen with a rectangle with a ? in it... My idea (and test case)
 would be to stream a list of countries, and afterwards show this
 list onscreen so the user can select one...
 Our problem is that the whole system I am using is based on the ISO
 norm and cannot be changed to UTF-8 in a short period of time...
 Or am I misinterpreting your test cases and test suite ? And if so
 how should it have been interpreted ?

 On 3 feb, 13:26, Bob Kerns r...@acm.org wrote:



  Well, you found one way to get the encoding in there. A few more:

  InputSource.setEncoding(iso-8859-1)
  new InputStreamReader(stream, iso-8859-1);

  I'd argue that it should have gotten it from the ?xml...
  encoding=iso-8859-1? -- I'm a bit surprised it didn't. But it's
  something I'd never rely on if I know the encoding.

  Anyway, re: your problem below. It's probably working right, up to the
  point of the log statement.

  The log stream is probably taking those bytes, and then later they're
  being interpreted as UTF-8. or it's taking the characters from the
  string, and interpreting them as UTF-8 (via String.getBytes()) and
  passing them off to a log stream that doesn't know about UTF-8.

  Try logging to a file. Or better yet, create test cases, and verify
  the correct operation of your code via test suite, rather than via log
  statements.

  But if you have any control or influence over the server -- fix the
  problem there. ISO-8859-* should be of purely historical interest in
  interpreting old documents. The first draft of ISO-10646 came out
  nearly 20 years ago, and UTF-8 has been around for nearly 18 years.
  The world is international. It's time to put a stake in the heart of
  these national encodings.

  On Feb 3, 2:55 am, MobDev developm...@mobilaria.com wrote:

   Btw I also have tried this instead :

    try {
                   URL url = new URL(http://www.myserver.com/xmlstream;);
                   URLConnection conn = url.openConnection();
               InputStream is = conn.getInputStream();
               Xml.parse(is, Xml.Encoding.ISO_8859_1, new ExampleHandler
   ());
           } catch (Exception e)
           {
               throw new 

[android-developers] Re: Help needed with parsing some XML data !

2010-02-02 Thread Bob Kerns
While I would expect your second approach to work, it's important to
note that IT IS NOT REQUIRED TO WORK.

The XML standard does not require XML processors to support anything
other than UTF-8 or UTF-16.

In this day and age, I would STRONGLY discourage use of anything other
than UTF-8, or, rarely, UTF-16.

Another factor to consider is how you're getting access to those
characters. You must do this one of two ways:

1) Using a Reader set to read 8859-1
-or-
2) Using an input stream, giving the raw bytes to the parser, letting
it decode the 8859-1 characters.

You WILL FAIL (and this is probably your problem, would be my guess)
if you try to read using a Reader that's expecting UTF-8.

A stacktrace should show which problem you have.

On Feb 2, 6:42 am, MobDev developm...@mobilaria.com wrote:
 Hi,
 I am downloading a xml-type file from a webserver which starts out
 with :

 ?xml version=1.0 encoding=iso-8859-1 ?

 afterwards I get a list with loads of countries, some countries do
 contain some letters like é and á.

 I have tried to extract the data of the xml in two ways :
 1 - simply download the whole thing into a String, which will result
 in those characters being seen as something like [] or on the Android
 emulator (and device) I will see a triangle with a ? in it...

 2 - fetch the list with the SAXParser and XMLReader which will just
 throw an exception telling me that there is some content error...
 specifically at the line where the first country is with such a
 character...

 So is there some way to get this to work ? Can I read the iso-8859-1
 encoded xml into the Parser ? Or is there some way to encode/decode
 the received data into something actually usable ?
 Any idea where the problem might be ?

 Thanks in advance for any hints, tips, code or explanation :D

-- 
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] Re: help needed with project: preview image on a opengl texture

2009-12-14 Thread 李務誠
On Sat, Dec 12, 2009 at 6:28 AM, tdom...@googlemail.com 
tdom...@googlemail.com wrote:

 couldn't fully test if it works.
 but why do I have to call this method, what does it acutally do?

 I though it was needed if you want to directly let the camera draw on
 an surface, like here:

 http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/graphics/CameraPreview.html

 But I want to draw the camera preview on an opengl object, through
 textures, do I really need to do that?

Yes. You still need to do that. If applications do not call
setPreviewDisplay, camera drivers may not start the preview even if
startPreview is called. Ex: the current implementation on Droid.


 On 11 Dez., 23:10, tdom...@googlemail.com tdom...@googlemail.com
 wrote:
  You need to call setPreviewDisplay in surfaceChanged.
 
  ok thanks I will try that later.
 
  And the app shouldn't call setPreviewSize with arbitrary numbers because
 not
  every device support 240x160. Use getPreviewSize in 1.6 or use
  getSupportedPreviewSizes in 2.0.
 
  yeah I was going to do so as soon as I fix this this ugly bug, get an
  RGB image etc .
 
  I wanted to get fast results.
 
  On 11 Dez., 02:59, Wu-cheng Li (李務誠) wuchen...@google.com wrote:
 
   You need to call setPreviewDisplay in surfaceChanged.
 
   And the app shouldn't call setPreviewSize with arbitrary numbers
 because not
   every device support 240x160. Use getPreviewSize in 1.6 or use
   getSupportedPreviewSizes in 2.0.
 
   On Fri, Dec 11, 2009 at 3:47 AM, tdom...@googlemail.com 
 
   tdom...@googlemail.com wrote:
hi,
I'm trying to get the preview images of the android Camera onto a
opengl texture. I have been successful so far, it works most of the
times. Though sometimes I will just get a black screen when starting/
resuming the application. I have been debugging for days, not finding
any clue.
When debugging I noticed that both the camera callback and the
onDrawFrame are called in such situations. the bytearray of the
 camera
does contain data. though nothing is shown.
I would really appreciate if someone could help me with this, cause
problem has been driving me crazy for days.
 
the source can be browsed/checked out here:
   http://code.google.com/p/andar/source/checkout
 
--
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.comandroid-developers%2bunsubscr...@googlegroups.com
 android-developers%2bunsubscr...@googlegroups.comandroid-developers%252bunsubscr...@googlegroups.com
 
For more options, visit this group at
   http://groups.google.com/group/android-developers?hl=en

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


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

[android-developers] Re: help needed with project: preview image on a opengl texture

2009-12-11 Thread tdom...@googlemail.com
You need to call setPreviewDisplay in surfaceChanged.
ok thanks I will try that later.

And the app shouldn't call setPreviewSize with arbitrary numbers because not
every device support 240x160. Use getPreviewSize in 1.6 or use
getSupportedPreviewSizes in 2.0.
yeah I was going to do so as soon as I fix this this ugly bug, get an
RGB image etc .

I wanted to get fast results.

On 11 Dez., 02:59, Wu-cheng Li (李務誠) wuchen...@google.com wrote:
 You need to call setPreviewDisplay in surfaceChanged.

 And the app shouldn't call setPreviewSize with arbitrary numbers because not
 every device support 240x160. Use getPreviewSize in 1.6 or use
 getSupportedPreviewSizes in 2.0.

 On Fri, Dec 11, 2009 at 3:47 AM, tdom...@googlemail.com 

 tdom...@googlemail.com wrote:
  hi,
  I'm trying to get the preview images of the android Camera onto a
  opengl texture. I have been successful so far, it works most of the
  times. Though sometimes I will just get a black screen when starting/
  resuming the application. I have been debugging for days, not finding
  any clue.
  When debugging I noticed that both the camera callback and the
  onDrawFrame are called in such situations. the bytearray of the camera
  does contain data. though nothing is shown.
  I would really appreciate if someone could help me with this, cause
  problem has been driving me crazy for days.

  the source can be browsed/checked out here:
 http://code.google.com/p/andar/source/checkout

  --
  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.comandroid-developers%2bunsubscr...@googlegroups.com
  For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en

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


[android-developers] Re: help needed with project: preview image on a opengl texture

2009-12-11 Thread tdom...@googlemail.com
couldn't fully test if it works.
but why do I have to call this method, what does it acutally do?

I though it was needed if you want to directly let the camera draw on
an surface, like here:
http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/graphics/CameraPreview.html

But I want to draw the camera preview on an opengl object, through
textures, do I really need to do that?

On 11 Dez., 23:10, tdom...@googlemail.com tdom...@googlemail.com
wrote:
 You need to call setPreviewDisplay in surfaceChanged.

 ok thanks I will try that later.

 And the app shouldn't call setPreviewSize with arbitrary numbers because not
 every device support 240x160. Use getPreviewSize in 1.6 or use
 getSupportedPreviewSizes in 2.0.

 yeah I was going to do so as soon as I fix this this ugly bug, get an
 RGB image etc .

 I wanted to get fast results.

 On 11 Dez., 02:59, Wu-cheng Li (李務誠) wuchen...@google.com wrote:

  You need to call setPreviewDisplay in surfaceChanged.

  And the app shouldn't call setPreviewSize with arbitrary numbers because not
  every device support 240x160. Use getPreviewSize in 1.6 or use
  getSupportedPreviewSizes in 2.0.

  On Fri, Dec 11, 2009 at 3:47 AM, tdom...@googlemail.com 

  tdom...@googlemail.com wrote:
   hi,
   I'm trying to get the preview images of the android Camera onto a
   opengl texture. I have been successful so far, it works most of the
   times. Though sometimes I will just get a black screen when starting/
   resuming the application. I have been debugging for days, not finding
   any clue.
   When debugging I noticed that both the camera callback and the
   onDrawFrame are called in such situations. the bytearray of the camera
   does contain data. though nothing is shown.
   I would really appreciate if someone could help me with this, cause
   problem has been driving me crazy for days.

   the source can be browsed/checked out here:
  http://code.google.com/p/andar/source/checkout

   --
   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.comandroid-developers%2bunsubscr...@googlegroups.com
   For more options, visit this group at
  http://groups.google.com/group/android-developers?hl=en

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


[android-developers] Re: help needed with project: preview image on a opengl texture

2009-12-10 Thread tdom...@googlemail.com
I'm using Android 1.6.

where do I get the revision from?

On 10 Dez., 22:00, Stephen @ gmail.com sdickey2...@gmail.com
wrote:
 Could you please answer the following?

 What's your platform? (Eclair/Droid/Donuts/Magic ... etc)
 Also, what revision of the software (e.g. ESD20)?

 Thanks!

 On Thu, Dec 10, 2009 at 11:47 AM, tdom...@googlemail.com 

 tdom...@googlemail.com wrote:
  hi,
  I'm trying to get the preview images of the android Camera onto a
  opengl texture. I have been successful so far, it works most of the
  times. Though sometimes I will just get a black screen when starting/
  resuming the application. I have been debugging for days, not finding
  any clue.
  When debugging I noticed that both the camera callback and the
  onDrawFrame are called in such situations. the bytearray of the camera
  does contain data. though nothing is shown.
  I would really appreciate if someone could help me with this, cause
  problem has been driving me crazy for days.

  the source can be browsed/checked out here:
 http://code.google.com/p/andar/source/checkout

  --
  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.comandroid-developers%2bunsubscr...@googlegroups.com
  For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en

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


Re: [android-developers] Re: help needed with project: preview image on a opengl texture

2009-12-10 Thread Stephen @ gmail.com
On the physical device, in settings-about phone- build_number.,
there's a long description there that more precisely identifies the revision
of software being used.  In the first software revision for Droid, for
example, it will say ESD20 in the midst of that long string.

Also, I'm wondering, is it sufficient to exit the application to restore the
device's normal behavior?

I appreciate the information if you're willing to reply.  Thanks!

Stephen.

On Thu, Dec 10, 2009 at 1:37 PM, tdom...@googlemail.com 
tdom...@googlemail.com wrote:

 I'm using Android 1.6.

 where do I get the revision from?

 On 10 Dez., 22:00, Stephen @ gmail.com sdickey2...@gmail.com
 wrote:
  Could you please answer the following?
 
  What's your platform? (Eclair/Droid/Donuts/Magic ... etc)
  Also, what revision of the software (e.g. ESD20)?
 
  Thanks!
 
  On Thu, Dec 10, 2009 at 11:47 AM, tdom...@googlemail.com 
 
  tdom...@googlemail.com wrote:
   hi,
   I'm trying to get the preview images of the android Camera onto a
   opengl texture. I have been successful so far, it works most of the
   times. Though sometimes I will just get a black screen when starting/
   resuming the application. I have been debugging for days, not finding
   any clue.
   When debugging I noticed that both the camera callback and the
   onDrawFrame are called in such situations. the bytearray of the camera
   does contain data. though nothing is shown.
   I would really appreciate if someone could help me with this, cause
   problem has been driving me crazy for days.
 
   the source can be browsed/checked out here:
  http://code.google.com/p/andar/source/checkout
 
   --
   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.comandroid-developers%2bunsubscr...@googlegroups.com
 android-developers%2bunsubscr...@googlegroups.comandroid-developers%252bunsubscr...@googlegroups.com
 
   For more options, visit this group at
  http://groups.google.com/group/android-developers?hl=en

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


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

[android-developers] Re: help needed with project: preview image on a opengl texture

2009-12-10 Thread tdom...@googlemail.com
The build number is: DRC83
I'm using an T-mobile G1.

Also, I'm wondering, is it sufficient to exit the application to restore the
device's normal behavior?
Exiting the application works fine. If I restart the application
sometimes it will work sometimes not...

On 10 Dez., 22:54, Stephen @ gmail.com sdickey2...@gmail.com
wrote:
 On the physical device, in settings-about phone- build_number.,
 there's a long description there that more precisely identifies the revision
 of software being used.  In the first software revision for Droid, for
 example, it will say ESD20 in the midst of that long string.

 Also, I'm wondering, is it sufficient to exit the application to restore the
 device's normal behavior?

 I appreciate the information if you're willing to reply.  Thanks!

 Stephen.

 On Thu, Dec 10, 2009 at 1:37 PM, tdom...@googlemail.com 

 tdom...@googlemail.com wrote:
  I'm using Android 1.6.

  where do I get the revision from?

  On 10 Dez., 22:00, Stephen @ gmail.com sdickey2...@gmail.com
  wrote:
   Could you please answer the following?

   What's your platform? (Eclair/Droid/Donuts/Magic ... etc)
   Also, what revision of the software (e.g. ESD20)?

   Thanks!

   On Thu, Dec 10, 2009 at 11:47 AM, tdom...@googlemail.com 

   tdom...@googlemail.com wrote:
hi,
I'm trying to get the preview images of the android Camera onto a
opengl texture. I have been successful so far, it works most of the
times. Though sometimes I will just get a black screen when starting/
resuming the application. I have been debugging for days, not finding
any clue.
When debugging I noticed that both the camera callback and the
onDrawFrame are called in such situations. the bytearray of the camera
does contain data. though nothing is shown.
I would really appreciate if someone could help me with this, cause
problem has been driving me crazy for days.

the source can be browsed/checked out here:
   http://code.google.com/p/andar/source/checkout

--
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.comandroid-developers%2bunsubscr...@googlegroups.com
  android-developers%2bunsubscr...@googlegroups.comandroid-developers%252bunsubscr...@googlegroups.com

For more options, visit this group at
   http://groups.google.com/group/android-developers?hl=en

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

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


Re: [android-developers] Re: help needed with project: preview image on a opengl texture

2009-12-10 Thread Stephen @ gmail.com
sorry for the distraction.  I'm definitely not familiar with this issue.

On Thu, Dec 10, 2009 at 2:10 PM, tdom...@googlemail.com 
tdom...@googlemail.com wrote:

 The build number is: DRC83
 I'm using an T-mobile G1.

 Also, I'm wondering, is it sufficient to exit the application to restore
 the
 device's normal behavior?
 Exiting the application works fine. If I restart the application
 sometimes it will work sometimes not...

 On 10 Dez., 22:54, Stephen @ gmail.com sdickey2...@gmail.com
 wrote:
  On the physical device, in settings-about phone- build_number.,
  there's a long description there that more precisely identifies the
 revision
  of software being used.  In the first software revision for Droid, for
  example, it will say ESD20 in the midst of that long string.
 
  Also, I'm wondering, is it sufficient to exit the application to restore
 the
  device's normal behavior?
 
  I appreciate the information if you're willing to reply.  Thanks!
 
  Stephen.
 
  On Thu, Dec 10, 2009 at 1:37 PM, tdom...@googlemail.com 
 
  tdom...@googlemail.com wrote:
   I'm using Android 1.6.
 
   where do I get the revision from?
 
   On 10 Dez., 22:00, Stephen @ gmail.com sdickey2...@gmail.com
   wrote:
Could you please answer the following?
 
What's your platform? (Eclair/Droid/Donuts/Magic ... etc)
Also, what revision of the software (e.g. ESD20)?
 
Thanks!
 
On Thu, Dec 10, 2009 at 11:47 AM, tdom...@googlemail.com 
 
tdom...@googlemail.com wrote:
 hi,
 I'm trying to get the preview images of the android Camera onto a
 opengl texture. I have been successful so far, it works most of the
 times. Though sometimes I will just get a black screen when
 starting/
 resuming the application. I have been debugging for days, not
 finding
 any clue.
 When debugging I noticed that both the camera callback and the
 onDrawFrame are called in such situations. the bytearray of the
 camera
 does contain data. though nothing is shown.
 I would really appreciate if someone could help me with this, cause
 problem has been driving me crazy for days.
 
 the source can be browsed/checked out here:
http://code.google.com/p/andar/source/checkout
 
 --
 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.comandroid-developers%2bunsubscr...@googlegroups.com
 android-developers%2bunsubscr...@googlegroups.comandroid-developers%252bunsubscr...@googlegroups.com
 
   android-developers%2bunsubscr...@googlegroups.comandroid-developers%252bunsubscr...@googlegroups.com
 android-developers%252bunsubscr...@googlegroups.comandroid-developers%25252bunsubscr...@googlegroups.com
 
 
 For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
 
   --
   You received this message because you are subscribed to the Google
   Groups Android Developers group.
   To post to this group, send email to
 android-developers@googlegroups.com
   To unsubscribe from this group, send email to
   android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com
 android-developers%2bunsubscr...@googlegroups.comandroid-developers%252bunsubscr...@googlegroups.com
 
   For more options, visit this group at
  http://groups.google.com/group/android-developers?hl=en

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


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

[android-developers] Re: Help Needed : MediaRecorder error: java.io.IOException: prepare failed

2009-09-08 Thread preetam_pict

i sorry for the cross post but i am stuck ... :(

in error logs i am seeing this  please help me to resolve
this ...!

09-08 12:30:26.174: ERROR/MediaPlayer(554): Unable to to create media
player
09-08 12:30:26.183: ERROR/CameraService(554): Failed to load
CameraService sounds.
09-08 12:30:26.203: ERROR/MediaPlayer(554): Unable to to create media
player
09-08 12:30:26.203: ERROR/CameraService(554): Failed to load
CameraService sounds.

thanks
~pp



On Sep 8, 12:51 pm, preetam_pict preetam.pa...@gmail.com wrote:
 Hi all

 I am trying to write a sample program to record the video (say
 camcorder application).
 When i run my program using the emulator (I have android-sdk-
 windows-1.5_r3) I see java.io.IOException: prepare failed. error in
 logcat output.

 Further I can see that I have came across this error when i call
 MediaRecorder.prepare()
 from CamcorderActivity.surfaceCreated()
 But I am surprised to see that activity got launched and I am seeing
 the camera preview!  Again the preview is seen only in half of the
 screen! Its weird!!!

 Further when i do recorder.start() to record the video I get
 java.lang.IllegalStateException. Yes this is obvious since the prepare
 () has failed.
 But the question is why prepare() has failed ?

 Can someone please help me to understand whats happening here!
 Am i missing something ???

 thanks in advance
 ~pp

 Here is my code ...
 package com.example;

 import java.io.IOException;

 import android.app.Activity;
 import android.graphics.PixelFormat;
 import android.media.MediaRecorder;
 import android.os.Bundle;
 import android.util.Log;
 import android.view.KeyEvent;
 import android.view.SurfaceHolder;
 import android.view.SurfaceView;

 public class CamcorderActivity extends Activity implements
         SurfaceHolder.Callback
 {
     private MediaRecorder recorder;
     private SurfaceView   surfaceView;
     private SurfaceHolder surfaceHolder;

     private boolean       recording = false;

     /** Called when the activity is first created. */
     @Override
     public void onCreate(Bundle savedInstanceState)
     {
         super.onCreate(savedInstanceState);

         // configure the surface
         getWindow().setFormat(PixelFormat.TRANSLUCENT);
         setContentView(R.layout.main);
         surfaceView = (SurfaceView) findViewById(R.id.camcordersurface);
         surfaceHolder = surfaceView.getHolder();
         surfaceHolder.addCallback(this);
         surfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
         configureRecorder();
     }

     private void configureRecorder()
     {
         // configure media recorder
         recorder = new MediaRecorder();
         recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
         recorder.setVideoSource(MediaRecorder.VideoSource.DEFAULT);
         recorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
         recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
         recorder.setVideoEncoder(MediaRecorder.VideoEncoder.MPEG_4_SP);
     }

     private void stopRecorder()
     {
         try
         {
             if (recorder == null)
             {
                 return;
             }
             recorder.stop();
             recorder.reset();
             recorder.release();
             recording = false;
             recorder = null;
         }
         finally
         {
             if (recorder != null)
             {
                 recorder.release();
             }
         }
     }

     private void startRecorder()
     {
         recorder.start();
         recording = true;
     }

     @Override
     public boolean onKeyDown(int keyCode, KeyEvent event)
     {
         if (keyCode == KeyEvent.KEYCODE_DPAD_CENTER)
         {
             // if not recording then start
             if (!recording)
             {
                 startRecorder();
             }
             else
             {
                 // if already recording then stop
                 stopRecorder();
                 finish();
             }
             return true;
         }
         return super.onKeyDown(keyCode, event);
     }

     @Override
     public void surfaceChanged(SurfaceHolder holder, int format, int
 width,
             int height)
     {
         // do nothing
     }

     @Override
     public void surfaceCreated(SurfaceHolder holder)
     {
         recorder.setOutputFile(/sdcard/test + System.currentTimeMillis()
                 + .mp4);
         recorder.setPreviewDisplay(holder.getSurface());
         try
         {
             recorder.prepare();
         }
         catch (IOException e)
         {
             Log.e(error -- , e.toString(), e);
             // TODO:
             // show error message
         }
     }

     @Override
     public void surfaceDestroyed(SurfaceHolder holder)
     {
         stopRecorder();
     }

 }

 And the layout ...

 ?xml version=1.0 encoding=utf-8?
 LinearLayout 

[android-developers] Re: help needed on webservice (ksoap2)

2008-10-17 Thread shailesh prakash

It works fine on mine service using java, hope php has similar
implementation. See this may be error due to some semantic mistake.
also check for wsdl with the browser. Those are some mistake I have
done earlier. But I go with the original j2me jar. On that implement
extra classes of ksoap2-android-full-2.1.2(two class in transport
package), add commons-httpclient-3.1.jar.

Thread t = new Thread()
{
private static final String SOAP_ACTION 
= add;
private static final String METHOD_NAME 
= add;
private static final String NAMESPACE = 
http://wtp.mycomp.com;;
private static final String URL =
http://192.168.1.101:8080/Axis2ServiceServer/services/CalculatorService;;
Integer a = null;
Integer b = null;

@Override
public void run()
{
String stA = ((EditText)
findViewById(R.id.EditText01)).getText().toString();
String stB = ((EditText)
findViewById(R.id.EditText02)).getText().toString();
SoapSerializationEnvelope 
envelope = null;
try
{
a = 
Integer.valueOf(stA);
b = 
Integer.valueOf(stB);
SoapObject request = 
new SoapObject(NAMESPACE,METHOD_NAME);

request.addProperty(a, a);

request.addProperty(b, b);
envelope = new 
SoapSerializationEnvelope(SoapEnvelope.VER11);

envelope.setOutputSoapObject(request);
AndroidHttpTransport 
androidHttpTransport = new
AndroidHttpTransport(URL);

androidHttpTransport.call(SOAP_ACTION, envelope);
Object result = 
envelope.getResponse();
KSoapClient.res = 
result.toString();
}
catch (NumberFormatException 
nfe)
{
KSoapClient.res = Only 
Integer numbers ;
Log.e(Input Error: , 
nfe.getMessage());
}
catch (SoapFault sf)
{
Log.e(Service Response 
Error, + sf.faultcode+:,
sf.faultstring);
}
catch (IOException ioe)
{
Log.e(Service Response 
Error: , ioe.getMessage());
}
catch (XmlPullParserException 
xppe)
{
Log.e(Service Response 
Error: , xppe.getMessage());
}
}
};
t.start();
On Fri, Oct 17, 2008 at 8:57 PM, CJ [EMAIL PROTECTED] wrote:

 Hi, guys
 finally i gave up on trying it by myself. i am dying for help. plz
 thanks
 CJ

 my situation is pretty simple. i have a webservice set up using php
 under apache.

 i have ksoap2-android-full-2.1.2.jar imported in eclipse.

 on android client,
 i have  uses-permission android:name=android.permission.INTERNET /
  in the manifest file
 ?xml version=1.0 encoding=utf-8?
 manifest xmlns:android=http://schemas.android.com/apk/res/android;
  package=com.my.application.stupid.android
  android:versionCode=1
  android:versionName=1.0.0
uses-permission android:name=android.permission.INTERNET /
application android:icon=@drawable/icon android:label=@string/
 app_name
 ..

 in the code, i have
 String SOAP_ACTION = helloWorld;
String METHOD_NAME = sayhi;

[android-developers] Re: help needed on webservice (ksoap2)

2008-10-17 Thread CJ
in wireshark, i did not find any traffic sent out to the service
server. so, my guess is it did not get sent out at all.

On Oct 17, 12:05 pm, shailesh prakash [EMAIL PROTECTED] wrote:
 It works fine on mine service using java, hope php has similar
 implementation. See this may be error due to some semantic mistake.
 also check for wsdl with the browser. Those are some mistake I have
 done earlier. But I go with the original j2me jar. On that implement
 extra classes of ksoap2-android-full-2.1.2(two class in transport
 package), add commons-httpclient-3.1.jar.

 Thread t = new Thread()
                                 {
                                         private static final String 
 SOAP_ACTION = add;
                                         private static final String 
 METHOD_NAME = add;
                                         private static final String NAMESPACE 
 = http://wtp.mycomp.com;;
                                         private static final String URL =
 http://192.168.1.101:8080/Axis2ServiceServer/services/CalculatorService;;
                                         Integer a = null;
                                         Integer b = null;

                                         @Override
                                         public void run()
                                         {
                                                 String stA = ((EditText)
 findViewById(R.id.EditText01)).getText().toString();
                                                 String stB = ((EditText)
 findViewById(R.id.EditText02)).getText().toString();
                                                 SoapSerializationEnvelope 
 envelope = null;
                                                 try
                                                 {
                                                         a = 
 Integer.valueOf(stA);
                                                         b = 
 Integer.valueOf(stB);
                                                         SoapObject request = 
 new SoapObject(NAMESPACE,METHOD_NAME);
                                                         
 request.addProperty(a, a);
                                                         
 request.addProperty(b, b);
                                                         envelope = new 
 SoapSerializationEnvelope(SoapEnvelope.VER11);
                                                         
 envelope.setOutputSoapObject(request);
                                                         AndroidHttpTransport 
 androidHttpTransport = new
 AndroidHttpTransport(URL);
                                                         
 androidHttpTransport.call(SOAP_ACTION, envelope);
                                                         Object result = 
 envelope.getResponse();
                                                         KSoapClient.res = 
 result.toString();
                                                 }
                                                 catch (NumberFormatException 
 nfe)
                                                 {
                                                         KSoapClient.res = 
 Only Integer numbers ;
                                                         Log.e(Input Error: 
 , nfe.getMessage());
                                                 }
                                                 catch (SoapFault sf)
                                                 {
                                                         Log.e(Service 
 Response Error, + sf.faultcode+:,
 sf.faultstring);
                                                 }
                                                 catch (IOException ioe)
                                                 {
                                                         Log.e(Service 
 Response Error: , ioe.getMessage());
                                                 }
                                                 catch (XmlPullParserException 
 xppe)
                                                 {
                                                         Log.e(Service 
 Response Error: , xppe.getMessage());
                                                 }
                                         }
                                 };
                                 t.start();



 On Fri, Oct 17, 2008 at 8:57 PM, CJ [EMAIL PROTECTED] wrote:

  Hi, guys
  finally i gave up on trying it by myself. i amdyingfor help. plz
  thanks
  CJ

  my situation is pretty simple. i have a webservice set up using php
  under apache.

  i have ksoap2-android-full-2.1.2.jar imported in eclipse.

  on android client,
  i have  uses-permission android:name=android.permission.INTERNET /
       in the manifest file
  ?xml version=1.0 encoding=utf-8?
  manifest xmlns:android=http://schemas.android.com/apk/res/android;
       package=com.my.application.stupid.android
       android:versionCode=1
       android:versionName=1.0.0