Intent -- open another Activity -- bidirectional value transfer
In Android applications, we use the intent mechanism to jump between activities.
This example simply introduces how to use intent to make the program jump from MainActivity to another OtherActivity to realize a single parameter value. When returning MainActivity, use Bundle for batch return.
1, Design interface
1. MainActivity la ...
Posted by jeny on Tue, 05 May 2020 04:46:03 -0700
[Android] socket connection and send button are separated
Because of the need of the project, make an Android program, which can send instructions to control the printer, and use socket programming. Because I don't know about Android, I simply record some completed test applets
Click Connect to connect to the server
Click send to send helloWord to the server. The server uses ...
Posted by mikew2 on Tue, 05 May 2020 02:47:55 -0700
Android Project Actual Series - based on my module in Savvy Valley
Please be patient to read this module because of its large content and length.
My module is divided into four parts
[ ] My interface
[ ] Set up interface
[x] Modify password interface
[x] Set Secret Security and Retrieve Password
1. Modify Password
1. Create a password modification interface
In the com.boxuegu.activity package, creat ...
Posted by congos on Tue, 05 May 2020 01:30:21 -0700
Determine whether the current Activity is a required Activity
1. Get the current Activity instance through topActivity of RunningTaskInfo. The Activity obtained in this way can only ensure that it has executed the Activity.onCreate method, but not the Activity.onResume method. This method has been banned since api 21 and should be used with caution.
public static String getCurrentActivityName(Conte ...
Posted by nomanoma on Tue, 05 May 2020 00:58:29 -0700
Android uses TabLayout to create a sliding tab bar
Sliding tab bar is very common in App. I tried to implement one by myself in the past. Using HorizontalScrollView and ViewPager, now TabLayout is much more convenient. First, the effect map and UI are slightly ugly. Don't mind ha ~ PS: there is a source code link at the bottom
design sketch
No nonsense, just code! ...
Posted by ppatwari on Tue, 05 May 2020 00:26:14 -0700
The usage of Litepal and the solution of dbname is empty
The steps to use Litepal are as follows:
1. Introduce JAR package and change configuration
Use Android Studio to add: dependencies {
compile 'org.litepal.android:core:1.6.1'
}
1.6.1 is the version number, which can be changed according to the requirements.
Then configure the litepal.xml file. Generally, create ...
Posted by MSK7 on Mon, 04 May 2020 22:10:01 -0700
android.os.Build common constants
When doing a project, it is often necessary to collect some equipment information, but it is not often used, so sometimes it will query which interface the requirements meet, so it will be sorted out at the weekend
Build.ID; //Either a changelist number, or a label like "M4-rc20".
Build.DISPLAY; //A build ID string m ...
Posted by jkrettek on Mon, 04 May 2020 21:33:27 -0700
Summary and examples of four ways to implement timer in Android
android Four ways to realize timer in
The first way to use Timer and TimerTask
1. Inheritance relationship
java.util.Timer
Basic methods
schedule
For example:
timer.schedule(task, delay,period);
//Delay is long,period is long: after delay milliseconds from now on, it is executed every period milliseconds.
The schedule method has three ...
Posted by dionyssos on Mon, 04 May 2020 14:52:10 -0700
TabLayout+ViewPager to realize the dynamic sliding effect of tabs
1. Prerequisite preparation
Today, I reviewed the joint use of TabLayout and ViewPager, and wrote a demo to deepen my understanding. First, make sure that TabLayout is under design, not under the original widget of the system. So first, add the following reference to the dependencies closure of build.gradle under app:
...
Posted by hakmir on Mon, 04 May 2020 13:30:46 -0700
Semiuniversal RecylerView.Adapter
In line with what is written in this article Android RecylerView multi layout optimization Extract the MyAdapter and write a jacenrecylerview Adapter. It can basically realize some simple pages without writing so many adapters.
Don't say much, post code directly.
/**
* For the time being, I'd like to integrate multip ...
Posted by robtbs on Mon, 04 May 2020 00:24:13 -0700