我在警报管理器中使用IntentService每15秒触发一次.我必须不断向服务器发送大量数据并在后台接收大量数据.我必须遵循以下流程:
我正在通过查询从数据库中读取数据.
然后通过POJO架构在Json中转换它.
使用Retrofit Library将此JSON请求发送到服务器.
接收数据作为回应.
如果数据库中有任何更新,则通过某些查询将此数据插入我的数据库.
还有其他方法吗?因为我正面临着ANR.如果数据较少,则其工作正常.但随着数据量变大,UI停止运行,应用程序变得无法响应.
我正在使用fragmentActivity for maps.In Java类在setContentView上获取错误.我的Mapscreen.java就像:它在某些设备上工作正常,只显示棉花糖的崩溃.或者还有其他原因吗?
public class MapScreen extends FragmentActivity implements LocationListener,
GoogleApiClient.ConnectionCallbacks,
GoogleApiClient.OnConnectionFailedListener {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.map_screen);
....
SupportMapFragment fm = (SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.map);
googleMap = fm.getMap();
}
and my xml has fragment using SupportMapFragment as well. map_screen.xml is like :
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<fragment
android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true" />
<ImageView
android:id="@+id/startActivityButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginLeft="50dp"
android:layout_marginRight="50dp"
android:layout_marginBottom="44dp"
android:background="@drawable/end_meetup_btn"
/>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
我无法找到相同的问题在Marshmallow中遇到崩溃:"二进制XML文件行#7:错误膨胀类片段"请建议! 试图找到"引起:java.lang.NullPointerException:尝试在空对象引用上调用虚方法'boolean …