我下载了一个示例项目来学习如何制作UIPageViewController,我试图实际上分叉该项目并需要添加第三方库.现在,它看起来我的项目中没有.xcworkspace文件.当我尝试安装cocoapods时,我首先运行
sudo gem install cocoapods - 在我的终端的特定项目目录中
pod install - 在同一目录中
我在终端"项目目录中找不到podfile"时收到错误.
这是因为我没有.xcworkspace文件吗?我正确安装podfile吗?
我正在尝试调用 FlickR API,但在 response.body() 返回 null 时遇到了困难。
我不确定它是否与我的 JSON/POJO 映射有关,但是当我调用 FlickR 时,我无法弄清楚如何访问来自 Retrofit 的响应。我知道我的呼叫正在成功完成,因为我实际上能够通过日志拦截器查看 JSON。
模型:
public class Model {
Photos photos;
int code;
String stat;
String message; // when you text = null
public class Photos {
@SerializedName("page")
@Expose
private int page;
@SerializedName("pages")
@Expose
private int pages;
@SerializedName("perpage")
@Expose
private int perpage;
@SerializedName("total")
@Expose
private String total;
@SerializedName("photo")
@Expose
private List<Photo> photo = new ArrayList<Photo>();
/**
* @return The page
*/
public int getPage() {
return page;
}
/** …Run Code Online (Sandbox Code Playgroud) 我Collection在 Cloud Firestore 中有一个有一定数量的项目,我们称之为Collection“X”。这个项目的数量将不断变化。在任何给定的时间,我想听听这个项目的数量Collection并whereEqualto()在一个Query基于另一个“集合”对象,我们称之为“Y”:
Query queryStore = FirebaseFirestore.getInstance()
.collection("Y")
.whereEqualTo(USER_ID_LABEL, "item 1 from X")
.whereEqualTo(USER_ID_LABEL, "item 2 from X")
.whereEqualTo(USER_ID_LABEL, "item 3 from X");
//Could be more than 3, could be less than 3, constantly changing
Run Code Online (Sandbox Code Playgroud)
本质上,数量 whereEqualTo()将是动态的。
这种类型的查询可能吗?
我在 Retrofit 方面遇到了困难,因为我试图了解我应该在response.body()返回的内容中看到什么。
我想我的 JSON 到 POJO 转换中有一个映射错误,因为当我将它打印到日志时我没有看到正确的响应。
这是我看到的回应:
V/RESPONSE_BODY: response:com.troychuinard.flickr_test.Model.Model@36b2e4c9
Run Code Online (Sandbox Code Playgroud)
我希望这个响应只是 JSON 数据。我知道我正在对 FlickR 进行正确调用,因为我正在使用日志拦截器查看 JSON:
https://api.flickr.com/services/rest/?method=flickr.photos.getRecent&api_key=1c448390199c03a6f2d436c40defd90e&format=json&nojsoncallback=1&extras=url_m&text=test
Run Code Online (Sandbox Code Playgroud)
模型:
public class Model {
Photos photos;
int code;
String stat;
String message; // when you text = null
public class Photos {
@SerializedName("page")
@Expose
private int page;
@SerializedName("pages")
@Expose
private int pages;
@SerializedName("perpage")
@Expose
private int perpage;
@SerializedName("total")
@Expose
private String total;
@SerializedName("photo")
@Expose
private List<Photo> photo = new ArrayList<Photo>();
/**
* @return The page
*/
public int getPage() …Run Code Online (Sandbox Code Playgroud) 我正在使用此处的FirebaseRecyclerAdapter文档.
基本上,我想滚动到顶部,RecyclerView因为项目被添加到Firebase.这很棘手,因为我实际上并没有用一个ArrayList或任何列表初始化适配器.Firebase通过以下方式处理所有数据管理FirebaseRecyclerAdapter.
这是我的基本内容onCreateView():
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
final View v = inflater.inflate(R.layout.fragment_new, container, false);
Log.v("TAG", "ON CREATE CALLED FROM NEW");
mRecyclerview = (RecyclerView) v.findViewById(R.id.list);
mRecyclerview.setItemAnimator(new FadeInUpAnimator());
mLayoutManager = new LinearLayoutManager(getContext());
mLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
mLayoutManager.setReverseLayout(true);
mLayoutManager.setStackFromEnd(true);
mRecyclerview.setLayoutManager(mLayoutManager);
return v;
}
Run Code Online (Sandbox Code Playgroud)
我的适配器:
@Override
public void onStart() {
super.onStart();
mFireAdapter = new FirebaseRecyclerAdapter<Poll, PollHolder>(Poll.class, R.layout.latest_item, PollHolder.class, mBaseRef.child("Polls")) {
@Override
protected void …Run Code Online (Sandbox Code Playgroud) android firebase android-recyclerview firebase-realtime-database firebaseui
我想测试ViewHolder我每个人中包含的文本RecyclerView:
@RunWith(AndroidJUnit4.class)
public class EspressoTest {
private Activity mMainActivity;
private RecyclerView mRecyclerView;
private int res_ID = R.id.recycler_view_ingredients;
private int itemCount = 0;
//TODO: What is the purpose of this rule as it relates to the Test below?
@Rule
public ActivityTestRule<MainActivity> firstRule = new ActivityTestRule<>(MainActivity.class);
//TODO: Very confused about Espresso testing and the dependencies required; it appears Recyclerview
//TODO: Requires additional dependencies other than those mentioned in the Android documentation?
//TODO: What would be best method of …Run Code Online (Sandbox Code Playgroud) 我正在处理一个项目并提交给我的一位同行审查。在他们之前的评论中,他说我的keystore文件需要保存在相对路径中。我正在通过GitHub. 目前,我的keystore文件保存在我项目的根目录中。另外,在我的build.gradle,我有以下内容:
signingConfigs {
config {
keyAlias 'Udacity'
keyPassword 'xxxxxxxx'
storeFile file('/Users/user/Applications/LiveVotingUdacity/livevotingkeystore')
storePassword 'xxxxxx'
}
}
Run Code Online (Sandbox Code Playgroud)
如何保存到相对路径?我很困扰。
我有一个 RecyclerView 并将项目添加到mCommentArrayList索引 0。当新项目 (CardViews) 添加到 RecyclerView 时,我试图在视图顶部创建一个滑入动画。
我知道有可以使用的库,我什至探索过https://github.com/wasabeef/recyclerview-animators。但是,文档有限,我不确定要采取什么方法。
请注意,我将所有新项目添加到我的mCommentArrayListat 中,index 0以便它们出现在视图的顶部。我知道在适配器中有一些工作要做,特别是onBindViewHolder(),但我不知道确切地放什么来激活动画。
我首先调用 Firebase 查找数据以填充 RecyclerView:
mUpdateRef.addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
setImage(dataSnapshot);
setQuestion(dataSnapshot);
createInitialCommentIDArray(dataSnapshot);
mNumberOfCommentsAtPoll = (int) dataSnapshot.child(COMMENTS_LABEL).getChildrenCount();
for (int i = 0; i < mNumberOfCommentsAtPoll; i++) {
String commentID = (String) dataSnapshot.child(COMMENTS_LABEL).child(mCommentIDArrayList.get(i)).child("COMMENT").getValue();
Log.v("COMMENT_ID", "The comment ID is " + commentID);
String userID = (String) dataSnapshot.child(COMMENTS_LABEL).child(mCommentIDArrayList.get(i)).child("USER_ID").getValue();
Log.v("USER_ID", "The user ID is " + userID);
mCommentArrayList.add(0, new …Run Code Online (Sandbox Code Playgroud) 我试图在模拟器或设备上运行我的应用程序。当我单击Android Studio顶部的“运行”按钮时,该应用程序未运行,仅在下面列出了该消息:
/Library/Java/JavaVirtualMachines/jdk1.8.0_102.jdk/Contents/Home/bin/java "-Dgradle.home=/Applications/Android Studio.app/Contents/gradle/gradle-2.14.1" -Dtools.jar=/Library/Java/JavaVirtualMachines/jdk1.8.0_102.jdk/Contents/Home/lib/tools.jar -Didea.launcher.port=7533 "-Didea.launcher.bin.path=/Applications/Android Studio.app/Contents/bin" -Dfile.encoding=UTF-8 -classpath "/Applications/Android Studio.app/Contents/gradle/gradle-2.14.1/lib/groovy-all-2.4.4.jar:/Applications/Android Studio.app/Contents/gradle/gradle-2.14.1/lib/ant-1.9.6.jar:/Applications/Android Studio.app/Contents/gradle/gradle-2.14.1/lib/ant-launcher-1.9.6.jar:/Applications/Android Studio.app/Contents/gradle/gradle-2.14.1/lib/gradle-base-services-2.14.1.jar:/Applications/Android Studio.app/Contents/gradle/gradle-2.14.1/lib/gradle-base-services-groovy-2.14.1.jar:/Applications/Android Studio.app/Contents/gradle/gradle-2.14.1/lib/gradle-cli-2.14.1.jar:/Applications/Android Studio.app/Contents/gradle/gradle-2.14.1/lib/gradle-core-2.14.1.jar:/Applications/Android Studio.app/Contents/gradle/gradle-2.14.1/lib/gradle-docs-2.14.1.jar:/Applications/Android Studio.app/Contents/gradle/gradle-2.14.1/lib/gradle-installation-beacon-2.14.1.jar:/Applications/Android Studio.app/Contents/gradle/gradle-2.14.1/lib/gradle-jvm-services-2.14.1.jar:/Applications/Android Studio.app/Contents/gradle/gradle-2.14.1/lib/gradle-launcher-2.14.1.jar:/Applications/Android Studio.app/Contents/gradle/gradle-2.14.1/lib/gradle-logging-2.14.1.jar:/Applications/Android Studio.app/Contents/gradle/gradle-2.14.1/lib/gradle-messaging-2.14.1.jar:/Applications/Android Studio.app/Contents/gradle/gradle-2.14.1/lib/gradle-model-core-2.14.1.jar:/Applications/Android Studio.app/Contents/gradle/gradle-2.14.1/lib/gradle-model-groovy-2.14.1.jar:/Applications/Android Studio.app/Contents/gradle/gradle-2.14.1/lib/gradle-native-2.14.1.jar:/Applications/Android Studio.app/Contents/gradle/gradle-2.14.1/lib/gradle-open-api-2.14.1.jar:/Applications/Android Studio.app/Contents/gradle/gradle-2.14.1/lib/gradle-process-services-2.14.1.jar:/Applications/Android Studio.app/Contents/gradle/gradle-2.14.1/lib/gradle-resources-2.14.1.jar:/Applications/Android Studio.app/Contents/gradle/gradle-2.14.1/lib/gradle-tooling-api-2.14.1.jar:/Applications/Android Studio.app/Contents/gradle/gradle-2.14.1/lib/gradle-ui-2.14.1.jar:/Applications/Android Studio.app/Contents/gradle/gradle-2.14.1/lib/gradle-wrapper-2.14.1.jar:/Applications/Android Studio.app/Contents/gradle/gradle-2.14.1/lib/plugins/gradle-announce-2.14.1.jar:/Applications/Android Studio.app/Contents/gradle/gradle-2.14.1/lib/plugins/gradle-antlr-2.14.1.jar:/Applications/Android Studio.app/Contents/gradle/gradle-2.14.1/lib/plugins/gradle-build-comparison-2.14.1.jar:/Applications/Android Studio.app/Contents/gradle/gradle-2.14.1/lib/plugins/gradle-build-init-2.14.1.jar:/Applications/Android Studio.app/Contents/gradle/gradle-2.14.1/lib/plugins/gradle-code-quality-2.14.1.jar:/Applications/Android Studio.app/Contents/gradle/gradle-2.14.1/lib/plugins/gradle-dependency-management-2.14.1.jar:/Applications/Android Studio.app/Contents/gradle/gradle-2.14.1/lib/plugins/gradle-diagnostics-2.14.1.jar:/Applications/Android Studio.app/Contents/gradle/gradle-2.14.1/lib/plugins/gradle-ear-2.14.1.jar:/Applications/Android Studio.app/Contents/gradle/gradle-2.14.1/lib/plugins/gradle-ide-2.14.1.jar:/Applications/Android Studio.app/Contents/gradle/gradle-2.14.1/lib/plugins/gradle-ide-native-2.14.1.jar:/Applications/Android Studio.app/Contents/gradle/gradle-2.14.1/lib/plugins/gradle-ide-play-2.14.1.jar:/Applications/Android Studio.app/Contents/gradle/gradle-2.14.1/lib/plugins/gradle-ivy-2.14.1.jar:/Applications/Android Studio.app/Contents/gradle/gradle-2.14.1/lib/plugins/gradle-jacoco-2.14.1.jar:/Applications/Android Studio.app/Contents/gradle/gradle-2.14.1/lib/plugins/gradle-javascript-2.14.1.jar:/Applications/Android Studio.app/Contents/gradle/gradle-2.14.1/lib/plugins/gradle-jetty-2.14.1.jar:/Applications/Android Studio.app/Contents/gradle/gradle-2.14.1/lib/plugins/gradle-language-groovy-2.14.1.jar:/Applications/Android Studio.app/Contents/gradle/gradle-2.14.1/lib/plugins/gradle-language-java-2.14.1.jar:/Applications/Android Studio.app/Contents/gradle/gradle-2.14.1/lib/plugins/gradle-language-jvm-2.14.1.jar:/Applications/Android Studio.app/Contents/gradle/gradle-2.14.1/lib/plugins/gradle-language-native-2.14.1.jar:/Applications/Android Studio.app/Contents/gradle/gradle-2.14.1/lib/plugins/gradle-language-scala-2.14.1.jar:/Applications/Android Studio.app/Contents/gradle/gradle-2.14.1/lib/plugins/gradle-maven-2.14.1.jar:/Applications/Android Studio.app/Contents/gradle/gradle-2.14.1/lib/plugins/gradle-osgi-2.14.1.jar:/Applications/Android Studio.app/Contents/gradle/gradle-2.14.1/lib/plugins/gradle-platform-base-2.14.1.jar:/Applications/Android Studio.app/Contents/gradle/gradle-2.14.1/lib/plugins/gradle-platform-jvm-2.14.1.jar:/Applications/Android Studio.app/Contents/gradle/gradle-2.14.1/lib/plugins/gradle-platform-native-2.14.1.jar:/Applications/Android Studio.app/Contents/gradle/gradle-2.14.1/lib/plugins/gradle-platform-play-2.14.1.jar:/Applications/Android Studio.app/Contents/gradle/gradle-2.14.1/lib/plugins/gradle-plugin-development-2.14.1.jar:/Applications/Android Studio.app/Contents/gradle/gradle-2.14.1/lib/plugins/gradle-plugin-use-2.14.1.jar:/Applications/Android Studio.app/Contents/gradle/gradle-2.14.1/lib/plugins/gradle-plugins-2.14.1.jar:/Applications/Android Studio.app/Contents/gradle/gradle-2.14.1/lib/plugins/gradle-publish-2.14.1.jar:/Applications/Android Studio.app/Contents/gradle/gradle-2.14.1/lib/plugins/gradle-reporting-2.14.1.jar:/Applications/Android Studio.app/Contents/gradle/gradle-2.14.1/lib/plugins/gradle-resources-http-2.14.1.jar:/Applications/Android Studio.app/Contents/gradle/gradle-2.14.1/lib/plugins/gradle-resources-s3-2.14.1.jar:/Applications/Android Studio.app/Contents/gradle/gradle-2.14.1/lib/plugins/gradle-resources-sftp-2.14.1.jar:/Applications/Android Studio.app/Contents/gradle/gradle-2.14.1/lib/plugins/gradle-scala-2.14.1.jar:/Applications/Android Studio.app/Contents/gradle/gradle-2.14.1/lib/plugins/gradle-signing-2.14.1.jar:/Applications/Android Studio.app/Contents/gradle/gradle-2.14.1/lib/plugins/gradle-sonar-2.14.1.jar:/Applications/Android Studio.app/Contents/gradle/gradle-2.14.1/lib/plugins/gradle-test-kit-2.14.1.jar:/Applications/Android Studio.app/Contents/gradle/gradle-2.14.1/lib/plugins/gradle-testing-base-2.14.1.jar:/Applications/Android Studio.app/Contents/gradle/gradle-2.14.1/lib/plugins/gradle-testing-jvm-2.14.1.jar:/Applications/Android Studio.app/Contents/gradle/gradle-2.14.1/lib/plugins/gradle-testing-native-2.14.1.jar:/Applications/Android Studio.app/Contents/gradle/gradle-2.14.1/lib/plugins/gradle-tooling-api-builders-2.14.1.jar:/Applications/Android Studio.app/Contents/gradle/gradle-2.14.1/lib/plugins/ivy-2.2.0.jar:/Applications/Android Studio.app/Contents/lib/idea_rt.jar" com.intellij.rt.execution.application.AppMain org.gradle.launcher.GradleMain …Run Code Online (Sandbox Code Playgroud) 看起来XCode推出了一个新的更新.这个问题似乎是持久的,即使iTunes Store在"最近30天安装的更新"部分中发布更新,iTunes Store也不会呈现更新.重新启动后,我会再次提示更新,即使我已经完成了两次.最终,当我打开XCode时,更新不适用(它仍显示7.3,而不是7.3.1):