我正在尝试在iOS上创建自定义相机体验,以下代码片段就是我所知道的.基本上我想要通常的相机视图(即使用以下按钮:捕捉,闪光,网格,前/后,取消).但普通相机与我的唯一不同之处在于我想要预览表面的正方形 ; 不是一个矩形.然后,你所看到的就是你得到的(所见即所得),这样就不需要裁剪了; 因为用户首先会拍摄正方形照片.
我也一直在看图书馆https://github.com/danielebogo/DBCamera,但我没有看到如何自定义它到底.有帮助吗?谢谢.
我的代码很远:
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
//Capture Session
AVCaptureSession *session = [[AVCaptureSession alloc]init];
session.sessionPreset = AVCaptureSessionPresetPhoto;
//Add device
AVCaptureDevice *device =
[AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];
//Input
AVCaptureDeviceInput *input = [AVCaptureDeviceInput deviceInputWithDevice:device error:nil];
if (!input)
{
NSLog(@"No Input");
}
[session addInput:input];
//Output
AVCaptureVideoDataOutput *output = [[AVCaptureVideoDataOutput alloc] init];
[session addOutput:output];
output.videoSettings =
@{ (NSString *)kCVPixelBufferPixelFormatTypeKey : @(kCVPixelFormatType_32BGRA) };
//Preview Layer
AVCaptureVideoPreviewLayer *previewLayer = [[AVCaptureVideoPreviewLayer alloc] initWithSession:session]; …Run Code Online (Sandbox Code Playgroud) 有没有人有一个关于如何将SwipeRefreshLayout与ListView一起使用的简单示例?这是我的情况:
我有一个类SynchDogs从服务器提取数据.所以该类充当我的适配器的源.我想使用SwipeRefreshLayout刷新适配器,以及ListView.DogActivity是SynchDogs的观察者,因此DogActivity实现了一个update在新数据准备好时调用的方法.
所以我实施onRefresh为
@Override
public void onRefresh() {
SynchDogs.getInstance().synchronizeWithServer();
}
Run Code Online (Sandbox Code Playgroud)
所以我想这就是我需要启动pull-to-refresh的开始.如果是这样,update我该怎么办才能结束通话?
我也有
swipeLayout = (SwipeRefreshLayout) findViewById(R.id.swipe_container);
swipeLayout.setOnRefreshListener(this);
swipeLayout.setColorScheme(android.R.color.holo_blue_bright,
android.R.color.holo_green_light,
android.R.color.holo_orange_light,
android.R.color.holo_red_light);
Run Code Online (Sandbox Code Playgroud)
更新
基本上,我想知道停止彩色表演的呼吁.
如果我从一个活动启动DialogFragment,当我关闭DialogFragment时会发生什么?活动是否通过onResume状态?或者是正常java调用的调用,以便在DialogFragment关闭之前永远不会执行下一行?
假设启动我的片段的方法是
private void launchFragment(){
ConfirmationDialog confirm = new ConfirmationDialog();
confirm.show(getSupportFragmentManager(), "confirm");
doMoreStuff();
}
Run Code Online (Sandbox Code Playgroud)
所以我的问题是双重的:
doMoreStuff()召唤?在关闭片段之前或之后返回父活动?如下例所示:
@Override
public void onResume() {
super.onResume();
if(dialogFragmentChangedThis){
workSomeMore();
}
}
Run Code Online (Sandbox Code Playgroud)
片段是用.启动的
setStyle(STYLE_NO_FRAME, android.R.style.Theme_Translucent_NoTitleBar_Fullscreen);
Run Code Online (Sandbox Code Playgroud)
这样它就处于全屏模式.
android dialog android-layout android-fragments android-dialogfragment
我正在尝试在Genymotion中安装Google Play.但是当我将拉链放入模拟器时,它会保存文件/sd.../而不是闪烁.如何让拉链闪光?
如何找出iOS中安装了多少个应用实例?在Android上我只是去统计,他们告诉我.这个数字不准确,但通常是准确的.在iTunes Connect上,我不知道在哪里可以找到安装了我的应用的设备/人数.
我两天前推出了应用程序,以防万一.
我输入以下字段
field = "I am field";
Run Code Online (Sandbox Code Playgroud)
在Eclipse中,只要我将鼠标放在field它上面,就会显示一个选项列表,我可以从中选择create local variable field.
在Android Studio中,灯泡对我来说很头疼.有时看起来很快,有时需要永远出现.
有没有办法强迫它出现?
很遗憾,我无法在Android Place Picker发布后立即关闭答案.对我来说,PlacePicker启动,将位置显示为Unknown,然后返回resultCode 2.
重申一些事实:到目前为止,我的应用程序有两项活动.第一个活动是地图,到目前为止工作正常; 没问题.第二个活动有一个按钮,允许用户启动PlacePicker.第一个活动启动地图没有任何问题的事实应该强化读者我的清单是好的,并且我的Google Api控制台具有正确的数据.所以这让我失望:我做错了什么?我使用的确切示例为https://developers.google.com/places/android-api/placepicker.实际上这是我的代码
try {
IntentBuilder builder = new IntentBuilder();
startActivityForResult(builder.build(this), REQUEST_PLACE_PICKER);
} catch (GooglePlayServicesRepairableException e) {
e.printStackTrace();
} catch (GooglePlayServicesNotAvailableException e) {
e.printStackTrace();
}
Run Code Online (Sandbox Code Playgroud)
然后
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (RESULT_OK != resultCode) {
Log.d(TAG,"bad result: "+resultCode);
return;
}
if (REQUEST_PLACE_PICKER == requestCode) {
Place place = PlacePicker.getPlace(data, this);
String toastMsg = String.format("Place: %s", place.getName());
Toast.makeText(this, toastMsg, Toast.LENGTH_LONG).show();
}
}
Run Code Online (Sandbox Code Playgroud)
这是我的完整日志
D/ViewRootImpl: …Run Code Online (Sandbox Code Playgroud) android google-maps android-intent google-places-api startactivityforresult
我正在开发一个带有电子邮件功能的Android应用程序.我希望我的用户能够在飞行模式下撰写和发送电子邮件.为此,我需要某种队列,可以检查是否有网络和发送等.我想这已经完成了100次.但我不确定为什么我的搜索量不会太多.有谁知道我可以用来完成这个的库或git项目?如果没有,有谁知道如何做到这一点?
我相信它被称为Queue and send pattern.
更新
我正在就这个问题开始赏金.我希望的是一个不使用SMS的工作示例.对于我的特殊情况,我正在开发一个Appengine Connected Android项目.客户端需要将数据(字符串,位图等在特定的POJO下称为Dog)发送到服务器.我希望能够以某种方式排队这些数据.我可以使用Gson将数据保存到文件等.最重要的是我需要能够检查网络.当有网络时,我将队列出列到服务器.如果没有网络,我会一直保存到队列中.
我的队列可以是Queue<Dog>,这里Dog是我的类字段,诸如Bitmap(或路径图像), String,long等等.
我正在寻找一个有效的例子.它可以非常简单,但示例必须有效.一个git zip会很棒.对于这个问题,我放弃了近一半的积分.
class Dog{
String dogname;
String pathToImage;
int dogAge;
//etc.
}
//Design pattern for sending Dog to server
0) Unmarshall queue from file using Gson
1) Add dog to queue
2) If there is network, loop through queue and send data to server
3) if there is no network save queue to file
//Ideally, as soon as …Run Code Online (Sandbox Code Playgroud) 如果我使用键盘键入,则textViewDidChange和shouldChangeTextInRange总是被调用。但是,当我以编程方式更改textView时,不会调用委托方法。如何在textView中进行编程更改以触发委托方法?
更新资料
还有其他方法可以以编程方式模拟键盘输入吗?
我在我的android代码中使用icu4j.jar约为10MB,这使我的整个应用程序注册了15MB的apk.当然15MB可能是由于Proguard帮助缩小尺寸.无论如何,有没有人知道icu4j的一个较小的替代品?我正在使用icu4j libphonenumber仅用于一个目的,这里详细介绍,我将在下面重现:
你需要:
getSupportedRegions()获取区域代码列表
getCountryCodeForRegion(regionCode)获取每个国家/地区的国家/地区呼叫代码(1,44等)
然后要获得实际名称,您应该使用ICU4J - > http://icu-project.org/apiref/icu4j/ - >它会以您用户说的任何语言从这些区域代码中获取国家/地区名称.(getDisplayCountry())
android ×6
ios ×3
iphone ×2
java ×2
camera ×1
dialog ×1
genymotion ×1
google-maps ×1
networking ×1
uitextview ×1
uiview ×1