Friday, March 29, 2024

How to draw countless lines without rendering delay in Android Phone

If you just call the drawing API to draw lines on the screen, you may be comfortable using it when the line number is small, you will see the drawing is flowing smoothly. 

public class DrawView extends View {

    Paint paint = new Paint();

    @Override

    public void onDraw(Canvas canvas) {

        switch (OperationCtrl.nState)

        {

            case CREATE_PATTERN:

                DrawPattern(canvas, alTouchPoints);

                break;

        }

    }

   private void DrawPattern(Canvas canvas, ArrayList<CustomPoint> points)

    {

            ...

        for (int i = 0; i < points.size()-1; i++) 

        {

            lines[lineIndex++] = points.get(i).x;

            lines[lineIndex++] = points.get(i).y;

            lines[lineIndex++] = points.get(i+1).x;

            lines[lineIndex++] = points.get(i+1).y;

        }

        paint.setColor(color);

        paint.setStrokeWidth(thickness);

        canvas.drawLines(lines, paint);

    }

}

I called this method the direct drawing method.

However, when you create hundreds or thousands of lines, the drawing will be so laggy that your app is unable to be enjoyed.

The solution is to use a buffer memory (bitmap) to do all the rendering jobs, then show up once to the user. 

Put thousands of words into one sentence, a simple method can solve the rendering issue.  I called this method the bitmap methodAn additional improvement is every rendering only re-draws new lines compared with the previous bitmap. 

public class DrawView extends View {

    private static Bitmap bufferBitmap = null;

    private static Canvas bufferCanvas = null;

    public static void createBitmap()

    {

        if (bufferBitmap != null) return;

        bufferBitmap = Bitmap.createBitmap(MainActivity.ScreenSize.x, MainActivity.ScreenSize.y, Bitmap.Config.ARGB_8888);

        bufferCanvas = new Canvas(bufferBitmap);

    }

    @Override

    public void onDraw(Canvas canvas) {

        switch (OperationCtrl.nState)

        {

            case CREATE_PATTERN:

                DrawNewTouchPoints(canvas);

                break;

        }

    }

private void DrawNewTouchPoints(Canvas canvas)

    {

        //only draw new lines

       createBitmap();

        if (alTouchPoints.size() <= nLastDrawPoint+1)

        {

            canvas.drawBitmap(bufferBitmap, 0, 0, null);

            return;

        }

        while (alTouchPoints.size() > nLastDrawPoint+1) {

            nLastDrawPoint++;

            int thickness = alDrawThickness.get(nLastDrawPoint);

            int color = alDrawColor.get(nLastDrawPoint);

            int lineIndex = 0;

            float[] lines = new float[4];

            lines[lineIndex++] = alTouchPoints.get(nLastDrawPoint-1).x;

            lines[lineIndex++] = alTouchPoints.get(nLastDrawPoint-1).y;

            lines[lineIndex++] = alTouchPoints.get(nLastDrawPoint).x;

            lines[lineIndex++] = alTouchPoints.get(nLastDrawPoint).y;

            paint.setColor(color);

            paint.setStrokeWidth(thickness);

            bufferCanvas.drawLines(lines, paint);

        }

        canvas.drawBitmap(bufferBitmap, 0, 0, null);

    }

}

With this implementation, the playback is satisfied as expected. For example, drawing 1100 lines with the same speed, the direct drawing method took 55 seconds, while the bitmap method took 18 seconds as designed.

My app DoodleStory using the bitmap method was published in early 2024: https://play.google.com/store/apps/details?id=com.tongs.doodlestory



You can try it out to see the performance. The source codes can be found in GitHub.

My other Android Apps (still available as of today):

FunPatternWifi: Users in the same WiFi network can play this game, one creates a pattern, and then others can observe similar patterns and guess the right one. Source codes are available in GitHub.

Pattern Creation and Guess: this is the single-user version of FunPattern. The user creates one pattern, and then the app generates a few and shows animation on the screen for the user to guess.

Location Alarm and Measure: this app will monitor the current location, and give an alarm when entering or leaving a certain range of the preset location. It can also easily measure the distance between locations. Source codes are available in GitHub.

Hit and Solve Maths: this app shows a block on the screen randomly, the user can try to hit and do a maths calculation for fun.




Saturday, December 9, 2023

《诗经》一句通

52 《诗经》一句通,经典30秒: 心乎爱矣,遐不谓矣?中心藏之,何日忘之!

爱恋充满心怀,何不向他表白?爱意深埋在心底,何时才能把他忘记!


 51《诗经》一句通: 天生烝民,其命匪谌。靡不有初,鲜克有终。

上天生养广大百姓,政令却谎言连篇。人们不是没有良好的初心,却很少人有良好的结局。


50《诗经》一句通: 匪我言耄,尔用忧谑。多将熇熇,不可救药。

不是我年迈说昏话,是你荒唐可笑。坏事干尽还气焰嚣张,真是不可救药!


49《诗经》一句通: 匪兕匪虎,率彼旷野。哀我征夫,朝夕不暇。

既非野牛也非虎,却像牛虎走旷野。可悲我等出征人,没日没夜忙不停。


48《诗经》一句通: 苕之华,其叶青青。知我如此,不如无生。

凌霄开了花,叶子青又青。知道我这样连吃的都没有,不如别生我出来!


47《诗经》一句通: 或湛乐饮酒,或惨惨畏咎。或出入风议,或靡事不为。

有的人饮酒作乐,有的人谨小慎微。有的人溜达闲聊,有的人忙里忙外。


46《诗经》一句通: 溥天之下,莫非王土;率土之滨,莫非王臣。

普天之下的地,没有哪不是王的地;四海之内的人,没有谁不是王的臣。


45《诗经》一句通: 维南有箕,不可以簸扬。维北有斗,不可以挹酒浆。

南天箕星闪光芒,这箕不能用来簸米糠。北天有那北斗星,这斗不能用来舀酒浆。


44《诗经》一句通: 骄人好好,劳人草草。苍天苍天,视彼骄人,矜此劳人。

捣鬼的人总得意,受害的人受折腾。苍天苍天应有眼,管管那些害人精,可怜可怜老实人。


43《诗经》一句通: 蛇蛇硕言,出自口矣。巧言如簧,颜之厚矣。

夸夸其谈的大话,都是馋人信口出。巧言动听如鼓簧,厚颜无耻脸皮厚。


42《诗经》一句通: 秩秩大猷,圣人莫之。他人有心,予忖度之。

