Package CN. thr; // method 2 of thread implementation: implement the runnable interface. this method is used to avoid the limitation of single inheritance. // example of a thread: there are 10 tickets in total, and two windows are used to buy
The design pattern is a required course for every programmer. Here we will organize 23 patterns and those who want to learn this kind of knowledge are blessed.
Singleton Pattern (Singleton mode): Ensure a class has only one instance, and provide a
You can use the following code to obtain installed apps on your Android phone:
List packagelist = getpackagemanager (). getinstalledpackages (0 );
When you need to differentiate installed user applications and system programs, you can use the
Use the android: windowSoftInputMode attribute in the AndroidManifest. xml file
TheAndroidManifest. xml File
"StateUnchanged", "stateHidden ",
"Statealwayshidden", "statevisible ",
"Statealwaysvisible", "adjustunspecified ",
"Adjustresize",
Problem: the keyboard cannot be displayed when you click the input box on the Sina login webpage.
Solution:
MWebView. setOnTouchListener (new View. OnTouchListener (){@ OverridePublic boolean onTouch (View v, MotionEvent event ){Switch (event.
Sometimes it is necessary to hide a file on the computer. The macos method is simple. You need to change the file name and add "." To the file name to hide it.
But if you want to display the hidden files in the finder, open the shell and enter
In the breakpoint view, there is a J! Mark button! You can use this button to add a Java exception breakpoint. For example, if we want the program to continue debugging when it encounters a null pointer exception (NullPointerException), we can use
After a user successfully logs in with an authorized user, we can get Weibo. The Weibo homepage is what you see when you log on to Sina Weibo, that is, you pay attention to your Weibo content. We can use the getHomeTimeline () method of Weibo in the
If you cannot determine the content of tableviewcell, you cannot set the height of the cell.
Normally, tableviewcell contains labels, textviews, and other controls.
[@ "" Sizewithfont: constrainedtosize: linebreakmode: ]
To obtain the label
Authorize the user to log on to the main program interface, which includesTop title bar, middle microblog content bar, and bottom menu bar. The top title bar also includes sendingWeibo button, title, and refresh buttonThe content bar in the middle
Sometimes we need to process a large amount of data or other very time-consuming operations. In order not to affect the program's response to users, we must put these tasks in a new thread. This can be separated from the main thread (UI thread).
/** File name: DataCleanManager. java * Description: The main functions are to clear the internal/external cache, clear the database, clear sharedPreference, clear files, and clear the custom directory */package com. test. dataClean; import java. io.
The function of posting Weibo is actually very simple. We only need to call the method in the SDK. A little troublesome is posting Weibo posts containing images. Today we will mainly introduce how to obtain image paths and publish Weibo posts with
This time write android reader end, encountered some problems, want to find some open source software for reference, in http://my.oschina.net/ernest/blog/16999 This blog shows a lot of good open-source pdf readers, but after downloading it, there
You may be familiar with the ListView control in android. ListView shows us a list of data, and TableView in ios implements the same function for us. TableView is easy to implement. The following is an example. To create a new project, add the
NextPart 1Continue. If you are not authorized, go to the authorization page:
To save time, I used the android SDK for development. SDK: Sina Weibo SDK (android version) is not an official SDK, but Weibo4Android.
Create an OAuthActivity based on the
Part 1: display the network image to the ImageView Control 1. Use the image path to obtain the public static byte [] getImage (String path) byte array of the image) throws Exception {URL imageUrl = new URL (path); HttpURLConnection connection =
// 1 do not forget to add permissions // 2 main. XML is very simple. There is only one button. The // 3 mainactivity is omitted here: Package COM. test; import android. app. activity; import android. app. alertdialog; import android. content.
In a layout, there is a control view v.You can obtain its position in the layout by using the following methods:V. getleft ();V. getright ();V. getbottom ();V. gettop ();
In this way, we can obtain the position of the control's top, bottom, left,
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