Algorithm {Longest Valid Parentheses}

Today we will try to solve that problem for the Longest valid parentheses. First time I’ve faced the task I did fail, Yes, I’ve thought about the task in right way but had problems in some implementation details. Today, I’ve analysed the problem on the fresh mind and found/fixed my mistakes. So, task description: Given a string containing just the characters ‘(‘ and ‘)’, find the length of the longest valid (well-formed) parentheses substring. For…

"Algorithm {Longest Valid Parentheses}"

Android: Formatting Strings

Introduction If you are java developer you can use String.format for adding some parameters into your string. Core Java provides us mechanism to manage it using symbols like %s or {1}, but how to use this mechanism in Android resource strings? Resource Strings Android provides us good mechanism to format strings in application too. Just try to add %1$s  or %1$d into your resource strings. The last symbols mean s –  for string formatting d – for decimal…

"Android: Formatting Strings"

Android: Send SMS messages from Emulator using Telnet

I’ve started to develop first Android application and will write some notes during development process. The first note is sending sms messages from terminal. So, There are a few steps to send messages from emulator using terminal: Start emulator (The emulator has to be started becaue you need to know port to connect). For starting emulator go to the Andriod SDK and AVD Manager->Virtual Devices->Start  Start telnet. Type in console window

Open telnet connection to…

"Android: Send SMS messages from Emulator using Telnet"

Android: Unit Test Issues

I’ve created this project for testing my Android Application and tried to start it. After starting I have received next error: Test run failed: Unable to find instrumentation info for: ComponentInfo {<my package>/android.test.InstrumentationTestRunner} After few hours of investigation I have found solution for this situation. Problem So, Problem is name of package in the manifest files.  The package in “real” manifest file and test manifest file are equal. For instance, look at the package com.blogspot.jugn in…

"Android: Unit Test Issues"

Android: Amazing Story about Sending SMS Messages from the Code

I’ve found amazing case of sending sms messages from the code. Task I need to send SMS message from my test method and test behavior of parsing it. Just for this post we are interesting in first part: Sending SMS message from code. I’ve written next simple code: final SmsManager smsManager = SmsManager.getDefault(); smsManager.sendTextMessage(“5554”, null, “Test”, null, null); and tried to test it. Just put this code in simple test method and run Android Unit Test. The result is … nothing!!! Why?!! I…

"Android: Amazing Story about Sending SMS Messages from the Code"