我正在创建一个应用程序,其中我需要将库中的所有图像放入我的应用程序中,其中包含girdview.我希望所有文件夹中的所有图像都出现在gridview中.
String[] proj = { MediaStore.Images.Media.DATA, MediaStore.Images.Media._ID };
actualimagecursor = managedQuery(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, proj,
null, null, MediaStore.Images.Media.DEFAULT_SORT_ORDER);
actual_image_column_index = actualimagecursor.getColumnIndexOrThrow(MediaStore.Images.Media._ID);
actualimagecursor.moveToPosition(position);
String i = actualimagecursor.getString(actual_image_column_index);
Run Code Online (Sandbox Code Playgroud)
我已将此代码添加到我的代码中,但我只获得了SD卡图像,没有获得其他文件夹图像.如何从画廊中获取所有图像?
提前致谢.
我是Android开发的新手,也是第一次使用可扩展的listview.我正在创建一个应用程序,在其中我从webservice获取d expandable listview的所有内容.我从wevservice获取所有内容,但是当可扩展listview中没有父节点的子节点时,可扩展listview的自定义适配器merhod getchildcount()返回null并给出空指针异常如何在列表中仅显示父节点没有孩子,两者都可用?
谢谢
public View getChildView(int p_id, int c_id, boolean bln1, View view,ViewGroup viewgroup) {
// TODO Auto-generated method stub
if (view == null) {
view = inflater.inflate(com.example.eventlive.R.layout.homescreen_list_item_child, viewgroup,false);
}
TextView textView = (TextView) view.findViewById(R.id.list_item_text_child);
//"i" is the position of the parent/group in the list and
//"i1" is the position of the child
textView.setText(mParent.get(p_id).getArrayChildren().get(c_id));
view.setBackgroundResource(R.drawable.child_bg);
//return the entire view
return view;
}
//counts the number of children items so the list knows how many times calls getChildView() method …Run Code Online (Sandbox Code Playgroud) try
{
url= new URL(ConstantsClass.VENDOR_FOLLOW + "?UID=" +android_id+"&URL='"+resultfinal+"'&device=android");
connection = (HttpURLConnection) url.openConnection();
connection.setDoOutput(true);
connection.setRequestMethod("POST");
request = new OutputStreamWriter(connection.getOutputStream());
request.flush();
request.close();
request.write("Hello!!!");
String line = "";
InputStreamReader isr = new InputStreamReader(connection.getInputStream());
BufferedReader reader = new BufferedReader(isr);
StringBuffer sb = new StringBuffer();
while((line=reader.readLine())!=null) {
sb.append(line + "&");
}
response = sb.toString();
//response.getEntity().getContent();
Log.i("Test", "updated response: " + response);
}
catch (IOException e) {
e.printStackTrace();
}
Log.i("Test", "**************url list********************" + url);
tag_text.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method …Run Code Online (Sandbox Code Playgroud) 我试图将json值解析为我的Android应用程序.在这里,我被困在一个地方,我需要在json arraylist中有对象长度.
下面是我的json:
"events": { //json object
"2012-11-30": [ // json array
{
"privacy": "OPEN",
"name": "LOGDGE"
}
],
"2013-08-17": [
{
"privacy": "OPEN",
"name": "Party: Dinner and Dancing"
}
],
"2013-09-14": [
{
"privacy": "OPEN",
"name": "Party: Dinner and Dancing"
}
],
"2013-09-27": [
{
"privacy": "OPEN",
"name": "Salsa Party!"
}
{
"privacy": "OPEN",
"name": "Dance Performance Course",
}
],
"2013-10-23": [
{
"privacy": "OPEN",
"name": "Dance Performance Course"
}
]
}
Run Code Online (Sandbox Code Playgroud)
现在我的问题是我如何解析以获得json数组的长度: