我有2个服务,其中一个是生产者(将对象保存到领域),以及其他从领域读取此对象并在计划任务中将它们发送到REST服务.
我的例外:
java.lang.IllegalStateException: Realm access from incorrect thread. Realm objects can only be accessed on the thread they were created.
Run Code Online (Sandbox Code Playgroud)
服务1:
this.scheduler.schedule("*/2 * * * *", new Runnable() {
public void run() {
List<Location> locations = dataStore.getAll(Location.class);
for(Location l : locations) {
try {
serverEndpoint.putLocation(l);
l.removeFromRealm();
} catch (SendingException e) {
Log.i(this.getClass().getName(), "Sending task is active!");
}
}
}
});
Run Code Online (Sandbox Code Playgroud)
服务2:
private LocationListener locationListener = new android.location.LocationListener() {
@Override
public void onLocationChanged(Location location) {
TLocation transferLocation = new TLocation();
transferLocation.setLat( …Run Code Online (Sandbox Code Playgroud) 我创建了一个IntentService,如下所示:
public class OrdersSyncService extends IntentService {
private static final String TAG = OrdersSyncService.class.getSimpleName();
private Order orderObject;
public OrdersSyncService() {
super("OrdersSyncService");
}
@Override
protected void onHandleIntent(Intent intent) {
//Util.showToast(getApplicationContext(), "Syncing Orders........");
Log.d(TAG, "I'm running....");
syncOrders();
}
private void syncOrders() {
Database database = CouchBaseHelper.openCouchBaseDB(this);
JSONArray ordersJsonArray = new JSONArray(CouchBaseHelper.retrieveNotSyncedOrders(database));
if (ordersJsonArray.length() != 0) {
uploadOrders(ordersJsonArray.toString());
Log.d(TAG, "Orders syncing started.");
} else {
Log.d(TAG, "Nothing to sync.");
}
}
private void uploadOrders(String ordersJsonArray) {
RetrofitApi.ApiInterface apiInterface = RetrofitApi.getApiInterfaceInstance();
final Call<Order> uploadOrders …Run Code Online (Sandbox Code Playgroud) 我想将这样的东西发送到服务器
{
"InoorPersonID": "",
"Discount": 0,
"DiscountDescription": "",
"Description": "",
"OrderDetailList": [
{
"ProductID": 0,
"Amount": 0
}
],
"ClientId": "",
"ClientSecret": ""
}
Run Code Online (Sandbox Code Playgroud)
这是我的服务接口
public interface StoreRetrofitSalesService {
@FormUrlEncoded
@POST(ServiceUrl.URL_ORDER_SET)
Call<ServiceResult<Integer>> orderSet(@Field("OrderDetailList") ArrayList<OrderDetail> orderDetails,
@Field("Discount") String discount,
@Field("ClientId") String clientId,
@Field("ClientSecret") String clientSecret,
@Field("Description") String description,
@Field("InoorPersonID") String inoorPersonId,
@Field("DiscountDescription") String discountDescription);
}
Run Code Online (Sandbox Code Playgroud)
logcat 显示了这一点
OrderDetailList=org.crcis.noorreader.store.OrderDetail%408208296&Discount=0&...
Run Code Online (Sandbox Code Playgroud)
我有两个问题:
Map<String, Object>但它返回相同的结果。谢谢
如何调试我现在遇到的错误.我正在创建一个应用程序,可以使用谷歌地图找到当前位置然后我有一些如何做的教程.但是错误出现了.
*Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Inverse'.
<style name="Base.TextAppearance.AppCompat.Widget.Button.Inverse"
parent="android:TextAppearance.Material.Widget.Button.Inverse"/>
*Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button.Colored'.`
<style name="Base.Widget.AppCompat.Button.Colored"
parent="android:Widget.Material.Button.Colored"/>
Run Code Online (Sandbox Code Playgroud)
他们属于
*C:\Users\rifrancisco\Desktop\androidprojects\MapsII\app\build\intermediates\exploded-aar\com.android.support\appcompat-v7\23.1.1\res\values-v23\values-v23.xml
我正在使用Android Studio 1.3,SDK平台高达5.x(MNC),并且安装了所有SDK工具
我怎么解决这个问题?我也尝试在项目结构中将版本更改为v23但仍然相同..这是我的代码
MyActivity
import android.content.Context;
import android.location.Criteria;
import android.location.Location;
import android.location.LocationManager;
import android.support.v4.app.FragmentActivity;
import android.os.Bundle;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MarkerOptions;
public class MapsActivity extends FragmentActivity {
private GoogleMap mMap; // Might be null if …Run Code Online (Sandbox Code Playgroud)