- 浏览: 928567 次
- 性别:
- 来自: 北京
文章分类
最新评论
-
itzhongyuan:
java Random类详解 -
david_je:
你好,我看到你在C里面回调JAVA里面的方法是在native里 ...
Android NDK开发(1)----- Java与C互相调用实例详解 -
fykyx521:
请求锁是在 oncreate 释放实在ondestroy?? ...
Android如何保持程序一直运行 -
aduo_vip:
不错,总结得好!
Android读取assets目录下的资源 -
f839903061:
给的网址很给力哦!
Android 4.0.1 源码下载,编译和运行
Android 3.0正式版API Level 11中加入了一个天气预报例子,下面是manifest.xml中的关键代码,只是少了xml的编码头:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.android.weatherlistwidget">
<uses-sdk android:minSdkVersion="11" />
<application android:label="Weather Widget Sample">
<receiver android:name="WeatherWidgetProvider">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data android:name="android.appwidget.provider"
android:resource="@xml/widgetinfo" />
</receiver>
<service android:name="WeatherWidgetService"
android:permission="android.permission.BIND_REMOTEVIEWS"
android:exported="false" />
<provider android:name="WeatherDataProvider"
android:authorities="com.example.android.weatherlistwidget.provider" />
</application>
</manifest>
这里WeatherDataProvider.java的源码为主要是ContentProvider相关的处理,这里作为appWidget的receiver
class WeatherDataPoint {
String city; //城市
int degrees; //度数
WeatherDataPoint(String c, int d) {
city = c;
degrees = d;
}
}
public class WeatherDataProvider extends ContentProvider {
public static final Uri CONTENT_URI =
Uri.parse("content://com.example.android.weatherlistwidget.provider");
public static class Columns {
public static final String ID = "_id";
public static final String CITY = "city";
public static final String TEMPERATURE = "temperature";
}
private static final ArrayList<WeatherDataPoint> sData = new ArrayList<WeatherDataPoint>();
@Override
public boolean onCreate() {
sData.add(new WeatherDataPoint("San Francisco", 13));
sData.add(new WeatherDataPoint("New York", 1));
sData.add(new WeatherDataPoint("Seattle", 7));
sData.add(new WeatherDataPoint("Boston", 4));
sData.add(new WeatherDataPoint("Miami", 22));
sData.add(new WeatherDataPoint("Toronto", -10));
sData.add(new WeatherDataPoint("Calgary", -13));
sData.add(new WeatherDataPoint("Tokyo",);
sData.add(new WeatherDataPoint("Kyoto", 11));
sData.add(new WeatherDataPoint("London", -1));
sData.add(new WeatherDataPoint("Nomanisan", 27));
return true;
}
@Override
public synchronized Cursor query(Uri uri, String[] projection, String selection,
String[] selectionArgs, String sortOrder) {
assert(uri.getPathSegments().isEmpty());
final MatrixCursor c = new MatrixCursor(
new String[]{ Columns.ID, Columns.CITY, Columns.TEMPERATURE });
for (int i = 0; i < sData.size(); ++i) {
final WeatherDataPoint data = sData.get(i);
c.addRow(new Object[]{ new Integer(i), data.city, new Integer(data.degrees) });
}
return c;
}
@Override
public String getType(Uri uri) {
return "vnd.android.cursor.dir/vnd.weatherlistwidget.citytemperature";
}
@Override
public Uri insert(Uri uri, ContentValues values) {
return null;
}
@Override
public int delete(Uri uri, String selection, String[] selectionArgs) {
return 0;
}
@Override
public synchronized int update(Uri uri, ContentValues values, String selection,
String[] selectionArgs) {
assert(uri.getPathSegments().size() == 1);
final int index = Integer.parseInt(uri.getPathSegments().get(0));
final MatrixCursor c = new MatrixCursor(
new String[]{ Columns.ID, Columns.CITY, Columns.TEMPERATURE });
assert(0 <= index && index < sData.size());
final WeatherDataPoint data = sData.get(index);
data.degrees = values.getAsInteger(Columns.TEMPERATURE);
getContext().getContentResolver().notifyChange(uri, null);
return 1;
}
}
上面可以看到,对于插入和删除没有做过多的处理,对于天气更新给出了详细的解决方法。
有关 WeatherWidgetProvider.java 主要是appWidget的核心,为provider
class WeatherDataProviderObserver extends ContentObserver { //监控数据库的变化
private AppWidgetManager mAppWidgetManager;
private ComponentName mComponentName;
WeatherDataProviderObserver(AppWidgetManager mgr, ComponentName cn, Handler h) {
super(h);
mAppWidgetManager = mgr;
mComponentName = cn;
}
@Override
public void onChange(boolean selfChange) {
mAppWidgetManager.notifyAppWidgetViewDataChanged(
mAppWidgetManager.getAppWidgetIds(mComponentName), R.id.weather_list);
}
}
public class WeatherWidgetProvider extends AppWidgetProvider {
public static String CLICK_ACTION = "com.example.android.weatherlistwidget.CLICK";
public static String REFRESH_ACTION = "com.example.android.weatherlistwidget.REFRESH";
public static String EXTRA_CITY_ID = "com.example.android.weatherlistwidget.city";
private static HandlerThread sWorkerThread;
private static Handler sWorkerQueue;
private static WeatherDataProviderObserver sDataObserver;
public WeatherWidgetProvider() {
sWorkerThread = new HandlerThread("WeatherWidgetProvider-worker"); //开一个线程,这里用到了HandlerThread
sWorkerThread.start();
sWorkerQueue = new Handler(sWorkerThread.getLooper()); //不了解Thread的Looper可以看下这个例子比较简单清晰
}
@Override
public void onEnabled(Context context) { //当appWidget添加到桌面上时
final ContentResolver r = context.getContentResolver();
if (sDataObserver == null) {
final AppWidgetManager mgr = AppWidgetManager.getInstance(context);
final ComponentName cn = new ComponentName(context, WeatherWidgetProvider.class);
sDataObserver = new WeatherDataProviderObserver(mgr, cn, sWorkerQueue);
r.registerContentObserver(WeatherDataProvider.CONTENT_URI, true, sDataObserver); //注册监控数据库变化的回调
}
}
@Override
public void onReceive(Context ctx, Intent intent) {
final String action = intent.getAction();
if (action.equals(REFRESH_ACTION)) { //接收数据库改变的回调广播
final Context context = ctx;
sWorkerQueue.removeMessages(0);
sWorkerQueue.post(new Runnable() {
@Override
public void run() {
final ContentResolver r = context.getContentResolver();
final Cursor c = r.query(WeatherDataProvider.CONTENT_URI, null, null, null,
null);
final int count = c.getCount();
final int maxDegrees = 96;
r.unregisterContentObserver(sDataObserver); //首先取消数据库监控
for (int i = 0; i < count; ++i) {
final Uri uri = ContentUris.withAppendedId(WeatherDataProvider.CONTENT_URI, i);
final ContentValues values = new ContentValues();
values.put(WeatherDataProvider.Columns.TEMPERATURE,
new Random().nextInt(maxDegrees));
r.update(uri, values, null, null); //更新数据库记录层
}
r.registerContentObserver(WeatherDataProvider.CONTENT_URI, true, sDataObserver); //重新设置监视数据库
final AppWidgetManager mgr = AppWidgetManager.getInstance(context);
final ComponentName cn = new ComponentName(context, WeatherWidgetProvider.class);
mgr.notifyAppWidgetViewDataChanged(mgr.getAppWidgetIds(cn), R.id.weather_list); //提示Widget有数据更新并刷新UI
}
});
} else if (action.equals(CLICK_ACTION)) {
final int appWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID,
AppWidgetManager.INVALID_APPWIDGET_ID);
final String city = intent.getStringExtra(EXTRA_CITY_ID);
final String formatStr = ctx.getResources().getString(R.string.toast_format_string);
Toast.makeText(ctx, String.format(formatStr, city), Toast.LENGTH_SHORT).show();
}
super.onReceive(ctx, intent);
}
@Override
public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
for (int i = 0; i < appWidgetIds.length; ++i) {
final Intent intent = new Intent(context, WeatherWidgetService.class); //当桌面上有多个这个相同的appWidget需要分别处理
intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetIds[i]);
intent.setData(Uri.parse(intent.toUri(Intent.URI_INTENT_SCHEME)));
final RemoteViews rv = new RemoteViews(context.getPackageName(), R.layout.widget_layout);
rv.setRemoteAdapter(appWidgetIds[i], R.id.weather_list, intent);
rv.setEmptyView(R.id.weather_list, R.id.empty_view);
final Intent onClickIntent = new Intent(context, WeatherWidgetProvider.class);
onClickIntent.setAction(WeatherWidgetProvider.CLICK_ACTION);
onClickIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetIds[i]);
onClickIntent.setData(Uri.parse(onClickIntent.toUri(Intent.URI_INTENT_SCHEME)));
final PendingIntent onClickPendingIntent = PendingIntent.getBroadcast(context, 0,
onClickIntent, PendingIntent.FLAG_UPDATE_CURRENT);
rv.setPendingIntentTemplate(R.id.weather_list, onClickPendingIntent);
final Intent refreshIntent = new Intent(context, WeatherWidgetProvider.class);
refreshIntent.setAction(WeatherWidgetProvider.REFRESH_ACTION);
final PendingIntent refreshPendingIntent = PendingIntent.getBroadcast(context, 0,
refreshIntent, PendingIntent.FLAG_UPDATE_CURRENT);
rv.setOnClickPendingIntent(R.id.refresh, refreshPendingIntent);
appWidgetManager.updateAppWidget(appWidgetIds[i], rv);
}
super.onUpdate(context, appWidgetManager, appWidgetIds);
}
}
对于WeatherWidgetService.java这个Service集成于RemoteViewsService,主要是UI上的处理
public class WeatherWidgetService extends RemoteViewsService {
@Override
public RemoteViewsFactory onGetViewFactory(Intent intent) {
return new StackRemoteViewsFactory(this.getApplicationContext(), intent);
}
}
class StackRemoteViewsFactory implements RemoteViewsService.RemoteViewsFactory {
private Context mContext;
private Cursor mCursor;
private int mAppWidgetId;
public StackRemoteViewsFactory(Context context, Intent intent) {
mContext = context;
mAppWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID,
AppWidgetManager.INVALID_APPWIDGET_ID);
}
public void onCreate() {
}
public void onDestroy() {
if (mCursor != null) {
mCursor.close();
}
}
public int getCount() {
return mCursor.getCount();
}
public RemoteViews getViewAt(int position) {
String city = "Unknown City";
int temp = 0;
if (mCursor.moveToPosition(position)) {
final int cityColIndex = mCursor.getColumnIndex(WeatherDataProvider.Columns.CITY);
final int tempColIndex = mCursor.getColumnIndex(
WeatherDataProvider.Columns.TEMPERATURE);
city = mCursor.getString(cityColIndex);
temp = mCursor.getInt(tempColIndex);
}
final String formatStr = mContext.getResources().getString(R.string.item_format_string);
final int itemId = (position % 2 == 0 ? R.layout.light_widget_item
: R.layout.dark_widget_item);
RemoteViews rv = new RemoteViews(mContext.getPackageName(), itemId);
rv.setTextViewText(R.id.widget_item, String.format(formatStr, temp, city));
final Intent fillInIntent = new Intent();
final Bundle extras = new Bundle();
extras.putString(WeatherWidgetProvider.EXTRA_CITY_ID, city);
fillInIntent.putExtras(extras);
rv.setOnClickFillInIntent(R.id.widget_item, fillInIntent);
return rv;
}
public RemoteViews getLoadingView() {
return null;
}
public int getViewTypeCount() {
return 2;
}
public long getItemId(int position) {
return position;
}
public boolean hasStableIds() {
return true;
}
public void onDataSetChanged() {
if (mCursor != null) {
mCursor.close();
}
mCursor = mContext.getContentResolver().query(WeatherDataProvider.CONTENT_URI, null, null,
null, null);
}
}
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.android.weatherlistwidget">
<uses-sdk android:minSdkVersion="11" />
<application android:label="Weather Widget Sample">
<receiver android:name="WeatherWidgetProvider">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data android:name="android.appwidget.provider"
android:resource="@xml/widgetinfo" />
</receiver>
<service android:name="WeatherWidgetService"
android:permission="android.permission.BIND_REMOTEVIEWS"
android:exported="false" />
<provider android:name="WeatherDataProvider"
android:authorities="com.example.android.weatherlistwidget.provider" />
</application>
</manifest>
这里WeatherDataProvider.java的源码为主要是ContentProvider相关的处理,这里作为appWidget的receiver
class WeatherDataPoint {
String city; //城市
int degrees; //度数
WeatherDataPoint(String c, int d) {
city = c;
degrees = d;
}
}
public class WeatherDataProvider extends ContentProvider {
public static final Uri CONTENT_URI =
Uri.parse("content://com.example.android.weatherlistwidget.provider");
public static class Columns {
public static final String ID = "_id";
public static final String CITY = "city";
public static final String TEMPERATURE = "temperature";
}
private static final ArrayList<WeatherDataPoint> sData = new ArrayList<WeatherDataPoint>();
@Override
public boolean onCreate() {
sData.add(new WeatherDataPoint("San Francisco", 13));
sData.add(new WeatherDataPoint("New York", 1));
sData.add(new WeatherDataPoint("Seattle", 7));
sData.add(new WeatherDataPoint("Boston", 4));
sData.add(new WeatherDataPoint("Miami", 22));
sData.add(new WeatherDataPoint("Toronto", -10));
sData.add(new WeatherDataPoint("Calgary", -13));
sData.add(new WeatherDataPoint("Tokyo",);
sData.add(new WeatherDataPoint("Kyoto", 11));
sData.add(new WeatherDataPoint("London", -1));
sData.add(new WeatherDataPoint("Nomanisan", 27));
return true;
}
@Override
public synchronized Cursor query(Uri uri, String[] projection, String selection,
String[] selectionArgs, String sortOrder) {
assert(uri.getPathSegments().isEmpty());
final MatrixCursor c = new MatrixCursor(
new String[]{ Columns.ID, Columns.CITY, Columns.TEMPERATURE });
for (int i = 0; i < sData.size(); ++i) {
final WeatherDataPoint data = sData.get(i);
c.addRow(new Object[]{ new Integer(i), data.city, new Integer(data.degrees) });
}
return c;
}
@Override
public String getType(Uri uri) {
return "vnd.android.cursor.dir/vnd.weatherlistwidget.citytemperature";
}
@Override
public Uri insert(Uri uri, ContentValues values) {
return null;
}
@Override
public int delete(Uri uri, String selection, String[] selectionArgs) {
return 0;
}
@Override
public synchronized int update(Uri uri, ContentValues values, String selection,
String[] selectionArgs) {
assert(uri.getPathSegments().size() == 1);
final int index = Integer.parseInt(uri.getPathSegments().get(0));
final MatrixCursor c = new MatrixCursor(
new String[]{ Columns.ID, Columns.CITY, Columns.TEMPERATURE });
assert(0 <= index && index < sData.size());
final WeatherDataPoint data = sData.get(index);
data.degrees = values.getAsInteger(Columns.TEMPERATURE);
getContext().getContentResolver().notifyChange(uri, null);
return 1;
}
}
上面可以看到,对于插入和删除没有做过多的处理,对于天气更新给出了详细的解决方法。
有关 WeatherWidgetProvider.java 主要是appWidget的核心,为provider
class WeatherDataProviderObserver extends ContentObserver { //监控数据库的变化
private AppWidgetManager mAppWidgetManager;
private ComponentName mComponentName;
WeatherDataProviderObserver(AppWidgetManager mgr, ComponentName cn, Handler h) {
super(h);
mAppWidgetManager = mgr;
mComponentName = cn;
}
@Override
public void onChange(boolean selfChange) {
mAppWidgetManager.notifyAppWidgetViewDataChanged(
mAppWidgetManager.getAppWidgetIds(mComponentName), R.id.weather_list);
}
}
public class WeatherWidgetProvider extends AppWidgetProvider {
public static String CLICK_ACTION = "com.example.android.weatherlistwidget.CLICK";
public static String REFRESH_ACTION = "com.example.android.weatherlistwidget.REFRESH";
public static String EXTRA_CITY_ID = "com.example.android.weatherlistwidget.city";
private static HandlerThread sWorkerThread;
private static Handler sWorkerQueue;
private static WeatherDataProviderObserver sDataObserver;
public WeatherWidgetProvider() {
sWorkerThread = new HandlerThread("WeatherWidgetProvider-worker"); //开一个线程,这里用到了HandlerThread
sWorkerThread.start();
sWorkerQueue = new Handler(sWorkerThread.getLooper()); //不了解Thread的Looper可以看下这个例子比较简单清晰
}
@Override
public void onEnabled(Context context) { //当appWidget添加到桌面上时
final ContentResolver r = context.getContentResolver();
if (sDataObserver == null) {
final AppWidgetManager mgr = AppWidgetManager.getInstance(context);
final ComponentName cn = new ComponentName(context, WeatherWidgetProvider.class);
sDataObserver = new WeatherDataProviderObserver(mgr, cn, sWorkerQueue);
r.registerContentObserver(WeatherDataProvider.CONTENT_URI, true, sDataObserver); //注册监控数据库变化的回调
}
}
@Override
public void onReceive(Context ctx, Intent intent) {
final String action = intent.getAction();
if (action.equals(REFRESH_ACTION)) { //接收数据库改变的回调广播
final Context context = ctx;
sWorkerQueue.removeMessages(0);
sWorkerQueue.post(new Runnable() {
@Override
public void run() {
final ContentResolver r = context.getContentResolver();
final Cursor c = r.query(WeatherDataProvider.CONTENT_URI, null, null, null,
null);
final int count = c.getCount();
final int maxDegrees = 96;
r.unregisterContentObserver(sDataObserver); //首先取消数据库监控
for (int i = 0; i < count; ++i) {
final Uri uri = ContentUris.withAppendedId(WeatherDataProvider.CONTENT_URI, i);
final ContentValues values = new ContentValues();
values.put(WeatherDataProvider.Columns.TEMPERATURE,
new Random().nextInt(maxDegrees));
r.update(uri, values, null, null); //更新数据库记录层
}
r.registerContentObserver(WeatherDataProvider.CONTENT_URI, true, sDataObserver); //重新设置监视数据库
final AppWidgetManager mgr = AppWidgetManager.getInstance(context);
final ComponentName cn = new ComponentName(context, WeatherWidgetProvider.class);
mgr.notifyAppWidgetViewDataChanged(mgr.getAppWidgetIds(cn), R.id.weather_list); //提示Widget有数据更新并刷新UI
}
});
} else if (action.equals(CLICK_ACTION)) {
final int appWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID,
AppWidgetManager.INVALID_APPWIDGET_ID);
final String city = intent.getStringExtra(EXTRA_CITY_ID);
final String formatStr = ctx.getResources().getString(R.string.toast_format_string);
Toast.makeText(ctx, String.format(formatStr, city), Toast.LENGTH_SHORT).show();
}
super.onReceive(ctx, intent);
}
@Override
public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
for (int i = 0; i < appWidgetIds.length; ++i) {
final Intent intent = new Intent(context, WeatherWidgetService.class); //当桌面上有多个这个相同的appWidget需要分别处理
intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetIds[i]);
intent.setData(Uri.parse(intent.toUri(Intent.URI_INTENT_SCHEME)));
final RemoteViews rv = new RemoteViews(context.getPackageName(), R.layout.widget_layout);
rv.setRemoteAdapter(appWidgetIds[i], R.id.weather_list, intent);
rv.setEmptyView(R.id.weather_list, R.id.empty_view);
final Intent onClickIntent = new Intent(context, WeatherWidgetProvider.class);
onClickIntent.setAction(WeatherWidgetProvider.CLICK_ACTION);
onClickIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetIds[i]);
onClickIntent.setData(Uri.parse(onClickIntent.toUri(Intent.URI_INTENT_SCHEME)));
final PendingIntent onClickPendingIntent = PendingIntent.getBroadcast(context, 0,
onClickIntent, PendingIntent.FLAG_UPDATE_CURRENT);
rv.setPendingIntentTemplate(R.id.weather_list, onClickPendingIntent);
final Intent refreshIntent = new Intent(context, WeatherWidgetProvider.class);
refreshIntent.setAction(WeatherWidgetProvider.REFRESH_ACTION);
final PendingIntent refreshPendingIntent = PendingIntent.getBroadcast(context, 0,
refreshIntent, PendingIntent.FLAG_UPDATE_CURRENT);
rv.setOnClickPendingIntent(R.id.refresh, refreshPendingIntent);
appWidgetManager.updateAppWidget(appWidgetIds[i], rv);
}
super.onUpdate(context, appWidgetManager, appWidgetIds);
}
}
对于WeatherWidgetService.java这个Service集成于RemoteViewsService,主要是UI上的处理
public class WeatherWidgetService extends RemoteViewsService {
@Override
public RemoteViewsFactory onGetViewFactory(Intent intent) {
return new StackRemoteViewsFactory(this.getApplicationContext(), intent);
}
}
class StackRemoteViewsFactory implements RemoteViewsService.RemoteViewsFactory {
private Context mContext;
private Cursor mCursor;
private int mAppWidgetId;
public StackRemoteViewsFactory(Context context, Intent intent) {
mContext = context;
mAppWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID,
AppWidgetManager.INVALID_APPWIDGET_ID);
}
public void onCreate() {
}
public void onDestroy() {
if (mCursor != null) {
mCursor.close();
}
}
public int getCount() {
return mCursor.getCount();
}
public RemoteViews getViewAt(int position) {
String city = "Unknown City";
int temp = 0;
if (mCursor.moveToPosition(position)) {
final int cityColIndex = mCursor.getColumnIndex(WeatherDataProvider.Columns.CITY);
final int tempColIndex = mCursor.getColumnIndex(
WeatherDataProvider.Columns.TEMPERATURE);
city = mCursor.getString(cityColIndex);
temp = mCursor.getInt(tempColIndex);
}
final String formatStr = mContext.getResources().getString(R.string.item_format_string);
final int itemId = (position % 2 == 0 ? R.layout.light_widget_item
: R.layout.dark_widget_item);
RemoteViews rv = new RemoteViews(mContext.getPackageName(), itemId);
rv.setTextViewText(R.id.widget_item, String.format(formatStr, temp, city));
final Intent fillInIntent = new Intent();
final Bundle extras = new Bundle();
extras.putString(WeatherWidgetProvider.EXTRA_CITY_ID, city);
fillInIntent.putExtras(extras);
rv.setOnClickFillInIntent(R.id.widget_item, fillInIntent);
return rv;
}
public RemoteViews getLoadingView() {
return null;
}
public int getViewTypeCount() {
return 2;
}
public long getItemId(int position) {
return position;
}
public boolean hasStableIds() {
return true;
}
public void onDataSetChanged() {
if (mCursor != null) {
mCursor.close();
}
mCursor = mContext.getContentResolver().query(WeatherDataProvider.CONTENT_URI, null, null,
null, null);
}
}
发表评论
-
Android使用binder访问service的方式
2013-08-23 09:42 16291. 我们先来看一个与本地service通信的例子。 pub ... -
android-Service和Thread的区别
2013-08-23 09:17 913servie是系统的组件,它由系统进程托管(servicema ... -
git介绍
2013-08-01 14:49 1029git介绍 使用Git的第一件事就是设置你的名字和email ... -
cocos2d-x学习之自动内存管理和常见宏
2013-07-29 15:41 9071.自动内存管理 1)概述 C++语言默认是 ... -
cocos2dx中利用xcode 调用java中的函数
2013-07-29 11:36 25231. 先把cocos2dx根目录中的 /Users/zhaos ... -
cocos2dx(v2.x)与(v1.x)的一些常用函数区别讲解
2013-07-29 10:35 1108第一个改动: CCLayer初始化 自定义Layer,类名 ... -
xcode与eclipse整合cocos2dx
2013-07-29 10:32 1219文档xcode版本是 204 1. 在xcode中创建coc ... -
git提交代码
2013-07-23 16:00 10481. 在本地创建一个Git的工作空间,在里面创建一个工程(如H ... -
Android.mk的用法和基础
2013-07-19 14:11 4329一个Android.mk file用来向编译系统描述你的源代码 ... -
eclipse配置NDK-Builder命令
2013-07-18 11:02 10341. 2. -
eclipse配置javah命令
2013-07-18 10:48 19931.找到javah命令所在的目录 我的为 /usr/bi ... -
Android SDL2.0 编译
2013-07-17 13:40 19651,下载: wget http://www.libsdl.o ... -
IntelliJ Idea 常用快捷键列表
2013-05-27 10:19 0Alt+回车 导入包,自动修 ... -
android应用后台安装
2013-05-21 12:02 1012android应用后台安装,静默安装的代码实现方法 http ... -
编译linux内核映像
2013-05-21 11:33 960a)准备交叉编译工具链 android代码树中有一个pr ... -
如何单独编译Android源代码中的模块
2013-05-21 11:29 992一. 首先在Android源代码 ... -
Ubuntu安装JDK6和JDK5
2013-05-19 19:04 1006sudo apt-get install sun-java6- ... -
java_jni详解_01
2013-05-08 17:15 956java中的jni 例子HelloWorld 准备过程: 1 ... -
下载android源码 中断解决原因
2013-05-07 15:51 1313解决方法 1. 浏览器登录https://android.go ... -
mac下编译ffmpeg1.1.4
2013-05-07 14:55 1362经过一番网上搜索 与 无数次的编译 终于成功了 下面献上编译 ...
相关推荐
在Android 3.0 (API Level 11)中,官方提供了一个天气预报的例子,它包含了一个天气小部件(appWidget)的实现。这个例子帮助开发者理解如何创建自定义的小部件,以及如何利用ContentProvider来存储和检索数据。以下...
Android Studio实现天气预报APP系统源码(也可做Android本科毕业设计Android Studio实现天气预报APP系统源码(也可做Android本科毕业设计Android Studio实现天气预报APP系统源码(也可做Android本科毕业设计Android ...
在Android开发中,Action Bar是自Android 3.0(API级别11)引入的一个重要设计元素,它提供了一个统一的界面,用于显示应用程序的标识、主要操作以及导航选项。然而,对于运行在Android 3.0以下版本的设备,Action ...
Android天气预报程序源代码,获取的Google的天气API数据,自己可再次扩展,这里运行截图比较难抓,有环境的就下载源码测试吧,Android天气预报WeatherForecast似乎是常见而又简单的Android初级例子,但想开发出一款...
安卓期末大作业Android天气预报app源码安卓期末大作业Android天气预报app源码安卓期末大作业Android天气预报app源码安卓期末大作业Android天气预报app源码安卓期末大作业Android天气预报app源码安卓期末大作业...
本次项目主要实现了天气预报功能。通过调用天气预报接口来获得天气数据,用LIstView和GridView来搭建每个界面,将查询的天气信息存储在SQLiteDatabase中。应用主要包括了五大界面,每一个界面上都会有很多组件: - ...
Android 3.0的开发包源代码对于深入理解Android系统的内部工作原理、进行系统级定制以及开发高性能应用具有重要意义。 在Android 3.0的源代码中,我们可以找到以下几个关键的知识点: 1. **UI重构**:Android 3.0...
在Android Studio中实现一个天气预报小程序,涉及到许多关键的Android开发技术。首先,我们需要了解Android Studio作为集成开发环境(IDE)的基本使用,包括项目创建、布局设计、代码编写以及调试等流程。 1. **...
android3.0新增UI控件示例说明android3.0新增UI控件示例说明
本文将深入探讨基于Android的天气预报源代码的相关知识点,包括但不限于API接口的使用、数据解析、UI设计以及网络请求处理等方面。 首先,Android天气预报应用的核心是获取并展示天气数据。这些数据通常来自第三方...
"android天气预报代码"这个项目,从标题来看,显然是一个实现显示城市天气信息的应用程序,能够提供当前城市及未来三天的天气预报。 首先,我们来探讨Android应用的基本结构。一个标准的Android应用通常包含多个...
移动 android studio 天气预报。 最近买了本书《Android第一行代码》,通篇看了下感觉不错,书本最后有个实战项目酷欧天气,闲来无事就照着敲了一遍代码,主要在请求天气接口和背景优化做了些小改动,现在来记录下。...
本项目名为"PalmarWeather",显然是一个专业的商业级Android天气预报源代码,它为我们揭示了实现此类应用的高级技巧和最佳实践。 1. **网络通信**:在天气预报应用中,通常会与一些开放的天气API(如OpenWeatherMap...
然而,随着版本的更新,有些问题也随之出现,例如在Android Studio 3.0版本中,部分用户遇到了使用输入法时的卡顿现象,这极大地影响了编码效率。针对这个问题,我们可以采取一些解决措施,而"解决Android Studio3.0...
【Android在线天气预报案例详解】 本案例主要涵盖了在Android平台上开发一个在线天气预报应用的核心知识点。这个项目非常适合初学者入门,因为它涉及到许多Android开发的基本概念和技术。以下将详细阐述其中的关键...
使用AndroidStudio开发的天气预报APP源代码 (安卓期末大作业)使用AndroidStudio开发的天气预报APP源代码 (安卓期末大作业)使用AndroidStudio开发的天气预报APP源代码 (安卓期末大作业)使用AndroidStudio开发的...
**Android 3.0 SDK API 11详解** Android 3.0,代号Honeycomb,是Google针对平板电脑优化的一个重要版本,其API级别为11。这个版本的发布标志着Android开始全面进军大屏设备市场,为开发者提供了更多针对不同屏幕...
android天气预报源代码解析.doc
这个“安卓天气预报源代码”项目,作为一个安卓基础教程,旨在引导开发者实现一个能够获取并显示天气信息的应用。下面我们将详细探讨其中涉及的关键知识点。 首先,我们需要了解安卓应用的基本架构。一个安卓应用...
Android Studio3.0下载Android Studio3.0下载Android Studio3.0下载