`
tracy061
  • 浏览: 63773 次
社区版块
存档分类
最新评论
文章列表

AlarmManager定时器

首先,获取系统服务:     private AlarmManager mAlarmManager; mAlarmManager = (AlarmManager)getSystemService(Context.ALARM_SERVICE); 然后,设置定时器: Intent intent = new Intent(this, Alerm.class); PendingIntent pendingIntent = PendingIntent.getActivity(this, _id, intent, 0); mAlarmManager.set(AlarmManager.RTC ...
检查manifest里面的的资源文件

Widget分区域点击

<?xml version="1.0" encoding="utf-8"?> <appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android" android:minHeight="72dp" android:minWidth="72dp" android:initialLayout="@layout/widget" <s ...

Widget分区域点击

  Widget配置文件:   package com.example.changewidget; import android.app.Activity; import android.app.PendingIntent; import android.appwidget.AppWidgetManager; import android.content.Intent; import android.os.Bundle; import android.util.Log; import android.view.View; import android.view.View ...
// 检查packageName对应app是否安装 public static boolean checkApkExist(Context context, String packageName) { if (packageName == null || "".equals(packageName)) return false; try { context.getPackageManager().getApplicationInfo(packageName, PackageManager.GET_UNINSTALLED_PAC ...
webView只提供了一个监听加载完毕的方法,但是没有提供监听显示完毕的方法。所以经过各种大师的帮忙,发现可以这样做来监听显示完毕,其中用到了回调函数。   1.重写webview,并且添加回调函数。setDf();   import android.content.Context; import android.graphics.Canvas; import android.util.AttributeSet; import android.webkit.WebView; public class MyWebView extends WebView{ interface ...
public static void startNetworkSettingActivity(Context context) { Intent intent = new Intent(); int sdkVersion = VERSION.SDK_INT; if (sdkVersion >= Env.ANDROID_4_0 ) { intent = new Intent(android.provider.Settings.ACTION_SETTINGS); } else { intent.setClassName("com.andr ...
TextView tv = (TextView) findViewById(R.id.webview); tv.setText(Html.fromHtml(url));

使用String资源

  getResources().getString(R.string.emailsend)
Intent returnIt = new Intent (Intent . ACTION_SEND ); //设置收件人 returnIt .putExtra(Intent . EXTRA_EMAIL , new String[]{getResources().getString(R.string.emailsend)}); //设置邮件主体 returnIt .putExtra(Intent . EXTRA_TEXT , getResources().getString(R.string.emailbody)); //设置邮件主题 returnIt .putExtra(In ...

导入外部数据库

package com.example.imputdatabase; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import android.content.Context; import android.database.sqlite.SQLiteDatabase; import android.os.Enviro ...
   BufferedReader br = new BufferedReader(new InputStreamReader( context.getResources().openRawResource(R.raw.hoax), "utf-8"), 100 * 1024); // 打开在raw文件夹中的hoax资源,资源格式是utf-8,指定每次读入一行为100*1024 String line; // 行读入 while ((line = br.readLine()) != null) { line = getREString(line,txtEndsi ...
问题描述:  添加了一个资源文件,然后所有引用到R资源都出错,原因是找不到资源文件,clean,fix,refresh都没有用, 以下为 gen文件夹内的信息。 /** Automatically generated file. DO NOT MODIFY */ package com.zdworks.legerdemain; public final class BuildConfig { public final static boolean DEBUG = true; }   问题原因: 添加的资源名字中包含大写字母,而这个是不合法的,因为资源文件 ...

String和int互化

String化为Int Integer.parseInt(String);   Int化为String 1.Int.toString(); 2.String.valueOf(Int);  
  问题描述:点击红色区域框,会点击到地图解决办法:android:clickable="true"
Global site tag (gtag.js) - Google Analytics