我有一个登录页面,点击“登录”按钮后,我需要暂时锁定屏幕,直到我得到服务器的响应。
主页
/
user-215498
OPTIMIST .KZ's questions
一切顺利,我从api中获取json数据,我想将这些数据存储(缓存)到Sqlite数据库中,我的想法是否正确,如果不正确,请告诉我如何在应用程序中实现缓存?
如何在java中找到星期几 示例:11/29/2016 你需要得到 11/29/2016 = "Tuesday";
如何更改 Android 中 CalendarView 的外观?
对于应用程序中的授权,我使用的是 VK API,在调试版本中没有问题,在游戏市场上发布后显示“sdk_fingerprint is incorrect”
我有一个带数据的回收视图,我需要将所有项目数据传递给另一个活动,我该如何实现?
如何通过 VK API 获取授权用户的数据(名字、姓氏等)?
这是我的代码:
public class VkActivity extends AppCompatActivity {
String [] scope = new String[]{VKScope.MESSAGES,VKScope.FRIENDS,VKScope.WALL};
private String name;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_vk);
VKSdk.login(this, scope);
}
VKAccessTokenTracker vkAccessTokenTracker = new VKAccessTokenTracker() {
@Override
public void onVKAccessTokenChanged(VKAccessToken oldToken, VKAccessToken newToken) {
if (newToken == null) {
// VKAccessToken is invalid
}
}
};
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (!VKSdk.onActivityResult(requestCode, resultCode, data, new VKCallback<VKAccessToken>() {
@Override
public void onResult(VKAccessToken res) {
Intent intent1 = new Intent(getApplicationContext(), AccountActivity.class);
VKRequest request = VKApi.users().get(); ;
VKAPI.
// startActivity(intent1);
// Пользователь успешно авторизовался
Toast.makeText(getApplicationContext(),res + "Пользователь успешно авторизовался",Toast.LENGTH_LONG).show();
}
@Override
public void onError(VKError error) {
// Произошла ошибка авторизации (например, пользователь запретил авторизацию)
Toast.makeText(getApplicationContext(),"Произошла ошибка авторизации",Toast.LENGTH_LONG).show();
}
})) {
super.onActivityResult(requestCode, resultCode, data);
}
}
}
有一行“REMBO IUI Z&&”,如何检查 && 符号
我在 firebase 上写了一个聊天,现在我需要决定如何发送推送通知,我之前使用了 php / mysql 包,但这里有更密集的信息,建议如何直接通过 firebase 发送推送
下午好,我创建了一个应用程序,实现了一个用户帐户。在用户画像中,我取了JSON数据,通过listview
activity展示出来,但是遇到了这样一个问题:画像结构展开了,所以生成的JSON非常大,一个都放不下item
。我需要以某种方式扩展这个项目,告诉我在哪个方向挖掘?
// Creating volley request obj
JsonArrayRequest movieReq = new JsonArrayRequest(url,
new Response.Listener<JSONArray>() {
@Override
public void onResponse(JSONArray response) {
Log.d(TAG, response.toString());
hidePDialog();
// Parsing json
for (int i = 0; i < response.length(); i++) {
try {
JSONObject obj = response.getJSONObject(i);
SpecialTechical person = new SpecialTechical();
person.setName(obj.getString("name"));
person.setType(obj.getString("type"));
person.setNumber(obj.getString("number"));
person.setImg(obj.getString("image"));
person.setAddress(obj.getString("side"));
person.setCom(obj.getString("com"));
person.setAge(obj.getString("age"));
person.setPrice(obj.getString("price"));
person.setTime(obj.getString("data"));
names.add(person);
}
我的适配器:
public class NewOrderAdapter extends RecyclerView.Adapter<MyHolder2> {
Context c;
ArrayList<SpecialTechical> specialTechicals;
Dialog dialog;
final String[] texts = TeachersDisplayActivity.subject;
public NewOrderAdapter(Context c, ArrayList<SpecialTechical> specialTechicals) {
this.c = c;
this.specialTechicals = specialTechicals;
}
@Override
public MyHolder2 onCreateViewHolder(ViewGroup parent, int viewType) {
View v= LayoutInflater.from(parent.getContext()).inflate(R.layout.it3,parent,false);
MyHolder2 holder=new MyHolder2(v);
return holder;
}
@Override
public void onBindViewHolder(MyHolder2 holder, final int position) {
PicassoClient.downloadImage(c, specialTechicals.get(position).getImg(), holder.img);
String n=specialTechicals.get(position).getType();
holder.nameTxt.setText(texts[Integer.parseInt(n)]);
holder.subject.setText(specialTechicals.get(position).getCom());
holder.region2.setText(specialTechicals.get(position).getPrice());
holder.date.setText(specialTechicals.get(position).getTime());
// holder.name.setText(specialTechicals.get(position).getName());
有一个数组:
final String[] texts = {"Математика","Музыка (Пение)","Изобразительное искусство (Рисование)","Английский язык","Казахский язык",
"Немецкий язык","Китайский язык","История","География","Биология","Химия"}
我在我的应用程序中经常使用它,如何保存一次并从任何地方调用它
如何从一个Activity
到另一个进行平稳、更有效的过渡?
有一行:
String="Moscow,Astana,London";
需要得到:
String 1=Moscow;
String 2=Astana;
String 3=London;
我在应用程序中使用它向片段输出json RecyclerView
,此时我RecyclerView
正在加载所有json,我该如何组织分阶段加载?
JsonArrayRequest movieReq = new JsonArrayRequest(url,
new Response.Listener<JSONArray>() {
@Override
public void onResponse(JSONArray response) {
Log.d(TAG, response.toString());
hidePDialog();
// Parsing json
for (int i = 0; i < response.length(); i++) {
try {
JSONObject obj = response.getJSONObject(i);
Person person = new Person();
Log.d("json",obj.getString("image"));
person.setId(obj.getString("id"));
person.setUrl(obj.getString("image"));
person.setName(obj.getString("name") + obj.getString("1"));
person.setNumberClient(obj.getString("number"));
person.setName2(obj.getString("name"));
person.setSurname(obj.getString("surname"));
person.setRegion(obj.getString("region"));
person.setSubject(obj.getString("1"));
names.add(person);
} catch (JSONException e) {
e.printStackTrace();
}
}
// notifying list adapter about data changes
// so that it renders the list view with updated data
hidePDialog();
adapter.notifyDataSetChanged();
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
VolleyLog.d(TAG, "Error: " + error.getMessage());
hidePDialog();
}
});
这是我的适配器
public class MyPicassoAdapter extends RecyclerView.Adapter<MyHolder> {
Context c;
ArrayList<Person> persons;
public MyPicassoAdapter(Context c, ArrayList<Person> persons) {
this.c = c;
this.persons = persons;
}
@Override
public MyHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View v= LayoutInflater.from(parent.getContext()).inflate(R.layout.chat_items,parent,false);
MyHolder holder=new MyHolder(v);
return holder;
}
@Override
public void onBindViewHolder(MyHolder holder, int position) {
holder.nameTxt.setText(persons.get(position).getName());
holder.id.setText(persons.get(position).getId());
holder.img_url.setText(persons.get(position).getUrl());
holder.region.setText(persons.get(position).getRegion());
holder.subject.setText(persons.get(position).getSubject());
holder.numClient.setText(persons.get(position).getNumberClient());
holder.ns.setText(persons.get(position).getName2() + " " + persons.get(position).getSurname());
PicassoClient.downloadImage(c, "http://www.developer92.16mb.com/mentor/public_html/images/"+persons.get(position).getUrl(), holder.img);
}
@Override
public int getItemCount() {
return persons.size();
}
public interface ClickListener {
void onClick(View view, int position);
void onLongClick(View view, int position);
}