Correct Answer : Get Lastest Questions and Answer : Explanation: MediaPlayer.create() needs a Context as first parameter. Pass in the current Activity and it should work.
public void playClick(Context context){ mp = MediaPlayer.create(context, R.raw.click); mp.start(); }
Question : Which of the following is not a ContentProvider provided natively by Android? 1. The contacts list
Correct Answer : Get Lastest Questions and Answer : Explanation: A content provider acts as an interface that allows you to store and retrieve data from a data source. It also allows you to share an app's data with other apps. Content providers decouple the app layer from the data layer by abstracting the underlying data source, thereby making apps data-source independent. They allow full permission control by monitoring which app components or users should have access to the data making data sharing easy. As a result, any app with appropriate permissions can add, remove, update, and retrieve data of another app including the data in some native Android databases.
The Android platform supports two types of content providers that can be used in your app:
Custom content providers: These are created by the developer to suit the requirements of an app. Native content providers: These provide access to built-in databases, such as contact manager, media player, and other native databases. You need to grant the required permissions to your app before using native content providers.
Question : When creating a file using android.content.Context.openFileOutput("test.txt", ), where is the file created?