background preloader

Creating an Android Project

Creating an Android Project
An Android project contains all the files that comprise the source code for your Android app. This lesson shows how to create a new project either using Android Studio or using the SDK tools from a command line. Note: You should already have the Android SDK installed, and if you're using Android Studio, you should also have Android Studio installed. If you don't have these, follow the guide to Installing the Android SDK before you start this lesson. Create a Project with Android Studio In Android Studio, create a new project: If you don't have a project opened, in the Welcome screen, click New Project. Figure 1. Under Configure your new project, fill in the fields as shown in figure 1 and click Next. Activities An activity is one of the distinguishing features of the Android framework. Under Add an activity to <template>, select Blank Activity and click Next. Your Android project is now a basic "Hello World" app that contains some default files. app/src/main/res/layout/activity_my.xml

Allowing Other Apps to Start Your Activity The previous two lessons focused on one side of the story: starting another app's activity from your app. But if your app can perform an action that might be useful to another app, your app should be prepared to respond to action requests from other apps. For instance, if you build a social app that can share messages or photos with the user's friends, it's in your best interest to support the ACTION_SEND intent so users can initiate a "share" action from another app and launch your app to perform the action. To allow other apps to start your activity, you need to add an <intent-filter> element in your manifest file for the corresponding <activity> element. Add an Intent Filter In order to properly define which intents your activity can handle, each intent filter you add should be as specific as possible in terms of the type of action and data the activity accepts. Action A string naming the action to perform. Specify this in your intent filter with the <action> element. Data Category

Giving Permissions through Stored Procedures Introduction When designing an application for SQL Server, you rarely want users to have full permissions to access the tables in the database. Many applications are designed to perform all database access through stored procedures, and it is through the stored procedures users can access and update data. In this article I will in depth discuss three different ways to achieve this: I will also briefly cover three other ways: This article applies to SQL 2005 SP2 and later. Table of Contents Overview The classic method for granting permissions through stored procedures is ownership chaining. SQL 2005 introduced two new methods to give users access through stored procedures: you can sign procedures with certificates, and you can use impersonation with the EXECUTE AS clause. Whereas the above-mentioned methods can be applied to individual procedures, application roles, "application proxies" and Terminal Server are solutions that you typically use on an application-wide scale. Statements

Options for cross database access within SQL Server Problem I need to create a stored procedure that queries data that are not in the current database. What are my options? Solution In a simple environment, where both databases are owned by the same account or you are a member of the sysadmin role, there is no problem regarding the cross database access. Let's talk about more complex environments, where work is done using non administrative accounts. 1. For example, if the stored procedure from the first database and the table from the second database have the same owner and the "db_chaining" option is "true" for both databases there is a ownership chain between the two objects. 2. To demonstrate this method, I'll use two databases (db1 and db3) owned by non administrative logins (user1 and user3). In db3 I'll create a demo table. USE db3; CREATE TABLE Table3(RecID tinyint); GO USE db1; GO CREATE PROCEDURE proc1 WITH EXECUTE AS OWNER AS SELECT RecID FROM db3.dbo.Table3; GO Until now I've been logged in as a sysadmin account. 3. Next Steps

Related: