好的,所以我正在创建一个用户可以匿名逼供的应用程序。所以我所做的是一个名为userPost的解析对象。当用户单击发送按钮时,它将从EditTest1获取文本并将其发送到标签告白下的解析云。我想从忏悔中获取所有价值。我该怎么做?要澄清一下,请点击此链接:http://gyazo.com/5e9f3b38406efd358ad199003cc24cf1 忏悔?我想获取该选项卡下的所有值。
继承人的代码;
package com.example.stemwhipser;
import java.util.Arrays;
import java.util.List;
import com.parse.FindCallback;
import com.parse.GetCallback;
import com.parse.Parse;
import com.parse.ParseException;
import com.parse.ParseObject;
import com.parse.ParseQuery;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
public class MainActivity extends ActionBarActivity {
Button sendBtn;
EditText something;
TextView hey;
public String some = "";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Parse.enableLocalDatastore(this);
Parse.initialize(this, "sHBbzqwjHx96UgDYrAdllJxJCAa0BZCXiAa76cM0", "49ViM4lvJFuDIdzReDylofKN9t9GXi677NAbtFti");
sendBtn = (Button) findViewById(R.id.button1);
final EditText confession = (EditText) findViewById(R.id.editText1);
sendBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
some = confession.getText().toString();
ParseObject userPost = new ParseObject("Post");
userPost.put("confession",some.toString());
userPost.saveInBackground();
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
答案 0 :(得分:0)
您是否阅读过解析文档?
import com.parse.FindCallback;
import com.parse.ParseObject;
import com.parse.ParseQuery;
import com.parse.ParseException;
解析选择查询的代码
ParseQuery parseQuery = new ParseQuery("Post");
parseQuery.findInBackground(new FindCallback() {
@Override
public void done(List objects, ParseException e) {
if (e == null) {
// fetch your records here
for (final ParseObject objparse : objects) {
objparse.get("confession").toString(),
}
}
else
{
//parse error
}
}
}