Friday, February 22, 2013

AVD Configuration

Device
Version
Resolution
RAM
LCD Density
Hardware Back/Home
Nexus
Galaxy Nexus
17 (4.2.1)
720x1280
1024
316
no
Nexus S
16 (4.1.2)
480x800
512
233
yes
Nexus 7
17 (Google APIs)
800x1280
1024
216
no
Nexus 4
17 (Google APIs)
768x1280
2048
320
no
Nexus 10
17 (Google APIs)
2560x1600
2048
300
no
Galaxy
Galaxy S2
15 (4.0.4)
480x800
1024
218
yes
Galaxy S3
16 (4.1.2)
720x1280
1024
306
yes

Saturday, December 29, 2012

Disable Android Browser Zoom Function

<meta content='True' name='HandheldFriendly' />
<meta content='width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;' name='viewport' />
<meta name="viewport" content="width=device-width" />


OR


<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />

Wednesday, November 14, 2012

Run .APK File On Android Emulator


1.     Go to sdk/platform-tools with the command cd /home/android-sdk/platform-tools you should copy the .apk you want to install in this directory and add the path of it to environment variable in variable PATH "you might need restart"
2.     List the devices with the command ./adb devices
3.     You can install your file with ./adb install .filename.apk

Example for step 2 :
./adb devices
     List of devices attached
     emulator-5554    device
Example for step 3 :
./adb install AndWebServiceTest.apk

Wednesday, October 17, 2012

Android SOAP Service Caller Class


public class UserLoginService {

      
       private static String METHOD_NAME = "method name";
       private static String URL = "service url";

       public UserLoginBean LoginMe(UserLoginBean bean) {

              final String svalue = "bean";

              SoapObject requestObject = new SoapObject(AppConst.NAMESPACE, METHOD_NAME);

              requestObject.addProperty(svalue, bean);

              final SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
                           SoapEnvelope.VER11);
              envelope.dotNet = true;

              envelope.setOutputSoapObject(requestObject);

              envelope.addMapping(AppConst.NAMESPACE,
                           UserLoginBean.UserLoginBean_CLASS.getSimpleName(),
                           UserLoginBean.UserLoginBean_CLASS);

              final Object response = new ServiceCaller().call(AppConst.SOAP_ACTION
                           + METHOD_NAME, envelope, URL);

              if (response != null) {
                     try {
                           if (response != null) {
                                  bean = new UserLoginBean((SoapObject) response);
                           }
                     } catch (Exception e) {
                           e.printStackTrace();
                     }
              }

              return bean;
       }

}

SOAP Request Bean Designing with implements KvmSerializable


import java.util.Hashtable;

import org.ksoap2.serialization.KvmSerializable;
import org.ksoap2.serialization.PropertyInfo;
import org.ksoap2.serialization.SoapObject;

public class UserLoginBean implements KvmSerializable {

       public static Class UserLoginBean_CLASS = UserLoginBean.class;

       private String UserName;
       private String Password;
       private String Status;

       public UserLoginBean() {
       }

       public UserLoginBean(SoapObject response) {
              this.UserName = response.getProperty("UserName").toString();
              this.Password = response.getProperty("Password").toString();
              this.Status = response.getProperty("Status").toString();
       }

       public String getUserName() {
              return UserName;
       }

       public void setUserName(String userName) {
              UserName = userName;
       }

      
       public String getPassword() {
              return Password;
       }

       public void setPassword(String password) {
              Password = password;
       }

      
       public String getStatus() {
              return Status;
       }

       public void setStatus(String status) {
              Status = status;
       }

       @Override
       public Object getProperty(int index) {
              Object object = null;
              switch (index) {
              case 0:
                     object = this.UserName;
              case 1:
                     object = this.Password;
                     break;
              case 2:
                     object = this.Status;
                     break;
              }
              return object;
       }

       @Override
       public int getPropertyCount() {
              return 3;
       }

       @Override
       public void getPropertyInfo(int index, Hashtable arg1,
                     PropertyInfo propertyInfo) {
              switch (index) {
              case 0:
                     propertyInfo.name = "UserName";
                     propertyInfo.type = PropertyInfo.STRING_CLASS;
                     break;
             
              case 1:
                     propertyInfo.name = "Password";
                     propertyInfo.type = PropertyInfo.STRING_CLASS;
                     break;
             
              case 2:
                     propertyInfo.name = "Status";
                     propertyInfo.type = PropertyInfo.STRING_CLASS;
                     break;
              }

       }

       @Override
       public void setProperty(int index, Object object) {

              switch (index) {
              case 0:
                     this.UserName = object.toString();
                     break;
             
              case 1:
                     this.Password = object.toString();
                     break;
             
              case 2:
                     this.Status = object.toString();
                     break;
              }
       }

}

SOAP Service Caller Method Which will return Response as OBJECT




public Object call(String soapAction, SoapSerializationEnvelope envelope,
                     String URL) {

              Object result = null;

              Marshal dateMarshal = new MarshalDate();
              dateMarshal.register(envelope);
              Marshal floatMarshal = new MarshalFloat();
              floatMarshal.register(envelope);

              final HttpTransportSE transportSE = new HttpTransportSE(URL);

              transportSE.debug = false;

              try {
                     transportSE.call(soapAction, envelope);
                     if (!isResultVector) {
                           result = envelope.getResponse();
                     } else {
                           result = envelope.bodyIn;
                     }
              } catch (final IOException e) {
                     e.printStackTrace();
              } catch (final XmlPullParserException e) {
                     e.printStackTrace();
              } catch (final Exception e) {
                     e.printStackTrace();
              }
              return result;
       }

Android Keyboard Setup AVD


Android Keyboard Setup AVD

In Eclipse

Window - > AVD Manager - > Android Virtual Device Manager ( Select AVD Name) - > Edit - > New - > (ADD) Keyboard Setup ('Yes').


Restart AVD