典章制度有条理,圣人制订的。他人有心想谗毁,我预料得到。


41《诗经》一句通: 萋兮斐兮,成是贝锦。彼谮人者,亦已大甚!

文采斑斓丝线新,织成华丽贝纹锦。那个造谣的坏家伙,冤枉好人太过分!


40《诗经》一句通: 乐彼之园,爰有树檀,其下维榖。它山之石,可以攻玉。

我喜欢那座花园,里面有紫檀树,楮树长在它下面。他方山上的顽石,可以用来琢磨玉器。


39《诗经》一句通: 鹤鸣于九皋,声闻于天。鱼在于渚,或潜在渊。

幽幽沼泽仙鹤鸣,叫声响亮上云天。浅浅渚滩游鱼浮,时而潜入到深潭。


38《诗经》一句通: 维此哲人,谓我劬劳。维彼愚人,谓我宣骄。

只有明理人,知道我辛苦。那些蠢家伙,说我在逞强。


37《诗经》一句通: 行道迟迟,载渴载饥。我心伤悲,莫知我哀!

道路泥泞行走慢,饥渴交迫苦难当。我的心里好凄凉,没人知道我哀伤!


36《诗经》一句通: 昔我往矣,杨柳依依。今我来思,雨雪霏霏。

回想当初出征日,杨柳飘飘春风吹。如今匆匆把家还,大雪纷纷满天飞。


35《诗经》一句通: 呦呦鹿鸣,食野之苹。我有嘉宾,鼓瑟吹笙。

鹿儿呼伴呦呦叫,同在野地吃蒿草。我有满座好宾客,弹瑟吹笙齐欢笑。


34《诗经》一句通: 蜉蝣之羽,衣裳楚楚。心之忧矣,于我归处。

短命蜉蝣呀,你的翅膀如同漂亮的衣裳。我心忧愁,不知将来是何下场。


33《诗经》一句通: 子之荡兮,宛丘之上兮。洵有情兮,而无望兮。

你热情奔放的舞姿,飘荡在宛丘山坡上。我满怀的爱恋之心,注定是有缘无分的。


32《诗经》一句通: 岂曰无衣,与子同袍。王于兴师,修我戈矛。与子同仇。

谁说没有衣裳?与你同穿那长袍。国君发兵交战,修好戈与矛,你我杀向同一个仇敌。


31《诗经》一句通: 溯洄从之,道阻且长。溯游从之,宛在水中央。

逆流而上去找她,道路险阻又漫长。顺流而下去寻她,仿佛她在水中央。


30《诗经》一句通: 蒹葭苍苍,白露为霜。所谓伊人,在水一方。

河边芦苇青苍苍,晶莹露水冻成霜。我的意中人呀,就在河水那一方。


29 《诗经》一句通: 言念君子,温其如玉。在其板屋,乱我心曲。

我思念你呀夫君!思念你美玉般的温润。你从军住在木板屋,我想你呀我心乱如麻!


28 《诗经》一句通: 自伯之东,首如飞蓬。岂无膏沐?谁适为容!

自从丈夫去了东方,我的头发乱如飞蓬。润发乳膏哪样少?可是打扮好了给谁看!


27 《诗经》一句通: 采苓采苓,首阳之巅。人之为言,苟亦无信。

采黄药啊采黄药,在那首阳山顶找。有人专爱造谣言,切莫轻信那一套。


26 《诗经》一句通: 考槃在陆,硕人之轴。独寐寤宿,永矢弗告。

在高原架起木屋,隐士悠哉心自高。独睡独醒独说话,此中乐趣不能言。


25 《诗经》一句通: 江有沱,之子归,不我过。不我过,其啸也歌。

大江也有支流,这个男人回来家。他不告别就离去。你抛弃了我,你将来再哭又有何用!


24 《诗经》一句通: 百尔君子,不知德行。不忮不求,何用不臧。

所有贵族都一个样,不知修行没德行。如果你不去害人又不贪,走到哪里都顺当。


23《诗经》一句通: 谁谓河广?一苇杭之。谁谓宋远?跂予望之。

谁说黄河宽又广?一支苇筏就可渡过。谁说宋国太遥远?踮起脚跟就看得见。 


22《诗经》一句通: 之子于归,远送于野。瞻望弗及,泣涕如雨。

妹子今日远嫁,相送郊野路旁。瞻望不见人影,泪流纷如雨下。


21《诗经》一句通: 予美亡此,谁与独旦。夏之日,冬之夜,百岁之后,归于其居。

我的爱人葬于此,谁来陪我到天亮。夏日炎炎,冬夜漫漫,百年之后,你我墓中再相见!


20《诗经》一句通: 绸缪束薪,三星在天。今夕何夕,见此良人?

一把柴火捆得紧,天上三星亮晶晶。今夜究竟是什么夜?见此好人太开心。


19《诗经》一句通: 今我不乐,日月其除。无以大康,职思其居。

及时行乐趁今日,不然时光白跑掉。行乐也别太过度,自己职责要做好。


18《诗经》一句通: 三岁贯女,莫我肯顾。逝将去女,适彼乐土。

我长年辛勤侍候你,你从不照顾我。我发誓要摆脱你,去那乐土找幸福。


17《诗经》一句通: 心之忧矣,我歌且谣。不知我者,谓我士也骄。

心里忧伤,姑且放声歌唱。不了解我的人说我这个人傲慢轻狂。


16《诗经》一句通: 何斯违斯?莫或遑处!振振君子,归哉归哉!

为什么此时还没有消息?我真不敢一个人住着!勤奋有为的老公呀,归来吧,归来回家中!


15《诗经》一句通: 汉之广矣,不可泳思。江之永矣,不可方思。

浩浩汉江多宽广,不能泅渡空惆怅。滚滚长江多漫长,不能摆渡空忧伤。


14《诗经》一句通: 自牧归荑,洵美且异。匪女之为美,美人之贻。

从牧场送来的荑草,真是美丽又奇特。倒不是荑草有多美,美人相赠情意浓。


13《诗经》一句通: 青青子衿,悠悠我心。纵我不往,子宁不嗣音?

青青是你的衣领,悠悠是我的心境。纵然我不曾去会你,难道你就如此断音讯?


12《诗经》一句通: 风雨如晦,鸡鸣不已。既见君子,云胡不喜!

风雨交加,鸡鸣声声。此时见你,怎不欣喜!


