The example in this article describes the approach of Android programming to implement Aidl (cross process communication). Share to everyone for your reference, specific as follows:
I. Overview:
Cross-process communication (AIDL), which mainly implements data sharing between processes (applications).
Two. Implementation process:
1. Server-side implementation:
(1) directory structure, as shown below:
(2) Implement *.aidl file:
A. IAIDLSERVICE.AIDL implementation:
Package com.focu
Activity passes values between intent, supports basic data types and string objects and their array objects byte, byte[], Char, char[], Boolean, boolean[], short, short[], int, int [], Long, long[], float, float[], double, double[], String, string[], and adopt the implementation of Serializable, The Parcelable interface's class object passes data in two ways: one is bundle.putserializable (Key,object) and the other is Bundle.putparcelable (Key, Object
When data is passed between activity, it is convenient to encapsulate a lot of data into objects and then pass the entire object over. There are 2 of cases in the object,One is to implement the Parcelable interfaceOne is to implement the Serializable interfaceUse the Bundle.putserializable (key, object) origin parameter or use Intent.putextra (Key object) to pass the parameter.But when used, an exception occurs1.java.io.notserializableexception except
projects. Android Drawable Importer adds an option to import a canvas or scale a specified image to a defined resolution at different resolutions. This plug-in accelerates the drawing board of developers.Plug-in: https://plugins.jetbrains.com/plugin/7658? Pr = androidstudioPlug-in source code address: https://github.com/winterDroid/android-drawable-importer-intellij-pluginPlug-In tutorial address: http://blog.csdn.net/lee_sire/article/details/49684385Recommendation Index: Samsung
Android-s
-optimizationpasses 52-dontusemixedcaseclassnames3-dontskipnonpubliclibraryclasses4-dontpreverify5-verbose6-optimizations! Code/simplification/arithmetic ,! Field /*,! Class/merging /*7-keep public class * extends android. app. Activity8-keep public class * extends android. app. Application9-keep public class * extends android. app. Service10-keep public class * extends android. content. BroadcastReceiver11-keep public class * extends android. content. ContentProvider12-keep public class * exten
1, the following can not quit the activity is? (D)A, Finish ()B, throw exception forced exitC, System.exit (0)D, OnStop ()Analytical:A, the Finish () method is to exit Activityb. Throw exception appears in Actiivity, will pop-up box, force quit the current activity. C. System.exit (0); This is used to exit all activity. D. OnStop () Only activity a cycle method, at this time has not exited, only to go to Ondestory () to exit 2, through the intent pass some binary data methods have? (CA, using th
Android Studio is a common plugin that greatly simplifies development and enhances development efficiency.Do not know the installation studio plug-in, read the previous article:1, Butterknife ZeleznyButterknife annotation generator, very easy to use, use Butterknife blessed!2, SelectorchapekDesigners to provide us with all kinds of resources, each button to write a selector is not very troublesome? So this plug-in to solve this problem, you only need to do is to tell the designers to follow the
and paint that Android123 will cover in the future, In the canvas we can implement picture paths, graphs, areas, lines. Paint as a way of painting objects can be set color, size, and even the type of font and so on.}Of course, there is the processing window restore state problem (generally used for screen switching), in addition to the activity can be called outside, in the development of the game we try to use similar in viewView Plaincopy to Clipboardprint@OverrideProtected
the state of your Preference class, you must implement the lifecycle callback methods and onSaveInstanceState()
.The state of your was defined by a Preference object that implements the Parcelable interface. The Android framework provides such a object for you as a starting point to define your state object:the Preference.BaseSavedState class.To define how your Preference class saves it state, you should extend the Preference.BaseSavedState class
To serialize an object by implementing the Parcelable interface:1, realize parcelable interface.2, and implement the public Parcelable interfacevoid Writetoparcel (Parcel dest, int flags) method.3. A custom type must contain a static member named Creator, which requires the implementation of the Parcelable.creator interface and its methods.
publiccla
-side program:(1) First Write your class (Book.java) file, this class must implement the Parcelable interface to serialize.(2) write the Aidl file (book.aidl) with the same name as the class(3) Writing the interface file (IBOOKMANAGER.AIDL), which is the interface of the client when requested(4) Implement service (Bookmanagerservice) on the server, which serves the client in real-time (mainly implements stub class)Next, let's look at the steps the cli
amount of work required to import scaled images to Android projects. Android drawable Importer Adds an option to import artboards at different resolutions or to scale the specified image to a defined resolution. This plugin accelerates the work of the developer's artboard.Plugin Download Address: Https://plugins.jetbrains.com/plugin/7658?pr=androidstudioPlugin Source Address: Https://github.com/winterDroid/android-drawable-importer-intellij-pluginPlugin Tutorial Address: http://blog.csdn.net/le
Intent value-to-pass object jump1. Transfer valueStoring a field in the original activityIntent = new Intent (from.this, to.class);Intent.putextra ("Switch", "Chongzhi");StartActivity (Intent);Jump to new activity after Q to remove the fieldIntent switchintent = Getintent ();String myswitch = Switchintent.getstringextra ("switch");2. Passing objects Intent = dialoginfo.getintent ();/passes an object to the intent objectUserInfo need to implement Parcelable
In the actual project development process fragment more and more, we certainly need to encounter fragment destroyed reconstruction situation. Combine your own project development to summarize and learn the code of open source projects, continue to share their own summary of fragment.1.Fragment save what does the state save before it is destroyed?We know that fragment instances will be destroyed by the system in many cases, and when our fragment back to the screen, we want to destroy the state be
://schemas.android.com/apk/res/android"
03 Android: layout_width="Fill_parent"
04 Android: layout_height="Fill_parent"
05 Android: Orientation="Vertical" >
06
07 Imageview
08 Android: layout_width="Fill_parent"
09 Android: layout_height="Fill_parent"
10 Android: Background="@ Drawable/feature_guide_0" >
11 Imageview>
12
13 Linearlayout>
The source code of the item02.xml, item03.xml, and item04.xml layout files is the same as that of the item01.xml layout file, but the ba
. the frombefore method converts each entity to entitydelta, and adds entitydelta to entityset. Finally, after the traversal is complete, the entityset is returned. Public static entityset mergeafter (entityset local, entityset remote) uses entityset remote to perform mergeafter on entityset local (perform entitydelta on entityset local and entityset which have the same ID as the primary table in entityset remote. mergeafter operation and return results. Finally, a new entityset local is returne
. */ int sum(int number, String process); void say(int time, String message); Student getStudent(int id); List getAddress(int id);}
The AIDL interface must pass the Student object and Address object, both of which implement the Parcelable interface. The Code is as follows:
Student. java
package com.ricky.android.aidl.model;import java.util.List;import android.os.Parcel;import android.os.Parcelable;public clas
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.