on 06-25-2015 10:24 AM
Hello Experts,
I want to call google map on agentry client for that I generate one new class i.e. ZDisplay and extend it by ExternalDataDisplayAdapter.
Here is my Code :
package com.sap.mobile.platform.client.openui.extensions;
import android.content.Context;
import android.view.View;
import android.webkit.WebView;
import android.widget.LinearLayout;
import com.sap.mobile.platform.client.openui.adapters.ExternalDataDisplayAdapter;
import com.sap.mobile.platform.client.openui.models.ExternalDataDisplayModel;
public class ZDisplay extends ExternalDataDisplayAdapter {
ExternalDataDisplayModel _model;
Context _context;
@Override
public void initialize(ExternalDataDisplayModel model, Context context) {
// TODO Auto-generated method stub
System.out.println("In initialize1");
_model = model;
_context = context;
System.out.println("In initialize");
}
@Override
public View getView() {
System.out.println("In getView");
WebView webview = null;
if (_context != null) {
LinearLayout ll = new LinearLayout(_context);
ll.setOrientation(LinearLayout.VERTICAL);
webview = new WebView(_context);
webview.loadUrl("http://google.com/");
// WebView browser = null;
// browser.loadUrl("https://www.google.co.in/");
}
return webview;
}
}
Also I add my class name in Agentry and take External field as a value. But I got blank screen even don't get print statements in logcat.also I add Toast there but nothing display on screen.I think that the control not get into my class that's why not a single print statement couldn't display.
But why I cant get the error so I am unable to findout the solution.Is there anyone face the same issue or have the solution for the same.
Regards
Prajakta
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hello Prajakta
add this code in your class :
public View getView() {
// TODO Auto-generated method stub
LayoutParams params = new LayoutParams(1000, 1000);
FrameLayout frame = new FrameLayout(_context);
frame.setLayoutParams(params);
web = new WebView(_context);
web.setWebViewClient(new WebViewClient());
web.setMinimumHeight(1000);
web.setMinimumWidth(1000);
web.getSettings().setJavaScriptEnabled(true);
web.loadUrl("http://maps.google.com/maps?");
frame.addView(web);
return frame;
}
Regards,
Hitesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Hitesh,
I tried your code but still my problem is as it is, that control can not get into my class.
In agentry side I do this,
I create simply one field and in external field added class name of our adapter class, is it sufficient to call our class.or any other things have to be add to detect adapter class.
Thanks & Regards
Prajakta
The class type simply links the type of data being exposed from Agentry. ONce the Open UI code is invoked you can display anything you want.
For example, the ESRI Open UI control extends from a List View control so that the collection of obejcts is exposed through Open UI in one case and uses a extends from String field in another case. Both classes display an ESRI map on the device but start with different Agentry field types.
You could just as easily extend from a String field where the contents of the string is the URL you want to display in the Open UI control.
--Bill
Hello Hitesh,
I tried with the External Data edit type, but it is agentry Browse button and not opening the google page as URL given in getView method of OpenUI.
Hello Bill,
I tried with the String edit type but it is not invoking the adapter class and the screen on device is coming with gray color.
Regards,
Prajakta
I tested using the StringDisplayAdapter and the following code. It works as expected in my Agentry project.
package com.sap.mobile.platform.client.openui.extensions;
import com.sap.mobile.platform.client.openui.adapters.StringDisplayAdapter;
import com.sap.mobile.platform.client.openui.models.StringDisplayModel;
import android.app.ActionBar.LayoutParams;
import android.content.Context;
import android.util.Log;
import android.view.View;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.FrameLayout;
import android.widget.Toast;
public class ZDisplay extends StringDisplayAdapter {
StringDisplayModel _model;
Context _context;
@Override
public void initialize(StringDisplayModel model, Context context) {
//Toast.makeText(_context.getApplicationContext(), "Open UI Initialize", Toast.LENGTH_SHORT).show();
Log.i("ZDisplay","Open UI Initialize");
_model= model;
_context= context;
}
@Override
public View getView() {
//Toast.makeText(_context.getApplicationContext(), "Get View", Toast.LENGTH_SHORT).show();
Log.i("ZDisplay","Get View");
Toast.makeText(_context.getApplicationContext(), "getView", Toast.LENGTH_SHORT).show();
LayoutParams params = new LayoutParams(1000, 1000);
FrameLayout frame = new FrameLayout(_context);
frame.setLayoutParams(params);
WebView web = new WebView(_context);
web.setWebViewClient(new WebViewClient());
web.setMinimumHeight(1000);
web.setMinimumWidth(1000);
web.getSettings().setJavaScriptEnabled(true);
web.loadUrl("http://maps.google.com/maps?");
frame.addView(web);
return frame;
// TODO Auto-generated method stub
//return null;
}
@Override
public boolean isAgentryDisplayingLabel()
{
return true;
}
}
My Agentry control is as follows
--Bill
User | Count |
---|---|
85 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.