11《诗经》一句通: 宜言饮酒,与之偕老。琴瑟在御,莫不静好。

佳肴做成共饮酒,白头偕老永相爱。女弹琴来男鼓瑟,和谐美满在一块。


10《诗经》一句通: 知我者谓我心忧,不知我者谓我何求。悠悠苍天,此何人哉。

理解我的人,说我是心中忧愁。不理解我的人,问我在寻求什么。悠悠苍天啊,我究竟是什么样的人啊! 


9《诗经》一句通: 投我以木桃,报之以琼瑶。匪报也,永以为好也。

你将木桃来赠我,我拿美玉作回报。不是为了答谢你,只因你我情意深。


8《诗经》一句通: 总角之宴,言笑晏晏。信誓旦旦,不思其反。

小时候我们多么快乐,如今你忘了曾经的信誓旦旦,与我反目成仇。


7 《诗经》一句通: 齿如瓠犀,螓首蛾眉。巧笑倩兮,美目盼兮。

齿若瓠齐,娥眉修长。嫣然一笑动人心,秋波一转摄人魂。


6《诗经》一句通: 大夫君子,无我有尤。百尔所思,不如我所之。

大夫君子们别再怪我了,你们考虑千百次,不如我亲自跑一趟。


5《诗经》一句通: 死生契阔,与子成说。执子之手,与子偕老。 

我们早已立誓言,一同生死不分离。让我握住你的手,同生共死上战场。


4《诗经》一句通: 我心匪石,不可转也。我心匪席,不可卷也。

我心并非卵石圆,不能任意来滚转。我心也无草席软,不能随便来翻卷。 


3《诗经》一句通: 野有死麕,白茅包之。有女怀春,吉士诱之。

到野外打死一只野鹿,美美地打包成礼物。帅哥用它诱惑怀春的少女。


2《诗经》一句通: 桃之夭夭,灼灼其华。之子于归,宜其室家。

茂盛桃树,鲜艳红花。这位姑娘就要出嫁,新的家庭将和和睦睦。 


1《诗经》一句通: 关关雎鸠,在河之洲。窈窕淑女,君子好逑。

在河中的沙洲上,有对雎鸠鸟相互唱和。美丽善良的女子,是男子渴求的好对象。

Saturday, March 4, 2023

The How of Wi-Fi P2P Programming

 With the prevalence of Wi-Fi, it's now possible to share information without a SIM card using Wi-Fi Direct (also known as Wi-Fi P2P). 

You may refer to https://developer.android.com/guide/topics/connectivity/wifip2p for the details of Wi-Fi Direct (P2P). Or you can scroll down this page to find the appendix of this article for a brief introduction with 5W1H method. 

As a programmer, I once wondered how to create an app that uses this technology, and years ago I was able to make a simple app that could communicate between two phones. 

In 2023, I wanted to try communicating among three phones, but I couldn't find my old source code after changing laptops, so I had to start from scratch. 

However, I ran into some issues - for example, new privacy control policies caused the app to stop working. After several weekends of troubleshooting with my available phones, the app now runs smoothly most of the time. 

I'd like to share my findings with others who are curious about exploring this technology.


The sequential diagram of my App

 


A basic Wi-Fi P2P application should have MainActivity and the BroadcastReceiver classes. In general, the steps to develop a Wi-Fi P2P application are as following:

1. Add the following permissions to AndroidManifest.xml file

<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />

<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />

<uses-permission android:name="android.permission.INTERNET" />

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>

<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />

<uses-permission

    android:name="android.permission.NEARBY_WIFI_DEVICES"

    android:usesPermissionFlags="neverForLocation" />

Explicit codes should be added into the JAVA code as shown in my findings below.

2. In MainActivity Java class, create a WifiP2pManager object, which is used to manage Wi-Fi P2P operations, and a WifiP2pManager.Channel object, which represents the channel used for communication with the Wi-Fi P2P framework

WifiP2pManager manager;

WifiP2pManager.Channel channel;

3. Register a broadcast receiver to receive Wi-Fi P2P intents

Do the following in MainActivity’s onCreate():

filter.addAction(WifiP2pManager.WIFI_P2P_PEERS_CHANGED_ACTION);

filter.addAction(WifiP2pManager.WIFI_P2P_CONNECTION_CHANGED_ACTION);

filter.addAction(WifiP2pManager.WIFI_P2P_THIS_DEVICE_CHANGED_ACTION);

receiver = new WiFiDirectBroadcastReceiver(manager, channel, this);

Handle above intents in the BroadcastReceiver: 

public class WiFiDirectBroadcastReceiver extends BroadcastReceiver {

    @Override

    public void onReceive(Context context, Intent intent) {

        String action = intent.getAction();

        if (WifiP2pManager.WIFI_P2P_PEERS_CHANGED_ACTION.equals(action)) {

            // Wi-Fi P2P peers changed

        } else if (WifiP2pManager.WIFI_P2P_CONNECTION_CHANGED_ACTION.equals(action)) {

            // Wi-Fi P2P connection changed

        } else if (WifiP2pManager.WIFI_P2P_THIS_DEVICE_CHANGED_ACTION.equals(action)) {

            // Wi-Fi P2P device information changed (self)

        }

    }

};

Register the receiver in onResume(): 

registerReceiver(receiver, filter);


4. Initialize the WifiP2pManager and WifiP2pManager.Channel objects in onCreate()

manager = (WifiP2pManager) getSystemService(Context.WIFI_P2P_SERVICE);

channel = manager.initialize(this, getMainLooper(), null);


5. Discover other Wi-Fi P2P devices on the network

manager.discoverPeers(channel, new WifiP2pManager.ActionListener() {

    @Override

    public void onSuccess() {

        // Discovery initiated successfully

    }


    @Override

    public void onFailure(int reasonCode) {

        // Discovery initiation failed

    }

});

6. Handle the list of discovered peers

manager.requestPeers(channel, new WifiP2pManager.PeerListListener() {

    @Override

    public void onPeersAvailable(WifiP2pDeviceList peerList) {

        // Handle the list of discovered peers

    }

});


Finding 1: the permission control is different among Android OS versions

This is the first headache point. Eventually, following code solves it on my 3 phones:

private void CheckPermission() {

if (ContextCompat.checkSelfPermission(this, Manifest.permission.CHANGE_WIFI_STATE)

!= PackageManager.PERMISSION_GRANTED) {

Log.i(TAG, "CHANGE_WIFI_STATE was not granted");

ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.CHANGE_WIFI_STATE}, 1);

}

