我正在尝试解析像这样的JSON字符串
[
{
"updated_at":"2012-03-02 21:06:01",
"fetched_at":"2012-03-02 21:28:37.728840",
"description":null,
"language":null,
"title":"JOHN",
"url":"http://rus.JOHN.JOHN/rss.php",
"icon_url":null,
"logo_url":null,
"id":"4f4791da203d0c2d76000035",
"modified":"2012-03-02 23:28:58.840076"
},
{
"updated_at":"2012-03-02 14:07:44",
"fetched_at":"2012-03-02 21:28:37.033108",
"description":null,
"language":null,
"title":"PETER",
"url":"http://PETER.PETER.lv/rss.php",
"icon_url":null,
"logo_url":null,
"id":"4f476f61203d0c2d89000253",
"modified":"2012-03-02 23:28:57.928001"
}
]
Run Code Online (Sandbox Code Playgroud)
进入一个对象列表.
List<ChannelSearchEnum> lcs = (List<ChannelSearchEnum>) new Gson().fromJson( jstring , ChannelSearchEnum.class);
Run Code Online (Sandbox Code Playgroud)
这是我正在使用的对象类.
import com.google.gson.annotations.SerializedName;
public class ChannelSearchEnum {
@SerializedName("updated_at")
private String updated_at;
@SerializedName("fetched_at")
private String fetched_at;
@SerializedName("description")
private String description;
@SerializedName("language")
private String language;
@SerializedName("title")
private String title;
@SerializedName("url")
private String url;
@SerializedName("icon_url")
private String icon_url;
@SerializedName("logo_url")
private …Run Code Online (Sandbox Code Playgroud) 我在一个滚动视图中有一个EditText字段LinearLayout.只要ScrollView不存在layout_weight="1.0"就让我EditText占据剩余的屏幕.但是一旦我将LinearLayout包装在一个中ScrollView,它就会改变EditText为单行,而layout_weight不起作用.
我的完整布局文件
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="fill_parent" android:orientation="vertical" >
<TextView android:id="@+id/titleTextView"
style="@style/TitleHeaderBarText"
android:text="@string/announcement" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="fill_parent" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:gravity="right" >
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Subject:"
android:textSize="16sp" />
<EditText
android:id="@+id/et_subject"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Announcement:"
android:textSize="16sp" />
<EditText
android:id="@+id/et_announcement"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:layout_weight="1.0" />
<Button
android:id="@+id/btn_save"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="24sp"
android:paddingRight="24dp"
android:text="Save" />
</LinearLayout>
</ScrollView>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
我似乎不明白我做错了什么.任何建议请在如何让EditText上从内占据了屏幕的其余部分LinearLayout是在ScrollView.
谢谢.
编辑 再次面对同样的问题,这是我的布局.
<?xml …Run Code Online (Sandbox Code Playgroud) 我有一个简单的列表视图与适配器.我动态创建了10多个listviewitems.然后我一次又一次地上下滚动......我可以看到可用的内存不断下降......
我需要在哪里免费?注意 - 有一个imageview - 但在我的测试中我没有使用任何图像,所以它是View.GONE.
另外 - 我可以使用哪个工具来分析android上的内存使用情况.我找到了你的Kit,但我如何为android配置它(我在设备上运行应用程序)/
Activity类
package org.BJ.Food4All.Activities.NewRecipe;
import org.BJ.Food4All.R;
import org.BJ.Food4All.Recipe;
import org.BJ.Food4All.Recipe.Instruction;
import org.BJ.Food4All.Activities.RecipeBook.RecipeInstructionsListViewAdapter;
import org.BJ.Food4All.Activities.RecipeBook.SharedData;
import org.BJ.Food4All.utils.CameraUtil;
import org.BJ.Food4All.utils.ImageUploadItem;
import android.app.ListActivity;
import android.content.Intent;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.util.Log;
import android.view.ContextMenu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.EditText;
public class Instructions extends ListActivity implements OnClickListener
{
private final static String mTAG = "Instructions";
private EditText mInstructionEditText = null;
private RecipeInstructionsListViewAdapter mListViewAdapter = null;
private Recipe mEditRecipe …Run Code Online (Sandbox Code Playgroud) 据我了解,在片段onCreate中创建片段事件侦听器会不会更好?如果在onCreateView中完成,则每次片段返回视图时都必须重做(onResume())?在它设定的地方会有所作为吗?