"Android QuickStart" directory structure and ADB commands "with Android dialer implementation, self-made"

Source: Internet
Author: User

Directory structure

< Span style= "font-family: ' Comic Sans MS ', Sans-serif; font-size:15px ">SRC: Store Java code
Gen: Storing automatically generated files. R.java Store the ID of the corresponding resource under the Res folder
Project.Properties: Specifies the version of the development kit used by the current project
libs: The jar package that the current project relies on.
assets: The media files required to place some programs.
bin: The compilation Directory of the project. Store some temporary files generated at compile time and the. apk file for the current project.


Res (Resources): Resource file.
Drawable: The picture used to store the program.
Layout: Store the android layouts file.

Fragment_main.xml (This is the new layout structure of the new API)

< Span style= "font-family: ' Comic Sans MS ', Sans-serif; Font-size:15px "> Activity_main.xml (main layout)
menu: Stores the layout of the Android optionsmenu menu.
values (data required by the application. ID is generated in the R file)
Strings.xml holds Android strings.
Dimens.xml the size used to store the screen fit.
Style.xml store the styles displayed under Android.

< Span style= "font-family: ' Comic Sans MS ', Sans-serif;  FONT-SIZE:15PX "> Resolution:
  VALUES-SW600DP 7-inch tablet corresponds to the value
  Values-sw720dp-land 10-inch tablet corresponds to the value
VALUES-V11 Specifies the style that is displayed for phones above the 3.0 version.
VALUES-V14 specifies the style displayed for phones above 4.0.


The portal file for the AndroidManifest.xml:android application. The components inside Android are declared. and related configuration information.
Proguard-project.txt: Encrypts the current program used.

ADB command

ADB Android Debug Bridge Android debugging Bridges

ADB devices List of all devices

ADB start-server open ADB service

ADB kill-server close ADB service

adb logcat View Log

ADB shell mounts to Linux space (Linux commands are available)

ADB Install < applications (plus extensions) > Install applications

Adb–s < emulator name > install < application (plus extension) > Installing apps to the specified emulator

ADB Uninstall < package name >

ADB pull <remote> <local>

ADB push <local> <remote>

EMULATOR–AVD < simulator name >

CTRL + F11 Toggles the screen


Dialer implementations

The dialer is a very simple layout, the best way to get started with Android.

This program gives Android API19 compile implementation, so is the new layout. Please note that you are not used to it.

1. Java Main program

public class Mainactivity extends actionbaractivity {@Override protected void onCreate (Bundle savedinstancestate) {        Super.oncreate (savedinstancestate);        Setcontentview (R.layout.activity_main); if (savedinstancestate = = null) {Getsupportfragmentmanager (). BeginTransaction (). Add (R.ID.C        Ontainer, New Placeholderfragment ()). commit (); }} public void call (View v) {System.out.println ("make a call.        ");        Read number EditText edittext= (EditText) Findviewbyid (r.id.eal);        String String=edittext.gettext (). toString ();        Dial Intent intent=new Intent ();        Intent.setaction (Intent.action_call);        Intent.setdata (Uri.parse ("Tel:" +string));    StartActivity (Intent); } @Override Public boolean Oncreateoptionsmenu (Menu menu) {//Inflate the menu, this adds items to T        He action Bar if it is present.      Getmenuinflater (). Inflate (R.menu.main, menu);  return true; } @Override public boolean onoptionsitemselected (MenuItem Item) {//Handle Action Bar item clicks here.  The action bar would//automatically handle clicks on the Home/up button, so long/As you specify a parent        Activity in Androidmanifest.xml.        int id = item.getitemid ();        if (id = = r.id.action_settings) {return true;    } return super.onoptionsitemselected (item);     }/** * A placeholder fragment containing a simple view. */public static class Placeholderfragment extends Fragment {public placeholderfragment () {} @Ov Erride public View Oncreateview (layoutinflater inflater, ViewGroup container, Bundle savedinstancest            ATE) {View Rootview = inflater.inflate (R.layout.fragment_main, container, false);        return rootview; }            }}

2. Main list

<?xml version= "1.0" encoding= "Utf-8"? ><manifest xmlns:android= "http://schemas.android.com/apk/res/        Android "package=" Com.example.caller "android:versioncode=" 1 "android:versionname=" 1.0 "> <uses-sdk android:minsdkversion= "9" android:targetsdkversion= "/> <uses-permission android:name=" Andro Id.permission.CALL_PHONE "/> <application android:allowbackup=" true "android:icon=" @drawable            /ic_launcher "android:label=" @string/app_name "android:theme=" @style/apptheme "> <activity Android:name= "com.example.caller.MainActivity" android:label= "@string/app_name" > <inte nt-filter> <action android:name= "Android.intent.action.MAIN"/> <category androi D:name= "Android.intent.category.LAUNCHER"/> </intent-filter> </activity> </applica Tion></manifest>


3. Layout List main activity

<framelayout xmlns:android= "http://schemas.android.com/apk/res/android"    xmlns:tools= "http// Schemas.android.com/tools "    android:id=" @+id/container "    android:layout_width=" Match_parent "    Android : layout_height= "match_parent"    tools:context= "com.example.caller.MainActivity"    tools:ignore= " Mergerootframe "/>
4. layout XML file

<relativelayout xmlns:android= "http://schemas.android.com/apk/res/android"        android:layout_width= "Match_ Parent "    android:layout_height=" match_parent "><textview     android:id=" @+id/cal "    android:layout_ Width= "Wrap_content"    android:layout_height= "wrap_content"    android:text= "@string/cal"    />< EditText     android:id= "@+id/eal"    android:inputtype= "number"    android:layout_below= "@+id/cal    " Android:layout_width= "Match_parent"    android:layout_height= "wrap_content"    /><button     Android:id= "@+id/bal"    android:onclick= "call"    android:layout_below= "@+id/eal"    android:layout_ Width= "Wrap_content"    android:layout_height= "wrap_content"    android:text= "@string/bal"    /></ Relativelayout>



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.