if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.TIRAMISU ) {

if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION)

!= PackageManager.PERMISSION_GRANTED) {

Log.i(TAG, " <TIRAMISU: ACCESS_FINE_LOCATION not granted");

// Permission is not granted

ActivityCompat.requestPermissions(this,

new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, 2);

}

}

else

{

if (checkSelfPermission(Manifest.permission.NEARBY_WIFI_DEVICES)

== PackageManager.PERMISSION_GRANTED) {

Log.i(TAG, "TIRAMISU+: NEARBY_WIFI_DEVICES granted");

// Permission is granted, proceed with using the NEARBY_WIFI_DEVICES permission

// ...

} else {

Log.i(TAG, "TIRAMISU+: NEARBY_WIFI_DEVICES not granted");

// Permission is not granted, request the location permission again

ActivityCompat.requestPermissions(this,

new String[]{Manifest.permission.NEARBY_WIFI_DEVICES}, 3);

}

}

}


Finding 2: IP for different group owners are the same (192.168.49.1)

At first I thought devices in the same WiFi network should have their own unique IP (this could be true because I can check from the WiFi Router). When I set 2 phones as group owner, their IPs are the same. Actually, every time when a group is formed, the client’s IP will change. My efforts were in vain in trying to get each device’s IP to be used for socket communication. 

Knowing this will save much time in developing your own App.


Finding 3: Client can only see the group owner

In a Wi-Fi P2P group, there will be only one group owner which the client can get its IP address. The clients cannot see each other. 


Finding 4: Set a group owner with createGroup

A group would be created after one device connected to the other with manager.connect(). However, there is no guaranty which will be the group owner. Of my 3 phones, Huawei Mate 20 Pro would be always the group owner even I manipulate the value of groupOwnerIntent. But once you call createGroup, the phone will become group owner and then the others can connect to it to be a client.


Finding 5: You cannot enable or disable your Wi-Fi function from WifiP2pManager

Meaning you can only manually turn on or turn off the phone’s Wi-Fi feature from the phone settings.


Finding 6: Connect success doesn’t mean the connection succeeded

manager.connect(channel, config, new WifiP2pManager.ActionListener() {

    @Override

    public void onSuccess() {

        DisplayStatus("Connecting...", ContextCompat.getColor(getApplicationContext(), R.color.Color_Info));

    }

    @Override

    public void onFailure(int i) {

    }

});

It simply means this command has been executed successfully, while the connection is established or not you have to check WIFI_P2P_CONNECTION_CHANGED_ACTION.


Finding 7: different behaviours when connect

In my Android 10 phone, after connect() or createGroup() command is called, the BroadcastReceiver’s WIFI_P2P_CONNECTION_CHANGED_ACTION message is only received once with Connected, however in the Android 13 phone, the message is first received with Disconnected, then received again with Connected:

NetworkInfo networkInfo = (NetworkInfo) intent.getParcelableExtra(WifiP2pManager.EXTRA_NETWORK_INFO);

Log.i(TAG, "WIFI_P2P_CONNECTION_CHANGED_ACTION: "+ networkInfo.isConnected());


Finding 8: Disconnect at startup

Somehow the Android OS may memorize the WifiP2P group. So after initialization of the App, I just disconnect the phone from any group:

manager.removeGroup(channel, disconnectListener);


Finding 9: Group information is only meaning to the group owner

You can check the group information like this:

manager.requestGroupInfo(channel,groupInfoListener);

WifiP2pManager.GroupInfoListener groupInfoListener = new WifiP2pManager.GroupInfoListener() {

    @Override

    public void onGroupInfoAvailable(WifiP2pGroup group) {

        //List<WifiP2pDevice> clients = (List<WifiP2pDevice>) group.getClientList();

        if (group != null) {

            Collection<WifiP2pDevice> clients = group.getClientList();

            int numClients = clients.size();

            Log.d(TAG, "onGroupInfoAvailable: Number of clients connected: " + numClients);

            Toast.makeText(getApplicationContext(), "Group size " + numClients, Toast.LENGTH_SHORT).show();

        }

        else {

            Log.d(TAG, "onGroupInfoAvailable: no group but size "+recvThreads.size());

            Toast.makeText(getApplicationContext(), "no group", Toast.LENGTH_SHORT).show();

            ResetData();

        }

    }

};


However, for the group owner phone, the client list size is 1 or 2 (total 3 phones); in client phone, the size is always 0. 


Finding 10: Sending payload with your phone’s identification

You can send the string information as this:

new SendStringTask(socket).execute(WELCOME_INFO);

private class SendStringTask extends AsyncTask<String, Void, Void> {

    private Socket socket;

    String ipAddressOutput;

    public SendStringTask(Socket sk) {

        ipAddressOutput = sk.getInetAddress().getHostAddress();

        socket = sk;

    }

    @Override

    protected Void doInBackground(String... params) {

        String msg = params[0];

        try {

            if (socket == null)

            {

                Log.i(TAG, "SendStringTask do nothing to " + ipAddressOutput);

                return null;

            }

            Log.i(TAG, "SendStringTask write with socket "+ socket);

            OutputStream outputStream = socket.getOutputStream();

            outputStream.write((myDeviceName+": "+msg).getBytes());

        } catch (IOException e) {

            Log.i(TAG, "SendStringTask IOException: "+ e.toString());

            e.printStackTrace();

        }

        return null;

    }

}


The 3 phones I used for testing: 

Huawei Mate 20 Pro (Android 10, API 29) 

Samsung A11 (Android 12, API 31)

Samsung A13 (Android 13, API 33)



Sample App


Details of the source codes can be found at https://github.com/happytong/FunWifiP2P. 

You can download the App with WiFiP2P here: https://play.google.com/store/apps/details?id=com.tongs.funpatternwifi



Appendix: Introduction of Wi-Fi P2P with 5W1H (by chatGPT)


Wi-Fi Direct or Wi-Fi Peer-to-Peer (P2P) is a wireless networking technology that allows devices to communicate directly with each other without the need for a traditional wireless access point or network infrastructure. With Wi-Fi P2P, devices can connect and communicate with each other, regardless of their operating system, manufacturer or device type. Here is an introduction to Wi-Fi P2P technology using the 5W1H framework:

