uri

How can I specify the output file's folder when calling RECORD_SOUND_ACTION?

大憨熊 提交于 2019-12-20 05:10:14
问题 I'd like to specify a destination folder when I call the MediaStore built-in sound recorder app, e.g. the sdcard folder. According to the Android documentation, there is no support for EXTRA_OUTPUT when calling the RECORD_SOUND_ACTION . How can I do this? 回答1: You will have to allow the file to be recorded using whatever default filename and location are used and then move the file. Moving the file is far from trivial. Here's a complete example. import java.io.File; import java.io.IOException

Android组件Content Provider

霸气de小男生 提交于 2019-12-19 16:58:13
ContentResolver的基本用法 对于每一个应用程序来说,如果想要访问内容提供器中共享的数据,就一定要借助Content- Resolver 类,可以通过 Context 中的 getContentResolver() 方法获取到该类的实例。 Content- Resolver中提供了一系列的方法用于对数据进行CRUD操作,其中insert()方法用于添加数据, update()方法用于更新数据,delete()方法用于删除数据,query()方法用于查询数据。有没 有似曾相识的感觉?没错,SQLiteDatabase中也是使用这几个方法来进行CRUD操作的,只不过 它们在方法参数上稍微有一些区别。 不同于SQLiteDatabase,ContentResolver中的增删改查方法都是不接收表名参数的,而是使 用一个Uri参数代替,这个参数被称为内容URI。内容URI给内容提供器中的数据建立了唯一 标识符,它主要由两部分组成:authority和path。authority是用于对不同的应用程序做区分的, 一般为了避免冲突,都会采用程序包名的方式来进行命名。比如某个程序的包名是com.example. app,那么该程序对应的authority就可以命名为com.example.app. provider。path则是用于对同一 应用程序中不同的表做区分的

Codeigniter Routing Unlimited Paramaters

这一生的挚爱 提交于 2019-12-19 11:42:38
问题 I currently have this in my CodeIgniter routes file. It maps anything with a URI api/controller/function to controller/api_function . $route['api/(:any)/(:any)/(:any)/(:any)/(:any)/(:any)'] = '$1/api_$2/$3/$4/$5/$6'; $route['api/(:any)/(:any)/(:any)/(:any)/(:any)'] = '$1/api_$2/$3/$4/$5'; $route['api/(:any)/(:any)/(:any)/(:any)'] = '$1/api_$2/$3/$4'; $route['api/(:any)/(:any)/(:any)'] = '$1/api_$2/$3'; $route['api/(:any)/(:any)'] = '$1/api_$2'; As you can see, this isn't very efficient. I

Getting a Uri with escaped slashes on mono

六月ゝ 毕业季﹏ 提交于 2019-12-19 10:22:07
问题 Update: A fix has now made it's way into mono. This is good news! Updated: Added logic to fix fragment handling. I am trying to send a request with an encoded slash on Mono using the Uri class. This is basically the Mono equivalent of this question: GETting a URL with an url-encoded slash The issue is that Mono similar to .NET will unescape any slashes it finds in the Uri when it is constructed. This logic was originally put in in place in order to remove vulnerabilities that could occur if

Android Calendar Specific Event Deletion

蓝咒 提交于 2019-12-19 09:07:35
问题 I have created an application that easily puts the values that I want to the the device's calendar but when I want to delete it from the calendar programmatically I can't find a way how to. I've searched the net, mostly other stackoverflow questions, to find an answer (links here): Delete Calendar Entry, Events from Calendar not Deleted, Delete Specific Event. I found a way to delete all event entries on the calendar: public void onClick(View v) { Uri eventsUri = Uri.parse("content://com

HTTP协议相关面试题

本小妞迷上赌 提交于 2019-12-19 07:29:40
http请求由三部分组成,分别是:请求行、消息报头、请求正文 HTTP(超文本传输协议)是一个基于请求与响应模式的、无状态的、应用层的协议,常基于TCP的连接方式,HTTP1.1版本中给出一种持续连接的机制,绝大多数的Web开发,都是构建在HTTP协议之上的Web应用。 1、常用的HTTP方法有哪些? GET: 用于请求访问已经被 URI(统一资源标识符)识别的资源,可以通过URL传参给服务器。 POST: 用于传输信息给服务器,主要功能与 GET方法类似,但一般推荐使用POST方式。 PUT: 传输文件,报文主体中包含文件内容,保存到对应 URI位置。 HEAD: 获得报文首部,与 GET方法类似,只是不返回报文主体,一般用于验证URI是否有效。 DELETE: 删除文件,与 PUT方法相反,删除对应URI位置的文件。 OPTIONS: 查询相应 URI支持的HTTP方法。 2、GET方法与POST方法的区别 区别一: get重点在从服务器上获取资源,post重点在向服务器发送数据; 区别二: get传输数据是通过URL请求,以field(字段)= value的形式,置于URL后,并用"?"连接,多个请求数据间用"&"连接,如http://127.0.0.1/Test/login.action?name=admin&password=admin,这个过程用户是可见的;

Cannot open PDF file in external app

▼魔方 西西 提交于 2019-12-19 05:20:09
问题 I would like to open a PDF file when the user clicks on a button. Currently, i am using this code to achieve this: Uri path = Uri.fromFile(new File("file:///android_asset/regola11_1.pdf")); Intent pdfIntent = new Intent(Intent.ACTION_VIEW); pdfIntent.setDataAndType(path, "application/pdf"); pdfIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(pdfIntent); but it doesn't work. When i select to use Adobe Acrobat, i get a message, displayed as a Toast, that says "This file could not

Dynamically show images from resource/drawable

偶尔善良 提交于 2019-12-19 04:06:00
问题 I'm trying to put different images (.jpg , .png) dynamically into a ListView from r es/drawable . The names from the images I get from a database. The images themselves are in the res/drawable folder. This is what I already have, With an error of :D String imgName; --> There are the img names I need from the database Drawable drawable; drawable = Class.appContext.getResources().getDrawable(Class.appContext.getResources().getIdentifier("com.example.test:drawable/"+imgName,null,null)); Then I

HTTP请求的六种方式

心不动则不痛 提交于 2019-12-19 03:46:51
HTTP请求的六种方式 GET:请求获取Request-URI所标识的资源 POST:向Request-URI所标识的资源提交数据 HEAD:请求获取Request-URI所标识的资源的响应消息报头 PUT: 向服务器提交一个资源,并用Request-URI作为其标识 DELETE :删除服务器中Request-URI所标识的资源 TRACE : 请求服务器回送收到的请求信息,主要用于测试或诊断 CONNECT: HTTP/1.1协议中预留给能够将连接改为管道方式的代理服务器。 OPTIONS :请求查询服务器的性能,或者查询与资源相关的选项和需求 详情:https://blog.csdn.net/chen_gp_x/article/details/66970430 来源: CSDN 作者: _abcdef 链接: https://blog.csdn.net/qq_38626043/article/details/103602287

How do I convert a “jar:file” URI to the path of Jar file?

試著忘記壹切 提交于 2019-12-18 17:02:29
问题 How do I go from jar:file:/C:/Program%20Files/test.jar!/foo/bar to a File that points to C:/Program Files/test.jar ? 回答1: The following code works for me (based on How do I get just the jar URL from a jar: URL containing a "!" and a specific file in the jar?): URL url = new URL("jar:file:/C:/Program%20Files/test.jar!/foo/bar"); JarURLConnection connection = (JarURLConnection) url.openConnection(); File file = new File(connection.getJarFileURL().toURI()) 回答2: You can do this.This works