Skip to Content
0
Former Member
Dec 21, 2015 at 12:17 PM

Class is not getting call from AgentryAndroidClientSolution for open UI change

26 Views

Hello Experts,

I am trying to Disable Seconds Field in Time Format using Android Open UI concept for Agentry.

what I have done is --

1. I created the class MyDateTimeDisplayAdapter under the Package com.sap.mobile.platform.client.openui.extensions under Project AgentryAndroidClientSolutions.I have run this project as an APK file in my Android Mobile. The code forMyDateTimeDisplayAdapter class I took from Sample Open UI project(which comes with SDK). As the code says, it will only display Hour and minutes in Time and Seconds field should be disable. But I am not getting the Seconds Field Disable.

2. 2nd thing which I have done is, In External Field I put the class nameMyDateTimeDisplayAdapter under DocumentDate Feild under PhysicalInventoryDocumentAdd screen. And Publish this Changes.


The MyDateTimeDisplayAdapter class is as mentioned below-

/*

* (c) 2014 SAP AG or an SAP affiliate company. All rights reserved.

* No part of this publication may be reproduced or transmitted in any form or for any purpose without the express

* permission of SAP AG. The information contained herein may be changed without prior notice.

*/

package com.sap.mobile.platform.client.openui.extensions;

import java.text.SimpleDateFormat;

import java.util.GregorianCalendar;

import android.content.Context;

import android.graphics.Color;

import android.view.Gravity;

import android.view.View;

import android.widget.TextView;

import com.sap.mobile.platform.client.openui.adapters.DateAndTimeDisplayAdapter;

import com.sap.mobile.platform.client.openui.models.DateAndTimeDisplayModel;

public class MyDateTimeDisplayAdapter extends DateAndTimeDisplayAdapter

{

/** Core model */

DateAndTimeDisplayModel _model;

/** App context */

Context _context;

/** Text view */

TextView _textView;

@Override

public void initialize(DateAndTimeDisplayModel model, Context context)

{

_model = model;

_context = context;

}

/*

* (non-Javadoc)

*

* @see com.sap.mobile.platform.client.openui.adapters.FieldAdapter#getView()

*/

@Override

public View getView()

{

_textView = new TextView(_context);

SimpleDateFormat df = new SimpleDateFormat();

df.applyPattern("dd/MM/yyyy h:mm a");

GregorianCalendar date = _model.getValue();

_textView.setText(df.format(date.getTime()));

_textView.setBackgroundColor(Color.LTGRAY);

_textView.setGravity(Gravity.CENTER_VERTICAL);

return _textView;

}

@Override

public void valueChanged(GregorianCalendar value)

{

SimpleDateFormat df = new SimpleDateFormat();

df.applyPattern("dd/MM/yyyy h:mm a");

_textView.setText(df.format(value.getTime()));

}

@Override

public boolean isAgentryDisplayingLabel()

{

return true;

}

}


The main issue, what I am seeing is this class is not getting call.


should I have to do some addition changes from Agentry side.

only I defined the External Field Class name. But there are 3 more values which are -

1. External Value

2. Agentry Value

3. Actions


I dont have any idea about these value. I kept these value as blank. Do I need to add something here.