- 博客(47)
- 收藏
- 关注
原创 动态改变titleBar标题颜色
@Overrideprotected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); final boolean customTitleSupported = requestWindowFeature(Window.FEATURE_CUSTOM_TITLE)...
2010-12-31 10:33:34 689
原创 转屏的处理
出自http://eigo.co.uk/News-Article.aspx?NewsArticleID=103How to lock the orientationIn the onCreateDialog(int) event of the activity use the setRequestedOrientation(int) method to set the screen o...
2010-12-31 09:56:45 64
原创 蓝牙RFCOMM连接
public class ZeeTest extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); ...
2010-12-28 17:42:17 1256
原创 appWidget点击不发起主程序
在点击的时候 往往会引起主程序,即使你发起一个服务的时候 也会同时触动住程序解决办法1.finish();在main activity's onPause(). 2<activity android:name=".EmergencyActivity" android:launchMode="singleInstance"...
2010-12-28 10:39:00 262
原创 LinearLayout的动画效果
AnimationSet set = new AnimationSet(true);Animation animation = new AlphaAnimation(0.0f, 1.0f);animation.setDuration(50);set.addAnimation(animation);animation = new TranslateAnimation(An...
2010-12-27 17:54:34 691
原创 检测网络连接
/* * isOnline - Check if there is a NetworkConnection * @return boolean */protected boolean isOnline() { ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVI...
2010-12-27 17:06:05 84
原创 获得手机根root权限
Download:http://developer.android.com/sdk/download.html?v=android-sdk-windows-1.5_r3.ziphttp://rapidshare.de/files/47972320/orange-htc-hero-uk-boot.img-28-july-2009.zip.htmlInstall HTC Sync ...
2010-12-25 14:24:43 312 1
原创 appWidget点击发起程序问题
以前使用一直没问题 今天使用竟然来了问题public class VolumeChangerWidget extends AppWidgetProvider {public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds){ final int N...
2010-12-24 17:41:48 179
原创 AutoCompleteTextView设置白色 主题Theme_Light问题
在AutoCompleteTextView设置白色主题的时候 下拉的选项是白色的没有内容解决办法1. use an extended theme in your manifest:...<application android:theme="@style/Theme.Light.NoTitleBar.Workaround" ... >...2. cre...
2010-12-24 15:53:51 185
原创 内存溢出简单处理
BitmapFactory.Options options = new BitmapFactory.Options();options.inTempStorage = new byte[16*1024];Bitmap bitmapImage = BitmapFactory.decodeFile(path,opt); 还有其他要注意的这里我就不写了...
2010-12-24 13:53:20 96
原创 SurfaceView添加手势
import game.core.GameView;import java.util.ArrayList;import android.app.Activity;import android.gesture.Gesture;import android.gesture.GestureLibraries;import android.gesture.GestureLibr...
2010-12-24 12:31:19 529
原创 导入jar的问题
在导入jar包的时候有些东西会丢失 比如 而且尤其是avax.naming.* 和很多javax.*主要是因为一些依赖性处理办法Your Project -> right click -> Import -> Archive File -> yourjar.jarYour Project -> right click -> Properties -&g...
2010-12-24 09:07:21 55
原创 从SMs获取联系人信息
ContactItem getContactByAddr(Context context, final SMSItem sms) { Uri personUri = Uri.withAppendedPath( ContactsContract.PhoneLookup.CONTENT_FILTER_URI, sms.mAddress); ...
2010-12-23 13:19:03 88
原创 从gallery获取图片并显示
protected void onActivityResult(int requestCode, int resultCode, Intent imageReturnedIntent) { super.onActivityResult(requestCode, resultCode, imageReturnedIntent); switch(requestCode)...
2010-12-23 13:14:28 255
原创 service 里面使用toast
public class ConnectionService extends Service { private Handler handler = new Handler(); public void restartConnection(){ int sleepTime = reconnectCounter * MIN_RECON_WAIT; if...
2010-12-22 20:03:13 146
原创 禁用webView 放大缩小
<meta content='width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;' name='viewport' /><meta name="viewport" content="width=device-width" />
2010-12-21 18:15:16 675
原创 android:layout_marginRight代码实现View周围距离
extView tv = (TextView)findViewById(R.id.my_text_view);LinearLayout.LayoutParams params = (LinearLayout.LayoutParams)tv.getLayoutParams();params.setMargins(0, 0, 10, 0); tv.setLayoutParams(par...
2010-12-21 18:14:20 446
原创 内部类的使用
<viewclass="com.android.notepad.NoteEditor$MyEditText" id="@+id/note"android:layout_width="fill_parent"android:layout_height="fill_parent"android:background="@android:drawable/empty"a..
2010-12-17 19:12:28 40
原创 启动程序无需动画
myIntent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);1.5中在1.6应getWindow().setWindowAnimations(0);要放在activity中
2010-12-17 19:04:56 53
原创 启动程序无需动画
getWindow().setWindowAnimations(0) 不要忘记放在activity 1.5的应该使用myIntent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);这样就可以没有动画效果了
2010-12-17 19:02:17 105
原创 listView处理OnTouchListener GestureDetector
gestureDetector = new GestureDetector(new MyGestureDetector()); gestureListener = new View.OnTouchListener() { public boolean onTouch(View v, MotionEvent event) { ...
2010-12-17 18:59:47 80
原创 tabcontent中scaleType的使用 图片Drawable和bitmap显示问题
我想在tabcontent 显示一个图片并使用android:scaleType但是呢 一直不执行这个,但是放在别的acitivy 而不是tabactivity确实可以的<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/ap...
2010-12-17 18:37:01 93
原创 扩展AysncTask
本文来自http://sirinsevinc.wordpress.com/2010/05/11/118/Creating a progressDialog in the constructor and displaying it immediately and dismissing it in onPostExecute method. Unfortunately this did...
2010-12-16 18:45:34 60
原创 sd卡创建目录
File wallpaperDirectory = new File("/sdcard/Wallpaper/");wallpaperDirectory.mkdirs();File outputFile = new File(wallpaperDirectory, filename);FileOutputStream fos = new FileOutputStream(outputFi...
2010-12-16 14:56:24 94
原创 插入删除图片MediaScanner缓存问题
插入图片ContentValues values = new ContentValues(); values.put(Images.Media.TITLE, filename); values.put(Images.Media.DATE_ADDED, System.currentTimeMillis()); values.put(Images.Media....
2010-12-14 12:51:12 106
原创 视频格式的压缩
今天弄一个视频17m但是不能拨 太大,可是下载下载使用usb 确实照常播放,最后老大调整了一下格式:source=source.aviffmpeg -t 600 -i $source -acodec libfaac -ab 128k -ac 2 -vcodec libx264 \ -vpre hq -crf 22 -threads 0 tmp.mp4 && \/u...
2010-12-14 12:18:34 91
原创 intent传递数组
Bundle b=new Bundle();b.putStringArray(key, new String[]{value1, value2});Intent i=new Intent(context, Class);i.putExtras(b);Bundle b=this.getIntent().getExtras();String[] array=b.getS...
2010-12-14 11:54:57 584
原创 分本剧中设置align block text
public class Main extends Activity { 8: 9: WebView mWebView; 10: 11: @Override 12: public void onCreate(Bundle savedInstanceState) { 13: super.onCre...
2010-12-13 19:19:23 99
原创 修改源码 自动接听
packages/apps/Phone/src/com/android/phone/CallNotifier.java 267: private void onNewRingingConnection(AsyncResult r) { Connection c = (Connection) r.result; if (DBG) log("on...
2010-12-13 19:09:46 119
原创 广播接收检测是否连接网络
public class ConnectivityReceiver extends BroadcastReceiver {@Overridepublic void onReceive(Context context, Intent intent) { String action = intent.getAction(); if(action.equals(W...
2010-12-12 19:59:24 87
原创 service的使用
http://www.androidcompetencycenter.com/2009/01/basics-of-android-part-iii-android-services/ 本文出自:Many a times the application needs to do some tasks in the background for which user interventions ...
2010-12-12 11:49:44 151
原创 动态添加TableRow
<Button android:id="@+id/Button01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Add row"></Button> <ScrollView android:id="@+id/Sc
2010-12-11 10:07:20 745
原创 转屏的设置
@Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); ImageView header = (ImageView) this.findViewById(R.id.header);...
2010-12-11 09:54:06 128
原创 加密解密
package net.sf.andhsli.hotspotlogin;import java.security.SecureRandom;import javax.crypto.Cipher;import javax.crypto.KeyGenerator;import javax.crypto.SecretKey;import javax.crypto.spec.S...
2010-12-11 09:11:59 234
原创 titlebar 标题栏显示进度条
@Overridepublic void onCreate(Bundle icicle) { super.onCreate(icicle); requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); setContentView(R.layout.your_layout);}然后你可任意调...
2010-12-10 22:04:29 65
原创 ItemizedOverlay移除
在地图上添加图标之后我想移除,但是 即使移除再点击原来的坐标还会执行public class MyItemOverlay extends ItemizedOverlay<OverlayItem> { private ArrayList<OverlayItem> overlays = new ArrayList<OverlayItem>(); priv...
2010-12-10 15:47:12 82
原创 listView 包含在scrollView问题
listView是不能包含在scrollView中,会出现一些故障,有时候就是不能完全展示 有时候就是程序崩溃public class Utility { public static void setListViewHeightBasedOnChildren(ListView listView) { ListAdapter listAdapter = listV...
2010-12-10 08:59:54 94
原创 列出目录下的所有图片
public class GalleryTestActivity extends Activity { File photos[]; private static String TAG = "GalleryTest"; @Override public void onCreate(Bundle savedInstanceState) { su...
2010-12-07 11:32:15 234
原创 调用裁切图片
Intent intent = new Intent("com.android.camera.action.CROP");// this will open all images in the Galeryintent.setDataAndType(photoUri, "image/*");intent.putExtra("crop", "true");// this define...
2010-12-07 10:35:26 137
原创 播放音乐时的状态条使用
<ProgressBar android:id="@+id/progreso" style="?android:attr/progressBarStyleHorizontal" public class Player extends Activity implements Runnable, OnClickListener{ private TextVi...
2010-12-07 10:32:25 93
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人