当我运行我的应用程序时,手机上会出现临时屏幕(屏幕上包含加载数据),但请注意之后!
MainActivity:
@SuppressLint("WrongViewCast")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
admob.initialInterstitial(this);
AppUpdater appUpdater = new AppUpdater(this)
.setContentOnUpdateAvailable("Check out the latest version available to get the latest features and bug fixes")
.setCancelable(false)
.setButtonDoNotShowAgain(null)
.setButtonUpdate("Update now")
.setButtonDismiss("later")
.setTitleOnUpdateNotAvailable("Update not available")
.setContentOnUpdateNotAvailable("No update available. Check for updates again later!");
appUpdater.start();
sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this);
editor = sharedPrefs.edit();
gson = new Gson();
String json = sharedPrefs.getString("favorites", "");
if(json!="") {
Type type = new TypeToken<List<String>>(){}.getType();
listFavorites = gson.fromJson(json, type);
}
MainFragment fragment1 = new MainFragment();
android.support.v4.app.FragmentTransaction fragmentTransaction =
getSupportFragmentManager().beginTransaction();
fragmentTransaction.replace(R.id.fragementMain, fragment1);
fragmentTransaction.commit();
setTitle(getResources().getString(R.string.app_name));
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
drawer.addDrawerListener(toggle);
toggle.syncState();
NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
navigationView.setNavigationItemSelectedListener(this);
}
@Override
public void onBackPressed() {
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
if (drawer.isDrawerOpen(GravityCompat.START)) {
drawer.closeDrawer(GravityCompat.START);
} else {
// super.onBackPressed();
showRateDialog(MainActivity.this);
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main_activity, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
SettingsFragment fragment2 = new SettingsFragment();
android.support.v4.app.FragmentTransaction fragmentTransaction =
getSupportFragmentManager().beginTransaction();
fragmentTransaction.replace(R.id.fragementMain, fragment2);
fragmentTransaction.commit();
setTitle("Settings");
admob.showInterstitial(true);
return true;
}
return super.onOptionsItemSelected(item);
}
Logcat:
09-04 19:20:47.152 2832-3093 /? D / wifi:android_net_wifi_getLinkLayerStats:radio_stat.rx_time = 0 09-04 19:20:47.157 2832-3093 /? D / WifiStateMachine:当前网络是: “ TAMRAGHT HOUSE”,ID为:17 由于流量繁忙,当前网络仍然合格,txSuccessRate = 0.8450937364250422 rxSuccessRate = 14.716940314741805 当前网络上的流量过大(txSuccessRate = 0.8450937364250422 rxSuccessRate = 14.716940314741805),纾困... 09-04 19:20:47.365 2832-2832 /? D / SSRM:g:printTemperature(AP = 380,PST = 379(W:18),BAT = 320,CHG = 0)09-04 19:20:47.474 2832-2844 /? I / art:背景粘性并发标记清除GC释放了78528(4MB)AllocSpace对象, 45(900KB)LOS对象,8%空闲,64MB / 71MB,暂停4.155ms 103.832ms 09-04 19:20:48.103 2832-2832 /? D / WifiTrafficPoller:notifyOnDataActivity()-mBusMaxLock.acquire()09-04 19:20:48.215 2832-3687 /?电子/看门狗:!@Sync 8087 [2018-09-04 19:20:48.214] 09-04 19:20:49.106 2832-2832 /? D / WifiTrafficPoller:notifyOnDataActivity()- mBusMaxLock.acquire()09-04 19:20:49.535 2832-7655 /? I /传感器:SENSOR :setDelayAcc 200000000(ns)09-04 19:20:49.538 4132-19817 /? D / SensorManager:unregisterListener :: 09-04 19:20:49.571 2832-7688 /? D / SamsungAlarmManager:setExact Intent(T:2 / F:1 / AC:false) 20180904T192054-CU:10019 / CP:4132 09-04 19:20:49.572 2832-7688 /? I / SamsungAlarmManager:setLocked to kernel-T:2 / 20180904T192054, SetElapsed = 526836991,nowELAPSED = 526832008 09-04 19:20:50.109 2832-2832 /? D / WifiTrafficPoller:notifyOnDataActivity()- mBusMaxLock.acquire()09-04 19:20:50.157 2832-3093 /? I / WifiHAL: 创建消息以获取链接统计信息09-04 19:20:50.160 2832-3093 /? D / WifiHAL:调用了response_handler 事件len = 1108 09-04 19:20:50.160 2832-3093 /? I / WifiHAL:在GetLinkStatsCommand :: handleResponse中 id = 0,subcmd = 0 09-04 19:20:50.160 2832-3093 /? D / wifi:onLinkStats结果:radio_stat.on_time = 0 onLinkStatsResults:radio_stat.tx_time = 0 onLinkStatsResults:radio_stat.rx_time = 0 09-04 19:20:50.160 2832-3093 /? D / WifiHAL:ack_handler称为09-04 19:20:50.161 2832-3093 /? D / wifi:android_net_wifi_getLinkLayerStats: radio_stat.on_time = 0 android_net_wifi_getLinkLayerStats:radio_stat.tx_time = 0 android_net_wifi_getLinkLayerStats:radio_stat.rx_time = 0