What is Wi-Fi P2P technology?
Wi-Fi P2P technology is a wireless networking standard that enables two or more devices to connect and communicate with each other directly, without the need for a traditional Wi-Fi access point or network infrastructure. It is a fast, easy, and secure way to share files, media, and other data between devices.

Why is Wi-Fi P2P technology important?
Wi-Fi P2P technology is important because it enables devices to communicate directly with each other without the need for a traditional network infrastructure. This is useful in situations where there is no Wi-Fi access point available, or where it is not practical or desirable to connect to a network. Wi-Fi P2P also enables faster data transfer speeds and reduces battery consumption compared to traditional Wi-Fi connections.

Who uses Wi-Fi P2P technology?
Wi-Fi P2P technology is used by a wide range of devices, including smartphones, tablets, laptops, cameras, printers, and other consumer electronics. It is particularly useful for sharing files, photos, and videos between mobile devices, as well as for printing and scanning documents without the need for cables or network infrastructure.

Where is Wi-Fi P2P technology used?
Wi-Fi P2P technology can be used in a variety of settings, including homes, offices, public spaces, and outdoor environments. It is particularly useful in situations where there is no Wi-Fi access point available, such as in remote locations, outdoor events, or in areas with poor network coverage. Wi-Fi P2P can also be used for peer-to-peer gaming and other interactive applications.

When was Wi-Fi P2P technology developed?
Wi-Fi P2P technology was developed by the Wi-Fi Alliance, a nonprofit organization that develops and promotes Wi-Fi standards. The Wi-Fi Alliance introduced Wi-Fi Direct in 2010, which became the first Wi-Fi P2P standard. Since then, Wi-Fi P2P has become increasingly popular and is now widely supported by a variety of devices and operating systems.

How does Wi-Fi P2P technology work?
Wi-Fi P2P technology works by establishing a direct connection between two or more devices using Wi-Fi Direct. To establish a connection, one device needs to discover the other device and send a connection request. Once the connection is established, the devices can communicate directly with each other, without the need for a network infrastructure. Wi-Fi P2P also supports various security features, including WPA2 encryption and device authentication, to ensure that the connection is secure.

Saturday, February 18, 2023

Role descriptions with 5W1H

What is your role in your daily life? Here are some enlightening examples with 5W1H description which generated by OpenAi.

Please take note of the pattern for each role, especially the "How" section which highlights the methods to achieve the role's responsibilities and obligations. In general, the key points are communication and learning.



Describe the role of boss in a company with 5w1h

Who is the boss in a company?

The boss in a company is typically the highest-ranking individual who oversees the operations of the organization, manages employees, makes key decisions, and is accountable for the overall success of the company.

What does the boss do in a company?

The boss has several key responsibilities in a company, including:

  • Setting goals and objectives for the organization
  • Developing strategies and plans to achieve those goals
  • Managing and leading employees to ensure they are productive and engaged
  • Making important decisions related to hiring, firing, promotions, and compensation
  • Allocating resources effectively to maximize profitability and efficiency
  • Representing the company to external stakeholders, such as customers, investors, and regulatory bodies.

Why is the role of the boss important in a company?

The role of the boss is crucial in ensuring that the company operates efficiently, achieves its goals, and remains competitive in its industry. The boss sets the tone for the organization's culture and is responsible for creating a positive work environment that fosters productivity, creativity, and innovation.

When does the boss perform their duties?

The boss is typically working during regular business hours, but may also work outside of normal hours to accommodate the needs of the business or their employees.

Where does the boss operate in a company?

The boss can operate in various locations within a company, depending on the size and structure of the organization. They may have an office, a desk in an open-plan workspace, or even work remotely.

How does the boss interact with others in a company?

The boss interacts with a variety of stakeholders within the company, including employees, customers, suppliers, and investors. They may communicate with others through meetings, email, phone calls, or in person. Effective communication is essential for the boss to lead and manage the organization successfully.


Describe the role of a supervisor in a company with 5w1h

Who is a supervisor in a company?

A supervisor in a company is an individual who is responsible for overseeing a team or group of employees, ensuring that they meet performance standards, and achieving the objectives of the company.

What does a supervisor do in a company?

The role of a supervisor in a company includes:

  • Managing and leading a team of employees to ensure they are productive and efficient.
  • Monitoring employee performance and providing feedback on their work.
  • Developing and implementing processes and procedures to improve efficiency and quality.
  • Providing guidance and support to employees on work-related issues.
  • Communicating with management about the performance of the team and any issues that arise.
  • Ensuring that the team complies with company policies and regulations.
  • Identifying training and development needs of team members and providing necessary training.

Why is the role of a supervisor important in a company?

The role of a supervisor is critical to the success of a company, as they are responsible for managing the employees who directly contribute to the company's operations. Supervisors ensure that employees are productive, efficient, and work in a safe and healthy environment. They also facilitate effective communication between employees and management, and can improve employee engagement and job satisfaction.

When does a supervisor perform their duties?

A supervisor typically performs their duties during regular business hours, but may also work outside of normal hours to accommodate the needs of the business or their employees.

Where does a supervisor operate in a company?

A supervisor can operate in various locations within a company, depending on the size and structure of the organization. They may have an office, a desk in an open-plan workspace, or even work remotely.

How does a supervisor interact with others in a company?

A supervisor interacts with a variety of stakeholders within the company, including employees, customers, suppliers, and management. They may communicate with others through meetings, email, phone calls, or in person. Effective communication is essential for the supervisor to lead and manage the team successfully.


Describe the role of an employee in a company with 5w1h

Who is an employee in a company?

An employee in a company is an individual who works for the organization and is compensated for their time and effort.

What does an employee do in a company?

The role of an employee in a company includes:

  • Carrying out assigned tasks and responsibilities to contribute to the overall objectives of the company.
  • Following company policies and procedures, as well as any relevant laws and regulations.
  • Communicating effectively with supervisors and coworkers to ensure the smooth operation of the business.
  • Participating in training and development programs to improve their skills and knowledge.
  • Maintaining a safe and healthy work environment by following company guidelines for safety and health.
  • Contributing to a positive work culture by displaying professionalism and a positive attitude.

Why is the role of an employee important in a company?

The role of an employee is essential to the success of a company, as they are responsible for carrying out the day-to-day operations of the organization. Employees who perform their jobs effectively can help the company achieve its objectives, improve efficiency, and contribute to a positive work culture.

When does an employee perform their duties?

An employee typically performs their duties during regular business hours, but may also work outside of normal hours to accommodate the needs of the business or their team.

