我尝试将数据上传到服务器,我的数据包含多个图像和大JSON,在它之前,我尝试使用转换图像发送到字符串使用base64并发送我之前转换的另一个数据和图像JSON,但我OutOfMemory在这里遇到问题,所以我读了一个说我必须尝试使用的解决方案MultipartEntityBuilder.我仍然感到困惑,不明白该怎么做MultiPartEntityBuilder,有没有人可以帮助我这样做MultiPartEntityBuilder?这是我的代码:
try{
//membuat HttpClient
//membuat HttpPost
HttpPost httpPost= new HttpPost(url);
SONObject jsonObjectDP= new JSONObject();
System.out.println("file audio "+me.getModelDokumenPendukung().getAudio());
jsonObjectDP.put("audio_dp",MethodEncode.EncodeAudio(me.getModelDokumenPendukung().getAudio()));
jsonObjectDP.put("judul_audio",me.getModelDokumenPendukung().getJudul_audio());
jsonObjectDP.put("ket_audio",me.getModelDokumenPendukung().getKet_audio());
JSONArray ArrayFoto= new JSONArray();
//This loop For my multiple File Images
List<ModelFoto>ListFoto=me.getModelDokumenPendukung().getListFoto();
for (int i=0; i<ListFoto.size();i++) {
JSONObject jsonObject= new JSONObject();
jsonObject.put("foto", ListFoto.get(i).getFile_foto());
jsonObject.put("judul_foto", ListFoto.get(i).getJudul_foto());
jsonObject.put("ket_foto", ListFoto.get(i).getKet_foto());
ArrayFoto.put(jsonObject);
}
JSONObject JSONESPAJ=null;
JSONESPAJ = new JSONObject();
JSONObject JSONFINAL = new JSONObject();
JSONESPAJ.put("NO_PROPOSAL",me.getModelID().getProposal());
JSONESPAJ.put("GADGET_SPAJ_KEY",me.getModelID().getIDSPAJ());
JSONESPAJ.put("NO_VA",me.getModelID().getVa_number());
JSONESPAJ.put("Dokumen_Pendukung",jsonObjectDP);
JSONFINAL.put("ESPAJ", JSONESPAJ); …Run Code Online (Sandbox Code Playgroud) 我尝试将我的内容转换ScrollView为bitmap,我的ScrollView内容溢出屏幕(因此可以滚动),在我在这里询问之后我可以在 中捕获我的活动ScrollView,但是我遇到了一个问题,Bitmap用于保存屏幕截图的不是创建所有查看,只有最后一个ScrollView,其余的都是黑屏,如下图:
这是我为以下所有视图截取屏幕截图的代码ScrollView:
scroll_pp=(ScrollView)polis.findViewById(R.id.scroll_pp);
utktest=polis.findViewById(R.id.scroll_pp);
int totalHeight = scroll_pp.getChildAt(0).getHeight();
int totalWidth = scroll_pp.getChildAt(0).getWidth();
Bitmap b= MethodSupport.loadBitmapFromView(utktest, totalWidth, totalHeight);
String extr = Environment.getExternalStorageDirectory().toString() + File.separator + "Folder";
String fileName = "Test.jpg";
File myPath = new File(extr, fileName);
FileOutputStream fos = null;
try {
fos = new FileOutputStream(myPath);
b.compress(Bitmap.CompressFormat.JPEG, 100, fos);
fos.flush();
fos.close();
MediaStore.Images.Media.insertImage(getActivity().getContentResolver(), b, "Screen", "screen");
}catch (FileNotFoundException e) {
e.printStackTrace();
} catch (Exception e) …Run Code Online (Sandbox Code Playgroud) 我正在努力开发像facebook这样的时间轴.

你看,我有一个ViewPager来导航用户之间的"片段",如feed,profile,about等.
我有"main.xml",就像这样只有viewpager;
<android.support.v4.view.ViewPager
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="match_parent">
</android.support.v4.view.ViewPager>
Run Code Online (Sandbox Code Playgroud)
我还有fragmenta.xml,fragmentb.xml,fragmentc.xml.让我们检查一下fragmenta.xml,在里面,我把;
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FFCC00"
tools:context=".FragmentA" >
<ListView
android:id="@+id/listView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true">
</ListView>
</FrameLayout>
Run Code Online (Sandbox Code Playgroud)
并使singlerow.xml将这些框创建为这样的时间轴;
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="#e67e22"
android:layout_margin=" 5dp">
<ImageView
android:layout_marginTop="5dp"
android:layout_marginBottom="0dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:id="@+id/imageView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="@drawable/s1" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="1">
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:layout_gravity="left"
android:textAlignment="gravity"
android:text="16 likes"/>
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:layout_gravity="right"
android:textAlignment="gravity"
android:text="43mins ago"/>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="1">
<Button
android:id="@+id/button1"
android:layout_width="wrap_content" …Run Code Online (Sandbox Code Playgroud) 我有两个Array如下:
String a[]={"book","pen"};
String b[]={"pen","pencil","bottle","book","bag"};
Run Code Online (Sandbox Code Playgroud)
我想检查array b和 之间的相同值array a,我已经尝试过:
for (int i=0; i < b.length; i++){
for (int j=0; j < a.length(); j++){
if(!(a.contains(b[i]))){
//delete if not same
}
Run Code Online (Sandbox Code Playgroud)
所以我的问题,如何检查两个arraylist android之间相同的值?
我来自巴西,我有一个包含按钮图像和文本的列表视图.我正在尝试点击按钮列表视图并获取负责我点击的行的视图.所以我可以在我的按钮所在的行上进行更改.
发生了什么,如果下面的代码,当我点击按钮时,列表中的任何按钮他总是在第一个列表项中进行更改,我希望他在各自的行中执行.因此这个清单
IMAGE ------------ ---------------文本 - 按钮
图像------------ ----- ----------文字 - 按钮
图像------------ ---------------文字 - 按钮
图像--- --------- ---------------文本 - 按钮
我点击按钮,他只是更改了他的行示例的文本:
IMAGE ------------ ---------------文本 - 按钮
图像------------ ----- ---------改变 - 按钮< - 点击
图像------------ ---------------文本 - 按钮
图像------------ ---------------文本 - 按钮
和..
IMAGE ------------ ---------------文本 - 按钮
图像------------ ----- ----------文字 - 按钮
图像------------ ---------------文字 - 按钮
图像--- --------- --------------更改 - 按钮< - 点击
回想一下,并在片段列表中使用了一个适配器抱歉,我的英语很糟糕!
public class JAdapterList extends BaseAdapter implements OnClickListener {
private LayoutInflater mInflater;
private ArrayList<JItemList> itens;
public …Run Code Online (Sandbox Code Playgroud)