码迷,mamicode.com
首页 > 其他好文 > 详细

主函数天气

时间:2017-09-20 20:49:42      阅读:138      评论:0      收藏:0      [点我收藏+]

标签:def   bundle   null   extends   ext   sha   nba   man   prot   

package com.coolweather.android;

import android.content.Intent;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

import static com.baidu.location.h.i.R;

public class MainActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
if (prefs.getString("weather", null) != null) {
Intent intent = new Intent(this, WeatherActivity.class);
startActivity(intent);
finish();
}
else {
String weatherId="CN101110101";
Intent intent = new Intent(this, WeatherActivity.class);
intent.putExtra("weather_id", weatherId);
startActivity(intent);
finish();
}
}

}

主函数天气

标签:def   bundle   null   extends   ext   sha   nba   man   prot   

原文地址:http://www.cnblogs.com/tianzijiaozi/p/7563461.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!