[android-developers] Sending nested xml request using ksoap2

2011-10-04 Thread sandeep agrawal
Hi i am working on some soap request from android using ksoap2


following is my request xml


soapenv:Envelope xmlns:soapenv=http://schemas.xmlsoap.org/soap/
envelope/ xmlns:ns=http://dk.logica.ws/ehb/2010/01;
   soapenv:Header/
   soapenv:Body
  ns:saveData
 data
personId3/personId
creatorId3/creatorId
created2011-09-26T11:09:43.501/created
typeVITAL_SIGNS/type
statusDRAFT/status
fromDate2011-09-06T11:09:43.501/fromDate
toDate2011-09-26T11:09:43.501/toDate

dataItems
   item
  typeunit/type
  valuemg/value
   /item
   item
  typetype/type
  value09/value
   /item
   item
  typereading_interval/type
  value2/value
   /item
   item
  typetest_start_time/type
  value2011-09-26T11:09:43.501/value
   /item
   item
  typetest_end_time/type
  value2011-09-26T11:10:30.501/value
   /item
   item
  typeglucose/type
  value110/value
   /item
   item
  typepulserate/type
  value75:78:75:80:85/value
   /item
/dataItems
 /data
  /ns:saveData
   /soapenv:Body
/soapenv:Envelope




and my wsdl file is

just to show variable type is

definitions name=EhbService targetNamespace=http://dk.logica.ws/
ehb/2010/01typesxs:schema targetNamespace=http://dk.logica.ws/
ehb/2010/01 version=1.0xs:complexType
name=dataxs:sequencexs:element minOccurs=0 name=id
type=xs:long/xs:element minOccurs=0 name=personId
type=xs:long/xs:element minOccurs=0 name=creatorId
type=xs:long/xs:element minOccurs=0 name=created
type=xs:dateTime/xs:element minOccurs=0 name=type
type=xs:string/xs:element minOccurs=0 name=status
type=xs:string/xs:element minOccurs=0 name=fromDate
type=xs:dateTime/xs:element minOccurs=0 name=toDate
type=xs:dateTime/xs:element minOccurs=0
name=dataItemsxs:complexType



and i am sending my request like this

 PropertyInfo pi = new PropertyInfo();
   pi.setName(data);

   PropertyInfo dataitem = new PropertyInfo();
   dataitem.setName(dataitems);



   PropertyInfo item = new PropertyInfo();
   item.setName(item);
   item.setValue(new SoapObject(NAMESPACE, METHOD_NAME)
   .addProperty(type, typetype)
   .addProperty(value, typeValue));

//  PropertyInfo item1 = new PropertyInfo();
//   item.setName(item);
//   item.setValue(new SoapObject(NAMESPACE, METHOD_NAME)
//   .addProperty(type, unittype)
//   .addProperty(value, unitvalue));

   dataitem.setValue(new SoapObject(NAMESPACE, METHOD_NAME)
   .addProperty(item)


   );




   pi.setValue(new SoapObject(NAMESPACE,METHOD_NAME)
 .addProperty(personId,personid)
 .addProperty(creatorId,creatorId)
 .addProperty(created,created)
 .addProperty(type, type)
 .addProperty(status, draft)
 .addProperty(fromDate, fromDate)
 .addProperty(toDate, toDate)
 .addProperty(dataitem)
 );

i am getting exception null pointer


What should i do  can one help me 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] android Detect shapes drawn by orientation sensor

2011-08-01 Thread sandeep agrawal
I am developing one  android application in which i can draw any shape
using orientation sensor i.e. by moving my phone. Can you all please
suggest me any api or algorithms for shape detection like if i draw a
line it should pop up  this is a line  , if i draw a rectangle 
this is a rectangle .

-- 
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] Converting accelerometer values into screen cordinates

2011-07-21 Thread sandeep agrawal
Hi All,

I am developing one application in which i want to paint using
accelerometer sensor, this is my code,

this is my drawmainactivity


package com.drawline;

import android.app.Activity;
import android.os.Bundle;
import android.view.Window;
import android.view.WindowManager;

public class DrawMainActivity extends Activity {

DrawlineActivity drawView;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);

// Set full screen view
 
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
 
WindowManager.LayoutParams.FLAG_FULLSCREEN);
requestWindowFeature(Window.FEATURE_NO_TITLE);

drawView = new DrawlineActivity(this);
setContentView(drawView);
drawView.requestFocus();
}




}


This is the code in which i am trying to paint

package com.drawline;

import java.util.ArrayList;
import java.util.List;

import android.app.Activity;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.drawable.shapes.ArcShape;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import android.os.Bundle;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;
import android.widget.LinearLayout;

public class DrawlineActivity extends View implements
SensorEventListener {
private static final String TAG = DrawView;
float startx=40,starty=40,oldx,oldy,x,y;
ListPoint points = new ArrayListPoint();
Paint paint = new Paint();
SensorManager mSensorManager;
public DrawlineActivity(Context context) {
super(context);
setFocusable(true);
setFocusableInTouchMode(true);

mSensorManager =
(SensorManager)context.getSystemService(context.SENSOR_SERVICE);
mSensorManager.registerListener(this,
 
mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER),
   SensorManager.SENSOR_DELAY_NORMAL);
paint.setColor(Color.WHITE);
paint.setAntiAlias(true);
}

@Override
public void onDraw(Canvas canvas) {
for (Point point : points) {
canvas.drawCircle(point.x+100,  point.y +100, 5, paint);


//canvas.drawLine(startx,starty, startx,starty, paint);
// Log.d(TAG, Painting: +point);
Log.d(SANDEEP, Inside ondraw  + point.x+ point.y);
}
}

//public boolean onTouch(View view, MotionEvent event) {
//// if(event.getAction() != MotionEvent.ACTION_DOWN)
//// return super.onTouchEvent(event);
//Point point = new Point();
//point.x = event.getX();
//point.y = event.getY();
//points.add(point);
//invalidate();
//Log.d(TAG, point:  + point);
//return true;
//}

@Override
public void onAccuracyChanged(Sensor sensor, int accuracy) {
// TODO Auto-generated method stub

}

@Override
public void onSensorChanged(SensorEvent event) {
// TODO Auto-generated method stub
Point point = new Point();

point.x= event.values[0] *5;
point.y  = event.values[1]*5;


 //   point.x=(int) (x + point.x);
   //  point.y= (int) (y+ point.y);
points.add(point);
invalidate();
Log.d(TAG, point:  + startx + starty);
  //  startx= startx + oldx;
  //  starty = starty + oldy;
oldx = startx;
oldy = starty ;
}
}


class Point {
float x=40, y=40;

@Override
public String toString() {
return x + ,  + y;
}
}

Can anyone of you please correct it what i am doing wrong.

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