CodeBus
www.codebus.net
Search
Sign in
Sign up
Hot Search :
Source
embeded
web
remote control
p2p
game
More...
Location :
Home
Search - INT 1
Main Category
SourceCode
Documents
Books
WEB Code
Develop Tools
Other resource
Search - INT 1 - List
[
android
]
data-storage(4)
DL : 0
两个方法 1. openFileOutput (String name, int mode) name:文件的名称,不能包含分隔符"/",如果文件不存在,Android会自动创建它。创建的文件保存在/data/data/<package_name>/files目录下。 mode:操作模式 2. openFileInput (String name) -Two methods 1. OpenFileOutput (String name, int mode) name: file name, can not contain the delimiter " /" if the file does not exist, Android will automatically create it. Create a file in/data/data/<package_name>/Files directory. mode: operation mode 2. openFileInput (String name)
Date
: 2026-01-07
Size
: 15kb
User
:
玉树
[
android
]
FileSelector
DL : 0
private void ShowSelectFiles(){ String actionName = "SelectFiles" // 动作名 Intent i=new Intent(actionName) // 以下参数都不是必须的,参数名区分大小写 i.putExtra("Single", true) // 是否只能选择一个文件 i.putExtra("Path", "/mnt/") // 起始目录 i.putExtra("Type", "File") // 允许选择文件(File) 还是目录(Folder) 还是都可以(All) i.putExtra("Pattern", "\\.(wma|mp3|mid|wav)$") // 文件名必须匹配的正则表达式 try{ startActivityForResult(i,0) }catch(Exception ex){ Toast t =Toast.makeText(this, "请安装文件选择器", 1000) t.setGravity(Gravity.CENTER, 0, 0) t.show() } } protected void onActivityResult(int requestCode, int resultCode, Intent data) { if(resultCode==Activity.RESULT_OK){ ArrayList<String> listFile = data.getStringArrayListExtra("Result") //处理选中的文件.... }-file select this is file select
Date
: 2026-01-07
Size
: 42kb
User
:
gz
[
android
]
MobileGuess
DL : 0
MobileGuess Android手机上的猜数字小游戏源码,部分代码注释: public abstract int getGuessTimeLeft() //返回剩余猜测次数 public abstract String getNewNumber() //返回待猜数字 public abstract int getGuessTime() //返回可猜测总次数 public abstract int getGuessedTime() //返回已猜测次数 public abstract List getResults() //返回猜测结果集 @return 0,1,2三个数值。 0表示游戏结束; 1表示猜测成功; 2表示本次猜测失败,可继续猜测,判断输入数字是否合法(不能重复)-MobileGuess Android phone number guessing game source code, part of the code comments: public abstract int getGuessTimeLeft () // returns the remaining number of guesses public abstract String getNewNumber () // returns to be numberguess public abstract int getGuessTime () // returns to guess the total number of public abstract int getGuessedTime () // Returns the number of guesses public abstract List getResults () // returns to guess the result set @ return 0,1,2 three values. 0 means the game is over 1 for guessing success 2 speculated that this failure may continue to speculate, to determine the legality of the input number (not repeated)
Date
: 2026-01-07
Size
: 51kb
User
:
张龙
[
android
]
disassemble_xml
DL : 0
apk文件中的xml文件反编译,终端命令为 java -jar AXMLPrinter2.jar AndroidManifest.xml >1.xml 其中AndroidManifest.xml为源文件,1.xml为输出文件-disassmble for xml int apk files
Date
: 2026-01-07
Size
: 23kb
User
:
小名
[
android
]
func
DL : 0
自定义gallery组件,修改android原gallery的不足-private View mContentView private ImageAdapter mAdapter private MyGallery mGallery private ImageButton mLeftImageButton private ImageButton mRightImageButton private int mPosition
Date
: 2026-01-07
Size
: 27kb
User
:
张达文
[
android
]
DragListView
DL : 0
可以拖动的ListView,实现手动拖动的ListView 可以拖动的ListView,实现手动拖动的ListView-DragListView package com.tarena.draglist.demo import java.util.List import android.content.Context import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import android.widget.BaseAdapter import android.widget.TextView public class DragListAdapter extends BaseAdapter { Context context LayoutInflater inflater List<String> groupN public DragListAdapter(Context con, List<String>groupname) { this.groupN = groupname this.context = con inflater = LayoutInflater.from(con) } @Override public int getCount() { return groupN.size() } @Override public Object getItem(int position) { return groupN.get(position) } public void remove(String group) { int index=groupN.indexOf(group) groupN.remove(index) notifyDataSetChanged() } public void insert(String grname, int postion) { groupN.add(postion, grname) notifyDataSetChanged() } @Override
Date
: 2026-01-07
Size
: 203kb
User
:
zhengyunguang
[
android
]
AndroidKeyEventMoveGif
DL : 0
Android 响应键盘移动图标,程序很简短,也很清楚直观.利用android.view.SurfaceView建立视图。通过使用键盘事件,熟悉SurfaceView画布的用法。-public boolean onKeyDown(int keyCode, KeyEvent event) { // TODO Auto-generated method stub switch (keyCode) { case KeyEvent.KEYCODE_DPAD_UP: up=true break case KeyEvent.KEYCODE_DPAD_DOWN: down=true break case KeyEvent.KEYCODE_DPAD_LEFT: left=true break case KeyEvent.KEYCODE_DPAD_RIGHT: right=true break
Date
: 2026-01-07
Size
: 115kb
User
:
duanmu
[
android
]
clockgood
DL : 0
比较实用的,绘制表盘的外观、绘制表盘上的小刻度和大刻度也是值得参考的,表盘分割成60份,将分割点处的坐标存放在数组中,每当小程序重新开始时,首先消灭线程,然后重新开始创建线程。12点各个时针的位置坐标(按新坐标系的坐标)。 Thread 时针=null, 分针=null,秒针=null //用来表示时针、分针和秒针的线程。 //表示时针、分针、秒针端点的整型变量: int hour_a,hour_b,munite_a,munite_b,second_a,second_b //用来获取当前时间的整型变量: int hour=0,munite=0,second=0 //用来绘制时针、分针和秒针的Grapghics对象: Graphics g_second=null,g_munite=null,g_hour=null //用来存放表盘刻度的数组,供指针走动时使用: double point_x[]=new double[61],point_y[]=new double[61] //用来存放表盘刻度的数组,供绘制表盘使用: double scaled_x[]=new double[61],scaled_y[]=new double[61] //用来判断小程序是否重新开始的变量-More practical , drawing dial appearance, small-scale and large- scale drawn on the dial is also worth noting, and the dial is divided into 60 parts , the dividing point coordinates stored in the array, whenever the applet to start again, first eliminate thread, and then re- start the creation of threads . 12:00 position coordinates of each of the hour hand ( by the new coordinate system coordinates ) . Thread hour = null, minute = null, seconds = null // used to indicate the hour, minute and second hand threads. //Represents the hour, minute , second hand endpoint integer variables : int hour_a, hour_b, munite_a, munite_b, second_a, second_b //Used to get the current time integer variables : int hour = 0, munite = 0, second = 0 //Used to draw the hour, minute and second hands Grapghics object : Graphics g_second = null, g_munite = null, g_hour = null //Used to store an array of dial scale , move the pointer used for : double point_x [] = new double [61], point_y [] = new d
Date
: 2026-01-07
Size
: 2kb
User
:
rpudn59
[
android
]
mousetrack
DL : 0
知识点:使用Graphics类制作方块,使用java.awt.Event类响应鼠标动作,使用Color类设置方块的颜色,使用int类记录光标的位置。 实现思路:首先要制作界面中的方块,通过Graphics类的对象函数g.setColor(Color.red)设置方块的颜色为红色,然后通过语句g.drawRect(0, 0, size().width - 1, size().height - 1)和g.drawRect(mx, my, (size().width/10) - 1, (size().height/10) - 1)绘制出两个矩形,完成方块的制作。然后实现“抓不住的方块”效果,要响应鼠标事件,通过函数public boolean mouseDown(java.awt.Event evt, int x, int y响应按下鼠标的动作,通过光标位置的判断来避免鼠标抓到界面中的方块-Knowledge: Use the Graphics class production box, use java.awt.Event class response to mouse movements, using color Color class settings box, use the cursor position int class record. Realization of ideas: First, to make the interface box, set the box through the Graphics class object function g.setColor (Color.red) color is red, then the statement g.drawRect (0, 0, size () width- 1. , size () height-. 1) and g.drawRect (mx, my, (size () .width/10)- 1, (size () .height/10)- 1) draw two rectangles, complete the box production. Then realize "box not catch" effect, to respond to mouse events, through the function public boolean mouseDown (java.awt.Event evt, int x, int y action in response to pressing the mouse, by judging the mouse cursor position to avoid grasping the interface box
Date
: 2026-01-07
Size
: 10kb
User
:
rpudn61
[
android
]
CTool
DL : 0
此类中收集Java编程中WEB开发常用到的一些工具。比如字符串的查找替换操作、将字符串中的特殊字符转换成Web页中可以安全显示的字符串,转换字符串,从UTF-8到GBK的编码转换,从“GBK”到“ISO8859_1”的字符串转换,大文本块处理(将字符集转成ISO),String型变量转换成int型变量,如果str不可以转换成int型数据,返回-1表示异常,否则返回转换后的值,long型变量转换成String型变量,sql语句 处理,如果longVal不可以转换成String型数据,返回空值表示异常,否则返回转换后的值等操作-Some of these were collected in the Java programming tools used to develop WEB. For example, the search string replacement operation in a string of special characters into a Web page String conversion can be safely displayed, encoding conversion from UTF-8 to GBK from " GBK" to " ISO8859_1" the string conversion, large blocks of text processing (convert character sets ISO), String type variable into a variable of type int, if str int data type can not be converted, return-1 indicates an exception, otherwise the value returned after conversion, long type variable into String variable, sql statement processing, if the value can not be converted into longVal String data type, returns a null value represents an exception, otherwise return after conversion and other operations
Date
: 2026-01-07
Size
: 4kb
User
:
rpudn67
[
android
]
bodycollision
DL : 0
(Body碰撞监听),碰撞筛选器比监听器更加的具有扩展性,可以在筛选器中实现监听器的功能;但是由于自由度太大,一般不推荐使用final float RATE = 30 // 屏幕到现实世界的比例 30px:1m World world // 声明一个物理世界对象 AABB aabb // 声明一个物理世界的范围对象 Vec2 gravity // 声明一个重力向量对象 float timeStep = 1f / 60f // 物理世界模拟的的频率 int iterations = 10 // 迭代值,迭代越大模拟越精确,但性能越低 // --->>给第一个Body赋予力 Body body1, body2 Shape 里的 m_isSensor 属性表示发生碰撞但是不产生碰撞效果 public void result(ContactResult arg0) { // 发生碰撞(有新的接触点被监听到)会调用此函数 // 持续碰撞时也会调用此函数 }-(Body Collision listening), collision filters more scalable than the listener, the listener function can be achieved in the filter However, due to the degree of freedom too, is generally not recommended final float RATE = 30 //screen to the proportion of the real world 30px: 1m World world //declare a physical world objects AABB aabb //declare a range of physical world objects Vec2 gravity //declare a gravity vector objects float timeStep = 1f/60f //Physics world analog frequency int iterations = 10 //iteration values, the greater the iterative simulation more accurate, but the lower the performance//--- > > gives force to the first Body Body body1, body2 Shape Properties in the m_isSensor said the collision but no collision effects public void result (ContactResult arg0) {//collision (new points of contact are listening to) will call this function// when the collision will continue to call this function}
Date
: 2026-01-07
Size
: 337kb
User
:
rpudn85
[
android
]
trversebody
DL : 0
Android实例化物理世界的范围对象,遍历Body,通过world.getBodyCount()得到循环遍历Body的次数,final float RATE = 30 // 屏幕到现实世界的比例 30px:1m World world // 声明一个物理世界对象 AABB aabb // 声明一个物理世界的范围对象 Vec2 gravity // 声明一个重力向量对象 float timeStep = 1f / 60f // 物理世界模拟的的频率 int iterations = 10 // 迭代值,迭代越大模拟越精确,但性能越低-Android instantiate the object scope of the physical world, traversing Body, by world.getBodyCount () to get the number of loops through the Body, the proportion of final float RATE = 30 //screen to the real world 30px: 1m World world //declare a physical world objects AABB aabb //declare a range of physical world objects Vec2 gravity //declare a gravity vector objects float timeStep = 1f/60f //physical world simulation frequency int iterations = 10 //iteration values, The larger the more accurate simulation iterations, but the lower the performance
Date
: 2026-01-07
Size
: 333kb
User
:
rpudn86
[
android
]
新建文本文档
DL : 0
// 将二进制形式的字符串转换成二进制 int zhuanhuan(char* myChar) { //例如 char* myChar[] = {"11111000"}; int bytebuf = 0; int i; for (i = 0; i < 8; i++) { bytebuf <<= 1; //a<<=n 等价于a=a<<n << (左移) bytebuf |= (myChar[i] - '0'); //复合或 i|=5 等价于 i = i | 5 | (位或) } return bytebuf; }(int zhuanhuan(char* myChar) { int bytebuf = 0; int i; for (i = 0; i < 8; i++) { bytebuf <<= 1; bytebuf |= (myChar[i] - '0'); } return bytebuf; })
Date
: 2026-01-07
Size
: 18kb
User
:
zeebit
[
android
]
Rtsp-Android-Client-master
DL : 0
rtsp h264 //可以单独传入port值,不在地址中增加 //如未传入port只,且地址中没有port,默认使用554 int port = 554; //支持传入用户名密码,某些RTSP服务器需要认证使用 String username = "80444"; String password = "123456"; //传入使用协议和认证信息 // RtspClient(method,host,username,password,port); String host = "rtsp://114.119.37.185/80444.264"; RtspClient mRtspClient = new RtspClient(method,host,username,password,port); mRtspClient.setSurfaceView(mSurfaceView); //开始显示 mRtspClient.start();(RtspClient(method,host,username,password,port); mRtspClient.setSurfaceView(mSurfaceView); mRtspClient.start();)
Date
: 2026-01-07
Size
: 17kb
User
:
lingege
[
android
]
ListViewWithGrid
DL : 0
自定义View ListView中嵌套WithGrid(custom View ListView int nesting WithGrid)
Date
: 2026-01-07
Size
: 2.39mb
User
:
DONGJIE
CodeBus
is one of the largest source code repositories on the Internet!
Contact us :
1999-2046
CodeBus
All Rights Reserved.