Posts

To Find the file extension using JAVA

To Find the file extension using JAVA String extension; int dotPos = filenameExtension.lastIndexOf("."); extension = filenameExtension.substring(dotPos);

Combining both view with xml layout

Combining both view with xml layout. package com.android.murthy; import android.app.Activity; import android.content.Context; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.graphics.Rect; import android.graphics.RectF; import android.os.Bundle; import android.util.Log; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup.LayoutParams; import android.widget.Button; import android.widget.EditText; public class Dynamic extends Activity { /** Called when the activity is first created. */ Inner inner; EditText preview_val; Button show_prev; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); inner = new Inner(this); // setContentView(inner); LayoutParams params = new LayoutParams(150,105); addContentView(inner, para...

Disabling Context Menu for EditText in Android

Disabling Context Menu for EditText in Android Generally most of the applications use EditText in Every UI screen. Android provides default keyboard for EditText. This Keyboard pops-up whenever we are keeping the cursor in EditText box. Also Android provides default ContextMenu options for EditText. If you enter any text in EditText box and then long press on the entered text , then context menu options will pop-up. These options like cut,copy ,paste ...etc. These are like right click options for the MSWord. But For some requirements these context menu options not required and also some situations we have to disable this context menu options also. To do this we have to add one tag in XML for that edit text box. Eg. Add the following tag to ur EditText properties.... andorid:longClickable="false"

Sencha Touch 2

Why Sencha Touch 2 INTRODUCTION: 1. As a Android developer we need to implement UI in a generic way as much as possible ,even though project is targeting to particular device. Because android support multiple screen sizes. Eg: 7 inch, 10 inch tablets , phone devices with different sizes. 2. If we are working on Iphone, we need to develop UI for both Ipad and Iphone. Same case in other technologies also. Here the question is can we develop UI to work in all the devices irrespective of the size ??? Here one more question is can we develop UI to work in most of the popular devices irrespective of platform like Android/Iphone/BlackBerry/Windows ??? Answer to the above questions is "Sencha Touch 2" What is Sencha Touch 2 ??? -Framework that enables developers to build fast and impressive apps that works on iOS, Android, BlackBerry, Kindle Fire etc and produce a native-apps. -It's a high-performan...

Template Method Pattern

Image
Template Method Motivation If we take a look at the dictionary definition of a template we can see that a template is a preset format, used as a starting point for a particular application so that the format does not have to be recreated each time it is used. On the same idea is the template method is based. A template method defines an algorithm in a base class using abstract operations that subclasses override to provide concrete behavior. Intent - Define the skeleton of an algorithm in an operation, deferring some steps to subclasses. - Template Method lets subclasses redefine certain steps of an algorithm without letting them to change the algorithm's structure. Implementation AbstractClass - defines abstract primitive operations that concrete subclasses define to implement steps of an algorithm. - implements a template method which defines the skeleton of an algorithm. The template method calls primitive operations as well as operations defined in Abstract...

Observer Pattern

Image
Observer Pattern Motivation We can not talk about Object Oriented Programming without considering the state of the objects. After all object oriented programming is about objects and their interaction. The cases when certain objects need to be informed about the changes occured in other objects are frequent. To have a good design means to decouple as much as possible and to reduce the dependencies. The Observer Design Pattern can be used whenever a subject has to be observed by one or more observers. Let's assume we have a stock system which provides data for several types of client. We want to have a client implemented as a web based application but in near future we need to add clients for mobile devices, Palm or Pocket PC, or to have a system to notify the users with sms alerts. Now it's simple to see what we need from the observer pattern: we need to separate the subject(stocks server) from it's observers(client applications) in such a way that adding new observ...

Command Pattern

Image
Command Pattern “An object that contains a symbol, name or key that represents a list of commands, actions or keystrokes”. This is the definition of a macro, one that should be familiar to any computer user. From this idea the Command design pattern was given birth. The Macro represents, at some extent, a command that is built from the reunion of a set of other commands, in a given order. Just as a macro, the Command design pattern encapsulates commands (method calls) in objects allowing us to issue requests without knowing the requested operation or the requesting object. Command design pattern provides the options to queue commands, undo/redo actions and other manipulations. Intent - encapsulate a request in an object - allows the parameterization of clients with different requests - allows saving the requests in a queue Implementation The idea and implementation of the Command design pattern is quite simple, as we will see in the diagram below, needing only few extra clas...