Where does an employee operate in a company?

An employee can operate in various locations within a company, depending on the nature of their job. They may work in an office, a factory, a store, or even remotely.

How does an employee interact with others in a company?

An employee interacts with a variety of stakeholders within the company, including coworkers, supervisors, customers, and management. They may communicate with others through meetings, email, phone calls, or in person. Effective communication is essential for the employee to carry out their job successfully and contribute to a positive work environment.


Describe the role of a friend with 5w1h

Who is a friend?

A friend is a person whom one knows and with whom they have a bond of mutual affection and trust.

What does a friend do?

The role of a friend includes:

  • Providing emotional support and being a source of comfort during challenging times.
  • Sharing experiences, interests, and hobbies to strengthen the bond of friendship.
  • Listening actively and offering advice or guidance when needed.
  • Celebrating achievements and milestones together.
  • Respecting each other's boundaries and providing a safe and non-judgmental space for each other.
  • Being trustworthy and dependable in times of need.

Why is the role of a friend important?

The role of a friend is crucial in maintaining good mental health and well-being. Friends offer a sense of belonging, companionship, and social support, which can help reduce stress and improve overall quality of life.

When does a friend perform their duties?

A friend is available to provide emotional support and companionship whenever needed, but the extent of their availability may depend on their personal circumstances.

Where does a friend operate?

A friend operates in various locations, depending on the nature of the relationship. Friends can spend time together in person, over the phone, or through online communication.

How does a friend interact with others?

A friend interacts with others in a friendly and compassionate manner. They communicate openly and honestly, and provide a non-judgmental and supportive environment for others. Effective communication is essential for maintaining a strong and healthy friendship.


Describe a job with 5W1H

Job: Software Engineer

Who: A software engineer is a professional who designs, develops, and maintains software applications and systems. They work with a team of developers, project managers, and other IT professionals to build and maintain software products.

What: The main responsibility of a software engineer is to create software solutions that meet the requirements of clients or end-users. They typically work with programming languages, such as Java, Python, or C++, and use various tools and technologies to build applications, including databases, frameworks, and libraries.

When: Software engineers work in a fast-paced, dynamic environment where deadlines are often tight. They may work on multiple projects simultaneously and need to manage their time effectively to meet project milestones.

Where: Software engineers can work in a variety of settings, including technology companies, software development firms, financial institutions, and government agencies. They may work in an office setting or remotely, depending on the company and job requirements.

Why: Software engineers are in high demand due to the increasing reliance on technology in all industries. They are responsible for building the software products that power many aspects of our daily lives, from mobile apps to e-commerce platforms to healthcare systems.

How: To become a software engineer, one typically needs a bachelor's degree in computer science or a related field, as well as proficiency in programming languages and experience with software development tools and methodologies. Ongoing professional development is also important to stay up to date with emerging technologies and best practices in the industry.


Describe a general job with 5W1H

Job: Sales Representative

Who: A sales representative is a professional who is responsible for selling products or services to customers. They may work for a variety of companies across different industries, including retail, healthcare, finance, and technology. Sales representatives may work alone or as part of a team, and they interact with customers, other sales professionals, and management.

What: The main responsibility of a sales representative is to sell products or services to customers by building relationships, presenting products, and negotiating deals. They typically use a variety of techniques to reach out to potential customers, including cold calling, email, and social media. Sales representatives need to have a good understanding of the products or services they are selling, as well as the needs and preferences of their customers.

When: Sales representatives may work regular business hours, but they may also need to work evenings, weekends, or holidays, depending on the industry and the needs of the customer. They may need to meet sales targets or quotas, and they may work in a commission-based environment where their pay is based on their sales performance.

Where: Sales representatives can work in a variety of settings, including retail stores, call centers, and corporate offices. They may also work remotely, especially if they are selling products or services online or over the phone.

Why: Sales representatives are important for any company that wants to sell products or services. They are responsible for building relationships with customers, understanding their needs, and providing solutions that meet those needs. They help generate revenue for the company and contribute to the overall success of the business.

How: To become a sales representative, one typically needs a high school diploma or equivalent, although a college degree may be preferred in some industries. Sales representatives need excellent communication and interpersonal skills, as well as the ability to persuade and negotiate. They also need to be comfortable working with technology and be willing to learn new skills and techniques to improve their sales performance.


Describe the role of a husband with 5W1H

Role: Husband

Who: A husband is a male partner in a marriage, who is committed to supporting and caring for his wife. He may work in a variety of professions and industries, and his role in the marriage may vary depending on cultural norms, personal values, and individual circumstances.

What: The main responsibility of a husband is to be a supportive and caring partner to his wife. He may provide emotional support, help with household tasks, or contribute to the family's finances. He may also take an active role in parenting, help with decision-making, or support his wife's career aspirations.

When: The role of a husband is ongoing and requires consistent effort and attention. He may need to balance the demands of his career, family responsibilities, and personal life, and may need to adapt to changing circumstances over time.

Where: The role of a husband is primarily played within the context of the marriage and family, although it may extend to other areas of life, such as social and professional relationships.

Why: The role of a husband is important for maintaining a healthy and fulfilling marriage. A supportive and caring husband can help his wife feel loved and valued, and can contribute to a strong and positive family dynamic. He can also model positive behaviors and values for his children and the wider community.

How: To be an effective husband, one must prioritize communication, empathy, and respect in the relationship. This may involve active listening, offering emotional support, sharing responsibilities, and being flexible and adaptable. Husbands may also seek out resources and support, such as counseling or community groups, to help them navigate challenges and build a strong and healthy relationship with their wife.


Describe the role of a wife with 5W1H

Role: Wife

Who: A wife is a female partner in a marriage who is committed to supporting and caring for her husband. She may work in a variety of professions and industries, and her role in the marriage may vary depending on cultural norms, personal values, and individual circumstances.

What: The main responsibility of a wife is to be a supportive and caring partner to her husband. She may provide emotional support, help with household tasks, or contribute to the family's finances. She may also take an active role in parenting, help with decision-making, or support her husband's career aspirations.

When: The role of a wife is ongoing and requires consistent effort and attention. She may need to balance the demands of her career, family responsibilities, and personal life, and may need to adapt to changing circumstances over time.

Where: The role of a wife is primarily played within the context of the marriage and family, although it may extend to other areas of life, such as social and professional relationships.

