The example of this article for you to share the Android use of Get-way login code, for your reference, the specific content as follows
Tool Class
Package com.liunan.okhttpdemo3post.Utils;
Import java.io.IOException; Import OKHTTP3.
mediatype; Import OKHTTP3.
Okhttpclient; Import OKHTTP3.
Request; Import OKHTTP3.
Requestbody; Import OKHTTP3.
Response; Import OKHTTP3.
Responsebody;
/** * Created b
Many foreign sites have been blocked at home. Even Google and Android are blocked, do the program Ape's bitter!Just be okay, we also have our way!Recommend a better way than the following: Red Apricot charity agent: http://blog.csdn.net/liang5630/article/details/46288091Reprint Please specify: Loud column http://blog.csdn.net/liang5630/article/details/44805819Fir
The first step is to export the file data method to be backed up very simply copy directly on the line X:memumemuhyperv Vmsmemu directory Memu-20150613-disk1 and Memu-20150613-disk2 are primary files only back up these two files on the line
Second, file data for the import backup first, open the directory where you installed the X:memuhyperv. Memuhyperv Double click to open
Click on the interface Gear button then Antu click to delete Memu-20150613-d
English Original: Probably is the best (?) to Save/restore Android Fragment ' sKey points: Fragment's arguments.After years of using fragment, I want to say that fragment is really a smart design, but there are too many problems to be solved by using fragment, especially when dealing with data retention.First, although it has an activity-like onsaveinstancestate, don't think you can keep the data just by Onsaveinstancestate.Here are some examples:Scen
The Splash page for Android performance optimization should be designed in this way.Current SplashActivity Design
At present, applications on the market will start a SplashActivity at startup. As a welcome interface, why is this design?Personal summary has three advantages:1. Better User Experience
For example, you can dynamically change the welcome image in the background or explicitly welcome xxx back. Sina Weibo's interaction is like this.2. The Ap
True path:/data/data/com.mediatek.todos/databases/todos.dbPath used for link:/data/user/0/com.mediatek.todos/databases/todos.dbIn fact, two URLs are located to the same file, the second URL of 0 is linked to the/data/data/linkThis file is a sqlite3 database, can be opened in Windows using SQLite Browser, Android also has related software can open, forgot what to callNote: Different models may not be the same, even some models do not have to do this so
I gave this pattern to me named Mve (Model,view,eventbus). Model and view we all know, here is focused on Eventbus.The Eventbus is a publish/Subscribe event bus optimized for Android. The main function is to substitute intent,handler,broadcast for passing messages between Fragment,activity,service and threads. The advantage is that the cost is small and the code is more elegant. and decoupling the sender and receiver.OnCreate inside Register EventBus:
Use httpclient for Get-mode communication, to establish network links through HttpClient, to read data using the HttpGet method, and to get the entity return value through response.Use httpclient for post communication, to establish network links through HttpClient, to use the HttpPost method to transfer data and read data, both outgoing and incoming data are subclasses of entity.See: Android (Java) Learning Note 211: Submit data with httpclient (QQ l
(index); Is the data that gets the specified subscript index to int type; int id = cursor.getint (cursor.getcolumnindex ("id")) ; String named = cursor.getstring (Cursor.getcolumnindex ("name")); String number = cursor.getstring (Cursor.getcolumnindex ("number"));//Instantiate query result data Object person = new person (ID, named, number);} Close the database connection, release the Resource Db.close ();//Return the data result object return person; /** * Update a data based on name * * @para
Android network programming is divided into two types: HTTP protocol based, and socket based. HTTP protocol based : HttpClient, HttpURLConnection, asynchttpclient framework, etc. Based on the socket : (1) socket, ServerSocket for TCP/IP (2) for UDP/IP Datagramsocket, Datagrampackage (3) Apache mina framework One, httpurlconnection implementation
String response = null;
URL url = new URL (path); HttpURLConnection connection = (htt
Currently, Android has not recommended creating notification instances in the following ways:
Notification Notification = new Notification (R.drawable.ic_launcher, "This is ticker text", System.currenttimemillis ()) ;
It is best to use the following methods:
Notification Notification = new Notification.builder (this)
. Setcontenttitle (' This is title ')
. Setcontenttext ("This is content")
. Setsmallicon (R.drawable.ic_launcher)
. Settic
Original address: http://www.cnblogs.com/sunzn/p/3406013.htmlLink styles, click events, and href styles are supported by links to TextView added in this way, with the following code: Package Cn.sunzn.tlink;import Android.app.activity;import Android.os.bundle;import android.text.html;import Android.text.spanned;import Android.text.method.linkmovementmethod;import Android.view.menu;import Android.widget.textview;public class Mainactivity extends Activit
The development of the Android process will encounter at least one main thread, also known as the UI thread, this thread is not allowed to block, or will error, such as the most common access to network resources, read and write files and other operations, these time-consuming operations can no longer use the main thread. Here is a very efficient and very simple and practical way to Executorservice class.Th
/** * Gets the MAC address of the device * * @param AC * @param callback * After successfully acquiring the MAC address, this method is recalled */public static void Getmacaddress (final Activity AC, Final Simplecallback callback) {final Wifimanager wm = (Wifimanager) AC. Getsystemservice (Service.wifi_servi (CE)//If WiFi is turned on after the boot, the MAC information can be obtained directly. return data immediately. Wifiinfo info = wm.getconnectioninfo (); if (info! = null info.getmacaddres
: (The box is displayed from left to right)Photo resources:Principle Introduction:Step one: Put three pictures in position. The picture resource is displayed all at this time. (The aim is to stick to the correctness of the position)Step two: Write shader. The discard is determined by the texture s coordinate, which is larger than a certain value. The value is 0 o'clock, all is not displayed, the value is 1 o'clock all display, the middle display of the segment is determined by the size worth.Ver
Because part of the interface, such as a fragment, his layout file is almost a few lines of code and the fragmentxml of several list lists are almost identical.The number of XML spikes this time some small layout in the code I feel better.Also helps prevent anti-compilation PackageYangdc.common.fragment.base;ImportCom.handmark.pulltorefresh.library.PullToRefreshBase.Mode;ImportCom.handmark.pulltorefresh.library.PullToRefreshListView;ImportAndroid.os.Bundle;ImportAndroid.view.LayoutInflater;Impor
PublicBoolean post (string Username, string password) throws Exception {username= Urlencoder.encode (username);//Chinese data needs to be URL encodedPassword =urlencoder.encode (password); Stringparams="username="+ Username +"password="+password;byte[] data =params. GetBytes (); URL URL=NewURL (address); HttpURLConnection Conn=(HttpURLConnection) url.openconnection (); Conn.setconnecttimeout ( the);//This is the request mode for postConn.setrequestmethod ("POST");//set up post requests for neces
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.