Sample code for 30+ languages & platforms
Android™

Get a Piece of Information from the LastErrorXml

Demonstrates how to get a bit of information from the LastErrorXml. Suppose you call ftp.DeleteRemoteFile and it fails, and the LastErrorXml property contains the XML as shown below. This example gets the content in the "statusCode" tag.
<ChilkatLog>
  <DeleteRemoteFile>
    <DllDate>Dec 30 2015</DllDate>
    <ChilkatVersion>9.5.0.55</ChilkatVersion>
    <UnlockPrefix>xxx</UnlockPrefix>
    <Username>CHILKAT:Matt</Username>
    <Architecture>Little Endian; 32-bit</Architecture>
    <Language>Visual C++ 11.0 (32-bit)</Language>
    <VerboseLogging>0</VerboseLogging>
    <filename>[does_not_exist.txt]</filename>
    <deleteFile>
      <simplePathCommand>
        <simpleCommand>
          <sendCommand>
            <sendingCommand>DELE does_not_exist.txt</sendingCommand>
          </sendCommand>
          <readCommandResponse>
            <replyLineQP>550 Delete operation failed.</replyLineQP>
          </readCommandResponse>
        </simpleCommand>
        <error>Simple path command failed.</error>
        <statusCode>550</statusCode>
        <reply>550 Delete operation failed.</reply>
      </simplePathCommand>
    </deleteFile>
    <error>Failed.</error>
  </DeleteRemoteFile>
</ChilkatLog>

Chilkat Android™ Downloads

Android™
// Important: Don't forget to include the call to System.loadLibrary
// as shown at the bottom of this code sample.
package com.test;

import android.app.Activity;
import com.chilkatsoft.*;

import android.widget.TextView;
import android.os.Bundle;

public class SimpleActivity extends Activity {

  private static final String TAG = "Chilkat";

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

    //  This example assumes the Chilkat API to have been previously unlocked.
    //  See Global Unlock Sample for sample code.

  }

  static {
      System.loadLibrary("chilkat");

      // Note: If the incorrect library name is passed to System.loadLibrary,
      // then you will see the following error message at application startup:
      //"The application <your-application-name> has stopped unexpectedly. Please try again."
  }
}