Why: The role of a wife is important for maintaining a healthy and fulfilling marriage. A supportive and caring wife can help her husband feel loved and valued, and can contribute to a strong and positive family dynamic. She can also model positive behaviors and values for her children and the wider community.

How: To be an effective wife, one must prioritize communication, empathy, and respect in the relationship. This may involve active listening, offering emotional support, sharing responsibilities, and being flexible and adaptable. Wives may also seek out resources and support, such as counseling or community groups, to help them navigate challenges and build a strong and healthy relationship with their husband.

Friday, July 15, 2022

How Can You Enjoy a Job

 

不积跬步,无以至千里。

A journey of a thousand miles begins with a single step.

--- Laozi

 

Most people retire from the job market, some become employers after work for some time. There is no right or wrong choice, it is the result of one’s personality and the opportunity of business.

 

Like or dislike

People often get annoyed when what they are doing is not what they like to do. When looking for a job, the first step is to decide what kind of job to take up, this is the period when you can determine your choices based on your likes or dislikes.

After you have decided to take up a job, it is your responsibility to do it well – whether or not you like or dislike the job no longer matters.

Note that your likes and dislikes may change without you realizing it. It does not take one moment for friends to become enemies – it is the result of a string of events that eventually leads to this change in a relationship.  When you work in a company, if you work hard and get recognition from your colleagues and your boss, you will feel good and may start to like the job more.

Once you have joined a company, put your heart and soul into it during the contracted period, either throughout probation or after confirmation. By doing so, you will learn the most from your job and make your time worthwhile. Your boss will notice your commitment to work, and a good impression will be left on him (or her).

 

Understand the hiring process

We have discussed where you may look for a job, but we also need to understand the hiring process. In general:

1.    The business department gives the required details to the human resource department (HR)

2.    HR publishes the advertisement

3.    You see the advertisement and submit your resume to HR

4.    HR shortlists the resumes

5.    HR contacts you for an interview if you are shortlisted

6.    HR and the business department interview you

7.    Contract is signed if all parties reach an agreement

From this, you can see how HR plays the most important role because it is involved in all the steps. For you, first, you need to pass HR’s filtering procedure.

There is a lot of valuable information online you can find on how to create your resume, here I will not repeat it. The key point is that HR may not necessarily know the actual technology or business requirements but they have the right to discard your resume. When you create your resume, do it from the viewpoint of HR first, so that you can get the opportunity to be interviewed by the business department with whom you will work.

 

Know your limitations

Psychological studies show that most people tend to overestimate their capabilities. For example, 90% of the crowd think they are cleverer than others. In the stock market, only 10% of the investors make money, 70% of them make losses, 20% of them break even without considering the time and effort they have put in. 

When you are working, remind yourself to look for opportunities in your current situation. Do not look down at the current job and your colleagues. Your capability is highly likely to be the same as others, so what you can do is work harder, learn more, and seek to move to a higher level.

Remember, your career phase is the same as the learning phase such that you have to upgrade yourself. Imagine in your learning phase, you always stay at primary 3, after many years, your knowledge will remain at the same level.

 

Understand your emotional quotient

Animals are not typically aggressive and their actions could have been triggered by their perception of threat. On 30 November 2021, a man was doing his morning walk at the Singapore Botanic Garden when he encountered a bevy of about 20 otters. Unfortunately, he was mistaken for a runner who had passed by the otters and may have accidentally hit one of the otters. He was attacked and suffered more than 20 wounds, with some requiring stitches. Luckily, his friend “screamed and shouted at the animals, who stopped their actions momentarily. The duo ran towards a nearby visitor center with the otters giving chase for a short distance.”

- https://www.straitstimes.com/singapore/environment/i-actually-thought-i-was-going-to-die-man-who-was-attacked-by-otters-at

This is the real world. Human beings could be attacked innocently by animals with lower emotional intelligence. Think of the work environment - some people with a straight temper may be easily irritated, and some introverted staff may burst out suddenly. Think of a gathering among friends, the harmonious ambiance may suddenly be broken because someone mentions something unpleasant. In most cases, losing one’s temper does not make the situation better. In general, containing your negative feelings in the working environment is helpful to your career.

There is a lot of information you can find online about emotional intelligence, about how to train yourself in self-management, self-awareness, social awareness, and relationship management. The following picture about otters tells you the key points to maintaining a good relationship with others.

 


  

Know your colleagues

 You may meet many different kinds of colleagues, here are 4 categories you may classify them into: 

A.   Active working with high efficiency

B.   Active working with low efficiency

C.   Passive working with high efficiency

D.   Passive working with low efficiency

Active and passive reflects the attitude, and efficiency reflects the skills. You need to find out your category for this job. If you find you are A and B, there is a high chance you are doing a job in your favourite area. If you are C and D, you probably need to consider changing jobs after some time if you still cannot switch to A and B.

Knowing your colleagues’ types may help you determine the way to best work with them. Minimize your time spent with D, tell C what to do, help B to improve his or her skills, cooperate with A. Remember, people’s categories may change over time as well.

 

Office politics

You may also know office politics. Yes, that’s also part of the real world. A company is a small society of the outside world. In every country, there is a government; in every government, there are people who play politics.

We often hear about dirty politics. However, not all politics are bad. A system with positive politics does good to the society, motivates people to behave well, and increases the efficiency of accomplishing the goals of the society.

Office politics is unavoidable, it is part of the company’s culture. But in most cases, it is an art of socializing and managing relationships. If you cannot handle it in one company, everything you try to do is out of tune, then you have to make a decision, change yourself or change the boss. If you do not realize your weakness or shortcomings, changing the boss will not solve the problem.

 

Set a goal for your job

A boat without a destination can never reach the shore. Working is progress that needs a goal to achieve. Without a goal, your life may look busy but in the end, you would not feel the sense of accomplishment – you will not feel satisfied. 

You need to set a goal for the job you will take up. The goal you set should have a deadline, which can be a 6-month goal, 1-year goal, or 5-year goal. Longer-term goals are not necessary because, in this ever-changing world, we are unable to predict the future after 5 years.

After the deadline, be sure to review and define the goal for the next period.

If you have not set a goal, do it now. It is never too late.

 

Be a happy person

When you are in a good mood, perhaps you are talking to your favorite person, time flies; if you are talking with a boring person, just one minute is too long. This is the layman’s explanation of Einstein’s Theory of Relativity. If you enjoy doing something, hard work will become less of a burden, because you will concentrate on it and do it well.

