internal

Creating folder in internal Memory to save files and retrieve them later

走远了吗. 提交于 2019-11-26 20:33:15
问题 I want to make a folder in the Internal Memory in my application to store Audio Files,then check if the exist to do some operations. How to make this folde, in which path, and how to retrieve these files again? 回答1: File mydir = context.getDir("mydir", Context.MODE_PRIVATE); //Creating an internal dir; File fileWithinMyDir = new File(mydir, "myfile"); //Getting a file within the dir. FileOutputStream out = new FileOutputStream(fileWithinMyDir); //Use the stream as usual to write into the file

How to test internal class library?

假如想象 提交于 2019-11-26 19:40:09
问题 I would like to write a class library which creates for me a complex object but should only be exposed as little as possible. I want it to be included into other projects and there I only have one call to this library which e.g. returns me an object of a internally created class. I don't want to allow others to create these objects explicitly, but still I want to create a test project for this class library. For example: var result = Manager.Instance.Create(definition) This should be the only

Sending DTMF tones over the uplink in-call

微笑、不失礼 提交于 2019-11-26 19:25:01
问题 I'm working on a project that requires my app to be able to send DTMF tones on the voice's uplink frequency during an active call. My 2 conditions are: We don't use a customized Android platform We don't need to root the phone I've spent several days doing my homework and am aware that in-call DTMF sending is not supported by the current SDK/standard APIs. However, by using the relevant classes in com.android.internal.telephony I am hoping to mimic how the native Phone app does this. I

How to create a file on Android Internal Storage?

天大地大妈咪最大 提交于 2019-11-26 18:52:20
I want to save a file on internal storage into a specific folder. My code is: File mediaDir = new File("media"); if (!mediaDir.exists()){ mediaDir.createNewFile(); mediaDir.mkdir(); } File f = new File(getLocalPath()); f.createNewFile(); FileOutputStream fos = new FileOutputStream(f); fos.write(data); fos.close(); getLocalPath returns /data/data/myPackage/files/media/qmhUZU.jpg but when I want to create the media folder I'm getting the exception "java.io.IOException: Read-only file system". Any ideas how to write my files on internal phone storage in in folder media? Thanks. You should use

How to access internal class using Reflection

好久不见. 提交于 2019-11-26 18:48:48
How can I access an internal class of an assembly? Say I want to access System.ComponentModel.Design.DesignerHost. Here the DesignerHost is an internal and sealed class. How can I write a code to load the assembly and the type?. In general, you shouldn't do this - if a type has been marked internal, that means you're not meant to use it from outside the assembly. It could be removed, changed etc in a later version. However, reflection does allow you to access types and members which aren't public - just look for overloads which take a BindingFlags argument, and include BindingFlags.NonPublic

Why can't my public class extend an internal class?

谁说我不能喝 提交于 2019-11-26 17:38:55
问题 I really don't get it. If the base class is abstract and only intended to be used to provide common functionality to public subclasses defined in the assembly, why shouldn't it be declared internal? I don't want the abstract class to be visible to code outside the assembly. I don't want external code to know about it. 回答1: By inheriting from a class, you expose the functionality of the base class through your child. Since the child class has higher visibility than its parent, you would be

Using internal sun classes with javac

混江龙づ霸主 提交于 2019-11-26 16:03:45
Is there a way to disable restrictions of javac 1.6.0_22 that prevent me from using JRE internal classes like sun.awt.event.* ? I'm not looking for: an explanation why it is forbidden. suggestion to use different classes suggestion to use reflection suggestion to use ecj/eclipse I just want to know if it is possible or not, and if it is then how. I have found the answer myself. When javac is compiling code it doesn't link against rt.jar by default. Instead it uses special symbol file lib/ct.sym with class stubs. Surprisingly this file contains many but not all of internal sun classes. In my

How do I read the file content from the Internal storage - Android App

末鹿安然 提交于 2019-11-26 15:21:45
I am a newbie working with Android. A file is already created in the location data/data/myapp/files/hello.txt ; the contents of this file is "hello". How do I read the file's content? Georgy Gobozov Take a look this how to use storages in android http://developer.android.com/guide/topics/data/data-storage.html#filesInternal To read data from internal storage you need your app files folder and read content from here String yourFilePath = context.getFilesDir() + "/" + "hello.txt"; File yourFile = new File( yourFilePath ); Also you can use this approach FileInputStream fis = context.openFileInput

Android create folders in Internal Memory

那年仲夏 提交于 2019-11-26 14:38:17
Is there any way/ is it allowed to create folders in Internal Memory in Android. Example : - data -- com.test.app (application's main package) ---databases (database files) ---files (private files for application) ---shared_prefs (shared preferences) ---users (folder which I want to create) Can I create users folder in Internal Memory for example? I used this to create folder/file in internal memory : File mydir = context.getDir("mydir", Context.MODE_PRIVATE); //Creating an internal dir; File fileWithinMyDir = new File(mydir, "myfile"); //Getting a file within the dir. FileOutputStream out =

How to get my Android device Internal Download Folder path [duplicate]

让人想犯罪 __ 提交于 2019-11-26 13:07:49
问题 This question already has an answer here: how to access downloads folder in android? 5 answers It is possible to get the Android device Internal Download Folder path? 回答1: if a device has an SD card, you use: Environment.getExternalStorageState() if you don't have an SD card, you use: Environment.getDataDirectory() if there is no SD card, you can create your own directory on the device locally. //if there is no SD card, create new directory objects to make directory on device if (Environment