Been searching for ages and can't find something that explains why this is happening.
I am trying to add a MapField to my application, but when it loads it just says No Data.
MapField mMapField;
Coordinates mCoordinates;
mCoordinates = new Coordinates(28.135085, -25.900461, 0);
mMapField = new MapField();
mMapField.moveTo(mCoordinates);
mMapField.setZoom(3);
add(mMapField);
BB Maps works on my device and Simulator, but this MapField works on neither the simulator or the actual device, I have a BIS data plan on the device.
Any help will be appriciated.
Thanks
The code that I use, which works on both the simulator and the device is:
MapField _map = new MapField();
Coordinates _location = new Coordinates(45.0, -75.0, 0);
_map.moveTo(_location);
_map.setZoom(6);
add(_map);
So perhpas you should use:
MapField mMapField;
Coordinates mCoordinates;
mCoordinates = new Coordinates( -25.900461, 28.135085, 0);
mMapField = new MapField();
mMapField.moveTo(mCoordinates);
add(mMapField);
Related
I designed a xamarin forms app working practically only on android to implement renderer and other more specific objects, now I have to bring the iOS part to par, the problem arises with the renderers since I have to "translate" the code from android to iOS.
I share below a renderes that I have no idea how to translate a few lines, if you can translate it you would do me a big favor, thanks.
public void SetAppearance(BottomNavigationView bottomView, IShellAppearanceElement appearance)
{
bottomView.ItemIconTintList = default;
int[][] states = new int[][]
{
new int[]{-Attribute.StateChecked}, // unchecked
new int[]{Attribute.StateChecked}, // checked
};
int[] colors = new int[]{
Xamarin.Forms.Color.FromHex("#0D5EB4").ToAndroid(),
Xamarin.Forms.Color.FromHex("#0D5EB4").ToAndroid(),
};
ColorStateList navigationViewColorStateList = new ColorStateList(states, colors);
//bottomView.ItemIconTintList = navigationViewColorStateList;
bottomView.ItemTextColor = navigationViewColorStateList;
This is my class for Android
I have scenario in my project where I need to perform zoom in action Android Mobile web using Appium automation. I have used the following method.
try {
Dimension size = driver.manage().window().getSize();
int x0 = (int) (size.getWidth()*0.5);
int y0 = (int) (size.getHeight()*0.5);
System.out.println(x0+" "+y0);
driver.zoom(100, 500);
reportStep("The Application is zoomed.", "PASS");
} catch (Exception e) {
e.printStackTrace();
reportStep("The Application could not be zoomed.", "FAIL");
}
But this method working fine in Mobile apps and not working in Mobile web.
Are there any specific method or alternate work around to handle the Mobile web zoom?
I am using Appium Java-client version 5.0.4 and Selenium version 3.6.0.
Zoom and Pinch methods are not available in the latest version.
There are not many examples out there without zoom method, but using MultiTouchAction class in conjunction with TouchAction class should work as shown here. Note that using moveTo with WebElement and offset x,y coordinates instead of absolute is advised in that thread.
driver = new AndroidDriver(new URL(nodeURL), capability);
TouchAction touchAction = new TouchAction(driver);
MultiTouchAction multiTouchAction = new MultiTouchAction(driver);
WebElement search = (WebElement) driver.findElement(MobileBy.AndroidUIAutomator("new UiSelector().resourceId(\"com.google.android.apps.maps:id/search_omnibox_container\")"));
touchAction .tap(search).perform();
int leftX = search.getLocation().getX();
int rightX = search.getSize().getWidth() + leftX;
int upperY = search.getLocation().getY();
int lowerY = search.getSize().getHeight() + upperY;
a1 = touchAction.press(search,x1,y1).waitAction(2000).moveTo(search,x3,y1).release();
a2 = touchAction.press(search,x2,y1).waitAction(2000).moveTo(search,x4,y1).release();
multiTouchAction.add(a1).add(a2).perform();
Also, look here for appium MultiTouch and here for passing offset x,y co-ordinates to moveTo
I want to set the Background of HorizontalFieldManager.
The sample code I've been searching is setting the background using Gradient for the main screen background.
//create gradient linear for background
this.getMainManager().setBackground(BackgroundFactory.createLinearGradientBackground(0x0099CCFF,
0x0099CCFF,0x00336699,0x00336699)
);
Then I try to use the same pattern to set background to HorizontalFieldManager, since it have this method. But it won't work. Here's the code
HorizontalFieldManager hManager = new HorizontalFieldManager();
Bitmap bitmapImage = null;
bitmapImage = Bitmap.getBitmapResource("img/home.png");
tabHome = new BitmapField(bitmapImage, BitmapField.FOCUSABLE
| BitmapField.HIGHLIGHT_FOCUS);
bitmapImage = Bitmap.getBitmapResource("img/in.png");
tabCheckInOut = new BitmapField(bitmapImage, BitmapField.FOCUSABLE
| BitmapField.HIGHLIGHT_FOCUS);
bitmapImage = Bitmap.getBitmapResource("img/barcode.png");
tabBarcode = new BitmapField(bitmapImage, BitmapField.FOCUSABLE
| BitmapField.HIGHLIGHT_FOCUS);
bitmapImage = Bitmap.getBitmapResource("img/options.png");
tabOptions = new BitmapField(bitmapImage, BitmapField.FOCUSABLE
| BitmapField.HIGHLIGHT_FOCUS);
tabHome.setFocusListener(this);
tabCheckInOut.setFocusListener(this);
tabBarcode.setFocusListener(this);
tabOptions.setFocusListener(this);
Background topBack = BackgroundFactory.createSolidBackground(0x00606A85);
hManager.setBackground(topBack);
hManager.add(tabHome);
hManager.add(tabCheckInOut);
hManager.add(tabBarcode);
hManager.add(tabOptions);
add(hManager);
I'm using HorizontalFieldManager and add 4 BitmapField, then I using BackgroundFactory to create solidBackground, and set it to the manager
but when I run it, the background color does not apply. The gradient example work well. Is there anything that I'm missing? Please help me.
Thanks
After doing some deep web search. Here's the answer guys
HorizontalFieldManager manager = new HorizontalFieldManager()
{
public void paint(Graphics graphics)
{
graphics.setBackgroundColor(0x000000FF);//blue
graphics.clear();
super.paint(graphics);
}
};
UPDATE:
You must only use Web Color
such as 0x006699FF should work
but 0x00606A85 would not work.
if you want a specific color, i recommend you using bitmap.
UPDATE:
Another solution
HorizontalFieldManager manager = new HorizontalFieldManager(Field.USE_ALL_WIDTH);
manager.setBackground(BackgroundFactory.BackgroundFactory
.createSolidBackground(0x00cccccc));
I used this link for showing more location but when I scroll the map, then marker does not scroll, i.e. the position is static. Please help me.
Use this:
map = new MapField(){
public void paint(Graphics g){
super.paint(g);
for(int i=0;i<=_longitude.size()-1;i++){
Coordinates coords = getCoordinates();
coords.setLatitude(Double.parseDouble((String) _latitude.elementsAt(i));
coords.setLongitude(Double.parseDouble((String) _longitude.elementsAt(i));
convertWorldToField(coords,_xypoint);
g.drawBitmap(_xypoint.x,_xypoint.y,_loc.getWidth(),_loc.getHeight(),_loc, 0, 0);
}
}
Note: _latitude and _longitude are the vectors containing respective values , this will make the markers that are not static.
So I have a XNA application set up. The camera is in first person mode, and the user can move around using the keyboard and reposition the camera target with the mouse. I have been able to load 3D models fine, and they appear on screen no problem. Whenever I try to draw any primitive (textured or not), it does not show up anywhere on the screen, no matter how I position the camera.
In Initialize(), I have:
quad = new Quad(Vector3.Zero, Vector3.UnitZ, Vector3.Up, 2, 2);
quadVertexDecl = new VertexDeclaration(this.GraphicsDevice, VertexPositionNormalTexture.VertexElements);
In LoadContent(), I have:
quadTexture = Content.Load<Texture2D>(#"Textures\brickWall");
quadEffect = new BasicEffect(this.GraphicsDevice, null);
quadEffect.AmbientLightColor = new Vector3(0.8f, 0.8f, 0.8f);
quadEffect.LightingEnabled = true;
quadEffect.World = Matrix.Identity;
quadEffect.View = Matrix.CreateLookAt(cameraPosition, cameraTarget, Vector3.Up);
quadEffect.Projection = this.Projection;
quadEffect.TextureEnabled = true;
quadEffect.Texture = quadTexture;
And in Draw() I have:
this.GraphicsDevice.VertexDeclaration = quadVertexDecl;
quadEffect.Begin();
foreach (EffectPass pass in quadEffect.CurrentTechnique.Passes)
{
pass.Begin();
GraphicsDevice.DrawUserIndexedPrimitives<VertexPositionNormalTexture>(
PrimitiveType.TriangleList,
quad.Vertices, 0, 4,
quad.Indexes, 0, 2);
pass.End();
}
quadEffect.End();
I think I'm doing something wrong in the quadEffect properties, but I'm not quite sure what.
I can't run this code on the computer here at work as I don't have game studio installed. But for reference, check out the 3D audio sample on the creator's club website. They have a "QuadDrawer" in that project which demonstrates how to draw a textured quad in any position in the world. It's a pretty nice solution for what it seems you want to do :-)
http://creators.xna.com/en-US/sample/3daudio