我正在尝试决定是否应该将App-engine Search API或Datastore用于App-engine Connected Android Project.谷歌文档的唯一区别是
...索引搜索可以找到不超过10,000个匹配的文档.App Engine数据存储可能更适合需要检索非常大的结果集的应用程序.
鉴于我已经非常熟悉数据存储区:假设我不需要10,000个结果,有人会帮助我吗?
Search API
与使用数据存储为我的查询(根据上面的报价,这似乎是合理使用一个或其他)?在我的情况下,最终用户必须能够搜索,更新现有条目并创建新实体.例如,如果我的应用是书店,则用户必须能够添加新书,向现有书籍添加评论,搜索特定书籍.java google-app-engine google-search-api google-cloud-datastore
假设我的范围被创建为
NSRange myRange = {0,100};
Run Code Online (Sandbox Code Playgroud)
如何myRange
在NSLog中打印?以下不起作用
NSLog(@"my range is %@",myRange);
Run Code Online (Sandbox Code Playgroud) 我正试图"重新创建"(类似于)Play报亭的布局.根据文档,CoordinatorLayout的一般结构是
<CoordinatorLayout>
<!— view that shrinks —>
<AppBarLayout>
<CollapsingToolbarLayout>
…
</CollapsingToolbarLayout>
</AppBarLayout>
<!— view that scrolls —>
<SomeScrollView >
….
</SomeScrollView>
</CoordinatorLayout>
Run Code Online (Sandbox Code Playgroud)
除了我看报亭应用程序外,我能看到的是它SomeScrollView
实际上是一个用于TabLayout的ViewPager.对于我的特殊情况,我的主要问题是我SomeScrollView
必须成为碎片的某种容器.基本上我想要的是
-------
| A |
| |
-------
| B |
| |
-------
Run Code Online (Sandbox Code Playgroud)
其中A是可折叠部分,B是滚动部分.同样,对于我的情况,B是动态片段的容器.所以A将有一个TabLayout,当用户点击一个标签时,它会导致B中的可见片段发生变化.B中的片段将包含RecycleView或可滚动的TextView.(实际上其中一个片段是一个FrameLayout,它包含一个RecycleView和一个TextView,其中任何一个都是可见的)
到目前为止,这是我的代码:
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<!-- collapsing view -->
<android.support.design.widget.AppBarLayout
android:id="@+id/app_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.design.widget.CollapsingToolbarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<include
…
/>
<android.support.design.widget.TabLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_scrollFlags=“…”
/>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<!-- scrolling view -->
<android.support.v4.view.ViewPager
android:id="@+id/main_viewpager"
android:layout_width="match_parent"
android:layout_height="wrap_content"
> …
Run Code Online (Sandbox Code Playgroud) 即使在单击Add Support Library并选择版本19之后,eclipse仍然无法找到android.support.v4.widget.SwipeRefreshLayout.有谁知道如何让这个工作?我在用
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="19" />
Run Code Online (Sandbox Code Playgroud)
我正在使用Juno的mac mavericks计算机.
更新:导入部分
import java.util.Observer;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListView;
import android.widget.TextView;
import android.support.v4.widget.SwipeRefreshLayout;//red underline
Run Code Online (Sandbox Code Playgroud)
更新
顺便说一句,我不知道这是否重要:这是一个Appengine Connected Android Project,我使用Google-Eclipse-Plugin构建
更新3:
它看起来像是通过SDK Manager无法使用Android支持库19.1.0.我怎么能得到它?
该标志FLAG_ACTIVITY_CLEAR_TOP
查找包含活动X的任务,并清除顶部以使X进入其恢复状态.标志FLAG_ACTIVITY_SINGLE_TOP
只会将X的单个实例保留在顶部.因此,SINGLE_TOP
如果我已经在使用,我永远不需要包括CLEAR_TOP
:那是因为CLEAR_TOP
行为包括SINGLE_TOP
行为.那么为什么这么多样本代码包含两者呢?是因为那些开发人员不了解全部的力量CLEAR_TOP
吗?同样,我在网上看到的几乎所有例子都包括两者.冗余为什么?
例如,如果我CLEAR_TOP
在任务上调用X W->X->Y->Z
,那么我就得到了W->X
.另一方面,如果我打算在X上调用SINGLE_TOP来完成任务,W->X->Y->Z
我会最终W->X->Y->Z->X
调用它,如果我打电话给ZI就可以了W->X->Y->Z
.所以实际上CLEAR_TOP
没有添加任何东西:它就像将0添加到其他值.
有人请说明在什么情况下我可以使用Field.Store.NO
而不是Field.Store.YES
?我对Lucene非常陌生.我正在尝试创建一个文档.根据我的基本知识,我正在做
doc.add(new StringField(fieldNameA,fieldValueA,Field.Store.YES));
doc.add(new TextField(fieldNameB,fieldValueB,Field.Store.YES));
Run Code Online (Sandbox Code Playgroud) 我从运行Lucene得到以下错误跟踪.我包括提示错误的代码段.具体的项目/连接器是Lucene for Appengine
码
public static void resetAllIndicesUsingDatastore() {
LOG.info("Inside resetAllIndicesUsingDatastore ");
StandardAnalyzer analyzer = new StandardAnalyzer();
GaeDirectory directory = new GaeDirectory(LuceneWorker.DOGS);// create dog index
IndexWriterConfig config = GaeLuceneUtil.getIndexWriterConfig(LuceneWorker.LUCENE_VERSION, analyzer);
IndexWriter writer = null;
LOG.info("GOING TO TRY ");
try {
// delete all elements
writer = new IndexWriter(directory, config);//LINE 142
LOG.info("Going to delete all that's there ");
writer.deleteAll();
writer.commit();
// get all dogs from datastore
List<Dog> dogs = DogDaoImpl.getAll();
LOG.info("All dogs size is : " + dogs.size());
for (Dog …
Run Code Online (Sandbox Code Playgroud) 毕加索允许我调整图像大小.是否有调整占位符大小的机制?以下是不够的.我错过了什么?
Picasso.with(mContext).load(url).placeholder(R.drawable.imageview_holder).resize(200, 200).into(imageview);
Run Code Online (Sandbox Code Playgroud) 如何仅使用大小初始化NSArray,以便稍后使用for循环填充它?我的for循环将是
for (int i = 0; i < [myArray count]; i++) {
myArray[i] = someData;
}
Run Code Online (Sandbox Code Playgroud) 我正在尝试在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)