Feelings are mysterious. Something you disliked at first may be your favorite after some time. Smile when you are working, it will make you feel better.

Of course, you cannot pretend to be happy. You have to have accepted the current situation, yourself, and the external environment, and you need to have made a goal. Only then will you feel free and at peace to accomplish the goal.

We know we have a 40-years career phase in general. Don’t waste time – it will never come back again. You have a dream, stick to the dream, find a job, and absorb new knowledge from the job while contributing to the company. Every job you do, there should be a target for that job, after you learn enough from that, you realize the target, then you may restart the process of the next job cycle.

This is the life that is under our control, a life with a goal.

Saturday, February 26, 2022

Life Is a Journey of Jobs

谋事在人, 成事在天

Man proposes, God disposes.

--- Romance of the Three Kingdoms by Luo Guanzhong

 

With this, we come to the end of this series. We started with a general definition, understanding the job as a task. A task is to accomplish a goal. So the first thing is to set a goal, then accomplish it.

For every person, and even every animal, to survive in this world is the first and final goal.

After centuries of evolution, human society has developed a system of structural hierarchy: governments, institutions, companies, international laws, rules… We are living under such a system, our life becomes structural: starting with a learning phase, then a career phase, and ending in a retirement phase.

Every phase has its different goals. In the learning phase, the goal is to learn basic skills and knowledge; in the career phase, the goal is to make money; in the retirement phase, the goal is to end our life gracefully. A goal in the previous phase is the basis of the next phase.

With the goals built in mind, people make the efforts to fulfill the goals and like cogs in a system, human society moves forward. Life is a journey of fulfillment of tasks. Enjoy life on this journey.

Every one of us is part of the torrent of the times. The fortunate or the unfortunate, the lucky or the unlucky, everything depends on ourselves, depends on how we behave ourselves and how we interact with each other.

This is the end of this series, but it may be a new start for you to thrive in the job market. If there is any sentence that ignites within you a new idea, don’t ignore the idea.

Do your retrospective study, and make your version of 5W1H of something, you will live a more exciting life!




Friday, February 18, 2022

Where Can You Find a Job

敢问路在何方?路在脚下。

Dare to ask where is the way? The road is on your feet!

                          --- Theme song of television show Journey to the West

 

Everything is online

In this age of information, everything can be found online. Companies build their websites, set up channels on social media platforms, and people can easily access all the information about their products and services. This is the way for the job seeker to get to know and understand the company’s business.

Besides traditional job advertisements in the newspaper, many Internet platforms provide information about job opportunities from companies all over the world.

Some platforms, like LinkedIn, build a bridge between individuals and companies. You can view the job opportunities provided by the companies and apply via simple operations through the LinkedIn App. Alternatively, you can also register and post your job-seeking information for others to view and contact you by.

Your information on the Internet is then important if you want to increase your chances of getting a job you want. Do build up a good profile for yourself and present yourself well across different platforms.

 

Networking 

When you have a problem, what will you do?

A.   Look for advice from the Internet (DIY: do it yourself)

B.   Look for advice from family and friends

C.   Look for advice from a paid consultant

Obviously, human nature will make you select C after options A and B have been exhausted. When a company advertises a job vacancy, it follows the same logic: nobody could solve the problem the company had so employers had to turn to the job market to employ you. However, this is only after they have failed to find people from “family and friends”, i.e. existing staff and other people they know.

This is the importance of networking. Try to get known to more people, let them know what you are doing and what you would like to do. This way, others may help introduce you when there is a job opportunity that suits your skills and interests. Of course, this is a bonus to your job searching effort. First and foremost, you need to build up your reputation so that other people are inclined towards helping you. If you do not behave with a good attitude, constantly job-hopping, at the end of the day, your friends will try to avoid you.

 

Break out of your zone of discomfort

Business magnate Elon Musk was the richest person in the world as of December 2021. He was born in a rich family in South Africa but had a miserable childhood from both his family and his secondary school. His mother was a victim of domestic violence since her honeymoon with his father. His father was "a terrible human being... Almost every evil thing you could think of, he has done." In secondary school, he was a target for bullies for a long time.

This tragic childhood forced him to leave the place for Canada, where his mother was born, once he turned 18. After one year in Canada making a living by doing odd jobs, he moved to the United States for his university studies. From then on, he became a millionaire and then a billionaire.

He decided to go to the United States because he once travelled there during his childhood and got to know that there was such a heavenly place compared to South Africa.

When you feel uncomfortable at your current job, try a new life at a different place. Do some research and make a short visit to those intended places, it may give you a better life.

 

Get out of your comfort zone

This does not mean you should stick to your comfort zone. The outside world is risky, and staying where you are familiar could be tempting. Millions of years ago, those who were curious about the external world were likely to be killed by tigers, lions, or snakes during their adventures. Only the genes of those that remained in the protected zones could be passed on to the future generations.

Most people fall into this trap and never try a different life. Comfort may kill you in the sense that you prevent yourself from potentially getting a better life. Stability is good because we don’t need to make excessive effort to make a living. However, in this ever-changing world, there is nothing that will remain the same forever. When you are eventually forced to change, you may not have enough time or the capability to learn a new skill set to adapt to the new world.

 

Start from the dream you had

Do you remember your dream of the future when you were a teenager? “Yes, that was childish,” you may say. If we can measure the size of a dream, it would be biggest when you were young. As you age, this dream becomes smaller and smaller.

This is because you gain a clearer understanding of the world as you grow older. You come to know about competition and learn where your boundary lies. Day by day, your original ambitions get diminished by the cruelty of reality. You gradually lose your passion to explore the outside world, to pick up skills for your ambitions.

But your dreams are where your future starts. Your dream will guide you to the future. Your future is somewhere that is unpredictable but better than the present. It would be tragic if you still lead the same life you lead currently 10 years later.

Look around yourself, there are people younger than you, there are people older than you:

      Now you are at the age of 25, your colleague now is at the age of 35, do you want to be living the same life 10 years later?

      Now you are at the age of 35, your colleague now is at the age of 45, do you want to be living the same life 10 years later?

      Now you are at the age of 45, your colleague now is at the age of 55, do you want to be living the same life 10 years later?

Your future starts from your heart, starts from today. Think about the future, think about what you can do, revive your dreams, your new job is under your feet now.

How to draw countless lines without rendering delay in Android Phone

If you just call the drawing API to draw lines on the screen, you may be comfortable using it when the line number is small, you will see th...