Where’s the music
- By dwf2008
- Android Development
- 3 Replies
Is there a default location where music files are normally stored in the android file structure? If yes, where is the library?
Thanks
Thanks
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
package com.example.myapplication
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.uiautomator.UiDevice
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.Assert.*
/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun testCaseForButton1() {
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
//Filler step
assertEquals("com.example.myapplication", appContext.packageName)
}
@Test
fun testCaseForButton2() {
val device = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation())
//Filler step
assertEquals("com.sec.android.app.launcher", device.launcherPackageName)
}
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
findViewById<Button>(R.id.buttonRunTest1)
.setOnClickListener {
//Invoke testCaseForButton1
}
findViewById<Button>(R.id.buttonRunTest2)
.setOnClickListener {
//Invoke testCaseForButton2
}
}
// Code to execute when the button is clicked
fun startTest(){
val packageName = "com.example.myapplication"
val testRunnerClass = "androidx.test.runner.AndroidJUnitRunner"
val command = "am instrument -w $packageName/$testRunnerClass"
Runtime.getRuntime().exec(command)
}
// Code to execute when the button is clicked
fun startTest(){
val instrumentation = InstrumentationRegistry.getInstrumentation()
val paramTypes = arrayOf(ComponentName::class.java, Bundle::class.java)
val method = instrumentation.javaClass.getDeclaredMethod("startInstrumentation", *paramTypes)
}
{
....
defaultConfig {
applicationId "com.example.myapplication"
minSdk 28
targetSdk 32
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
....
}
dependencies {
...
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
implementation 'androidx.test.uiautomator:uiautomator:2.2.0'
implementation 'androidx.test:runner:1.4.0'
androidTestImplementation 'androidx.test:runner:1.4.0'
androidTestImplementation 'androidx.test:rules:1.5.0'
...
}