我将数组传递给ajax请求任何人都可以建议我如何在我的php文件中获取数组。 JavaScript
realm.copyToRealmOrUpdate(new Setting(context.getString(R.string.status_pending), "pending", R.color. my_text_font_color));
答案 0 :(得分:1)
您可以像这样设置<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:orientation="vertical"
tools:context="com.taxsmart.greendoaex.GPSData">
<Button
android:id="@+id/saveDataD"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="saveDataD" />
<Button
android:id="@+id/fetchDataD"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="fetchDataD" />
</LinearLayout>
:
private void printFile(){
PrintManager printManager = (PrintManager) this.getSystemService(getApplicationContext().PRINT_SERVICE);
PrintDocumentAdapter pda = new PrintDocumentAdapter(){
@Override
public void onWrite(PageRange[] pages, ParcelFileDescriptor destination, CancellationSignal cancellationSignal, WriteResultCallback callback){
OutputStream output = null;
try {
output = new FileOutputStream(destination.getFileDescriptor());
byte[] buf = _responseBody;
output.write(buf);
callback.onWriteFinished(new PageRange[]{PageRange.ALL_PAGES});
} catch (FileNotFoundException ee){
//Catch exception
} catch (Exception e) {
//Catch exception
} finally {
try {
output.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
@Override
public void onLayout(PrintAttributes oldAttributes, PrintAttributes newAttributes, CancellationSignal cancellationSignal, LayoutResultCallback callback, Bundle extras){
if (cancellationSignal.isCanceled()) {
callback.onLayoutCancelled();
return;
}
PrintDocumentInfo pdi = new PrintDocumentInfo.Builder("Name of file").setContentType(PrintDocumentInfo.CONTENT_TYPE_DOCUMENT).build();
callback.onLayoutFinished(pdi, true);
}
@Override
public void onFinish(){
System.out.println("PRINT IS FINISHED");
}
};
PrintAttributes printAttrs = new PrintAttributes.Builder().
setMediaSize(PrintAttributes.MediaSize.ISO_A6).
setMinMargins(PrintAttributes.Margins.NO_MARGINS).
build();
PrintJob printJob = printManager.print(labelID, pda, printAttrs);
}
你必须像array
这样获取数据:
var value1 = []; //Outside loop.
value1.push(document.getElementById(total_stock).value) //Inside loop.
希望它有所帮助。