Skip to main content

Posts

Showing posts from 2014

What is CSS Class ?

In CSS, classes allow you to apply a style to a given class of an element. To do this, you link the element to the style by declaring a style for the class, then assigning that class to the element. CSS Class Syntax You declare a CSS class by using a dot (.) followed by the class name. You make up the class name yourself. After the class name you simply enter the properties/values that you want to assign to your class. .class-name { property:value; } If you want to use the same class name for multiple elements, but each with a different style, you can prefix the dot with the HTML element name. html-element-name.class-name { property:value; } You can also select elements (or classes) that's nested within another element or class. For example, div.css-section p will select all elements that are nested within a <div> element that uses the .css-section class. One major benefit of doing this is that you don't need to apply a class to every instance of an ele

What is Navigation Drawer ?

The navigation drawer is a panel that transitions in from the left edge of the screen and displays the app’s main navigation options.The user can bring the navigation drawer onto the screen by swiping from the left edge of the screen or by touching the application icon on the action bar.As the navigation drawer expands, it overlays the content but not the action bar. When the drawer is fully extended, the action bar adjusts its content by replacing the current action bar title with the app name and removing all actions that are contextual to the view underneath the navigation drawer. The overflow menu with the standard action items for Settings and Help remains visible. read more from here...

Display formatted date/time using String.format()

In this post we explains how to display formatted calendar using String.format().Let's hae a look. Download and use... import java.util.Calendar; import android.app.Activity; import android.os.Bundle; import android.widget.TextView; public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); TextView cal = (TextView)findViewById(R.id.viewdate); Calendar calendar = Calendar.getInstance(); cal.setText( String.format("%td-%tm-%tY\n", calendar, calendar, calendar) + String.format("%ty/%tm/%td\n", calendar, calendar, calendar) + String.format("%tI:%tM:%tS %tp\n", calendar, calendar, calendar, calendar) + "\n" + String.format("%tD\n", calendar) + String.format("%tc\n", calendar) + String.

Find great new apps and get tips for the ones you own with our brand new app pages

 We're always working on new ways to make your experience of Android even better, and that  goes for the AndroidPIT website too. We work hard every day to bring you the best app  recommendations, hardware reviews and Android news, and today we're launching the alpha  version of our new app overview portal. Our new app pages let you see, at a glance, all  of the best Android apps available, and you can submit reviews, ask questions and become  an app expert by sharing advice.   With the app overview pages, we wanted to create a new and user-friendly format for finding great new apps in a visually appealing way, that would also serve as a micro-forum for each particular app. Have a specific question about an app? Simply bring up the app profile and find your answer there. No answer to your question? Post it and get a response from one of our app experts or community members. The more you use them the more you learn. Answers can be rated by the community, so the best answer will

Faster Loading images in GridViews or ListViews in Android using Menory Caching, Complete implemenation with sample code.

This example shows you how to load large images in the gridview without any lag or without outofmemory error. This sample application uses the LruCache to hold the images. A cache that holds strong references to a limited number of values. Each time a value is accessed, it is moved to the head of a queue. When a value is added to a full cache, the value at the end of that queue is evicted and may become eligible for garbage collection. Read more from here. http://developer.android.com/reference/android/util/LruCache.html This is the MainActivity that holds the GridView. We are adding here 100 images in the Grid to load. This time I am loading images from the resources. MainActivity.java import java.util.ArrayList; import android.app.Activity; import android.os.Bundle; import android.widget.GridView; public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);

Different element with different background in CSS

The example explains how we can color different element with different backgrounds. <head> <style> h1 { background-color: #6395ed; } p { background-color: #e000ff; } div { background-color: #b000de; } </style> </head> <body> I'am colored <div> This is a colored div. This is a colored para We are still in the div element. </div> </body> </html>

Facebook 'colour change' virus is back, hits over 10,000 users

Have you tried to change the colour scheme of your Facebook profile lately? Beware of virus attack as a "colour change" malware is back and has already affected over 10,000 people around the world. The malware has been fixed by Facebook repeatedly but it has resurfaced again, reports added. It begins by advertising an app that tells Facebook users they can change the colour theme of their profile. Download the app and you are directed to a malicious phishing site, Mashable reported. The danger starts herewith. The website targets users by stealing their Facebook Access Tokens by asking them to view a colour changer tutorial video. Temporary access to the tokens allows hackers to connect to the user's Facebook friends. If a user does not view the video, the website tries to get them to download the malicious application. If a user is on a computer, the website leads them to download a pornographic video player. read more : http://businesstoday.intoday.in/story/f

Mobile phones next big target of hackers!

Tempted to get a new mobile phone in exchange for your old battered one? Beware! Unethical hackers can crack into every shred of personal information you have on your gadget. For cyber criminals and unethical hackers, smartphones procured through exchanges are a catch in terms of getting access to valuable data related to finances and passwords, an expert said here. “The volume of data one uses on their phones these days is huge and because of accessibility to internet services such as phone banking and e-shopping, data about one’s debit and credit cards, passwords, photographs and videos, everything is available to hackers. read more : http://tech.firstpost.com/news-analysis/mobile-phones-next-big-target-hackers-228733.html

Three formats of calling css

Call using tag: We can call a css using the tag like below. td { padding: 5px; text-align: left; background-color: #F2F2F2; } Here all the attribute with td tag will be formatted with this css. Call using id: We can call a css using the id like below and the css will be applied to the particular attribute with this particular id. #p1 { background-color: #00FF00; padding: 2px; } Here all the attribute with td id 'p1' will be formatted with this css and while using id we should call id starting with a hash (#). And in html file <div> This call calls using id </div> Call using class: We can call a css using the attribute 'class' like below and the css will be applied to the particular attribute with this particular class attribute. .p1 { background-color: #00FF00; padding: 2px; } Here all the attribute with td id 'p1' will be formatted with this css and while using id we should

CSS - Borders

The border properties allow you to specify how the border of the box representing an element should look. There are three properties of a border you can change The border-color Specifies the color of a border. The border-style Specifies whether a border should be solid, dashed line, double line, or one of the other possible values. The border-width Specifies the width of a border. Now we will see how to use these properties with examples. The border-color Property: The border-color property allows you to change the color of the border surrounding an element. You can individually change the color of the bottom, left, top and right sides of an element's border using the properties: border-bottom-color changes the color of bottom border. border-top-color changes the color of top border. border-left-color changes the color of left border. border-right-color changes the color of right border. The border-style Property: The border-style property allows

Centering Text with CSS

Centering text and other elements can easily be done with the CSS text-align property. Applying this to an internal or external stylesheet: p {text-align: center;} or this to inline styling: This is centered text

Zoom Animation between Activities in Android

Create an activity and call that activity from the main activity as shown below. MainActivity .class import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; public class MainActivity extends Activity { Button Zoombut; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Zoombut = (Button) findViewById(R.id.button1); Zoombut.setOnClickListener(new OnClickListener() { public void onClick(View arg0) { // TODO Auto-generated method stub Intent i = new Intent(MainActivity.this, success.class); startActivity(i); overridePendingTransition(R.anim.zoom_enter, R.anim.zoom_exit); }}); }} Create a folder in resource and name it as "anim" an create two xmls with the following animation code. Copy and paste the code from below: zoom_

Html Interview Questions

Which browsers support HTML 5? Almost all browsers i.e. Safari, Chrome, Firefox, Opera, Internet Explorer support HTML 5. What is SVG? SVG stands for scalable vector graphics. It’s a text based graphic language which draws images using text, lines, dots etc. This makes it lightweight and renders faster. What is canvas in HTML 5? Canvas is an HTML area on which you can draw graphics. What are the restrictions of Web Worker thread? Web worker threads cannot modify HTML elements, global variables and some window properties like Window.Location. You are free to use javascript data types, XMLHttpRequest calls etc. How to terminate a web worker? w.terminate();

Adding Background Images In Windows Phone Application

Solution 1 : You can set the Background property of this Grid control to an ImageBrush. <Grid.Background> </Grid.Background> Solution 2 : Set Grid.Background property in the LayoutRootStyle. Instead of setting the Grid.Background property in each page you can also set it once in the 'LayoutRootStyle' style. The All my pages have this style set on the root Grid control. This style is defined in the 'StandardStyles.xaml' which can be found in the 'Common' folder. The 'Background' property of the style is set to the 'ApplicationPageBackgroundThemeBrush' static resource which makes it black. You have to replace it with the ImageBrush. <Style x:Key="LayoutRootStyle" TargetType="Panel"> </Setter>

Adding Controls in Windows Phone - Add Button, TextView ..etc

Go to View --> ToolBox --> And you can add any controls.Or else you can add a bit of code as below. <Button Content="Click Me" HorizontalAlignment="Left" Margin="138,161,0,0" VerticalAlignment="Top" RenderTransformOrigin="0.617,1.507" Height="117" Width="190" Click="Button_Click_1"/> Then to add click action for controls you can just double click the controls and you may navigate to xaml.cs page where you can add your code. namespace AddControls { public partial class MainPage : PhoneApplicationPage { // Constructor public MainPage() { InitializeComponent(); // Sample code to localize the ApplicationBar //BuildLocalizedApplicationBar(); } private void Button_Click_1(object sender, RoutedEventArgs e) { Console.WriteLine("Iam being Clicked......")

What is XAML in Windows Phone Development?

Here we will talk about the purpose and nature of XAML, comparing it to C# This works almost as HTML XAML is a special usage of XML. XAML has something to do with defining a user interface in our Phone's interface. So in that regard, it feels very much like HTML. But there’s a big difference … XAML is actually used to create instances of classes and set the values of the properties. So, for example, I'm defining a Button control in XAML: <Button Name = "Sample" Width="200" Height="200" HorizontalAlignment="Left" Verticalalignment="Top" Background="Red" Click="Sample_Click" > </Button>

Apple iPhone 6 to have iOS 8 and larger display

We have heard a plenty of rumours about the upcoming iPhone, one most common rumor about the iPhone 6 is that it will feature a larger display and the upcoming iOS 8. These rumors sound promising as the current trend in smartphones is having a larger display. We have seen smartphones with display as large as 6.8-inches, that’s close to the size of a tablet. Smartphones with 5.5-inch and 6-inch display has now become common, and thus to keep up with the competition Apple must adopt the large display concept on its iPhone series of phones. Apple was stuck to its philosophy of one hand usage and stayed away from making bigger phones, last year however Apple moved one step ahead and increased the display size from 3.5-inches to 4-inches. With that 4-inch display on iPhone 5 and iPhone 5c, Apple increased the length of the display and maintained the same breadth of the phone. But now its time Apple make some software innovation to serve single hand usage and increase the display size to

How to create a new project in Windows Phone development ?

1. Make sure you’ve downloaded and installed the Windows Phone SDK. 2. Launch Visual Studio from the Windows Start screen. If the Registration window appears, you can register the product, or you can temporarily dismiss the prompt. 3. Create a new project by selecting the FILE | New Project menu command. 4. In the New Project window, expand the installed Visual C# or Visual Basic templates, and then select the Windows Phone templates. 5. In the list of Windows Phone templates, select the Windows Phone App template. 6. At the bottom of the New Project window,type the project’s Name. 7. Click OK. In the New Windows Phone Application dialog box, select Windows Phone OS 8.0 for the Target Windows Phone OS Version. When you select Windows Phone OS 8.0 as the target version, your app can only run on Windows Phone 8 devices. When you select Windows Phone OS 7.1, your app can run on both Windows Phone OS 7.1 and Windows Phone 8 devices. 8. Click OK. The new project is

Warning - No DNS Server found : Android

Mostly new android users face this problem when they install Android eclipse and run any created project than the below error comes on console of android eclipse and project does not run : Warning: No DNS servers found There is a simple solution to this issue.See below.. Go to -> Window -> Preferences -> Android -> Launch -> Default Emulator Option -> paste this: -dns-server 8.8.8.8,8.8.4.4 then Apply -> OK Now create any project you will never face this issue again.

Read File Names From Assets To A ListView

Here in this blog we are explaing how to load files names from asset and load it in a listview. Here we have saved certain html files inside assets/datas/.. Copy and Download the code... MainActivity public class MainActivity extends Activity { ListView list; String path; ArrayList<String> data = new ArrayList<String>(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); list = (ListView) findViewById(R.id.listView1); path = getResources().getString(R.string.directory); showlist(); } private void showlist() { String[] data1 = null; // *****got all resource in "am" from asset********* AssetManager am = getResources().getAssets(); try { // ***** got all one by one in arraylist "data1" ********* data1 = am.list(path); } catch (Exception e) { } for (String name : data1) { // ***** removing all .htm from extension*

Alert, Confirm, and Prompt boxes in Javascript

The three "commands" involved in creating alert, confirm, and prompt boxes are: window.alert() window.confirm() window.prompt() window.alert() : This command pops up a message box displaying whatever you put in it. <body> <script type="text/javascript"> window.alert("Iam an alert box!!!") </script> </body> window.confirm(): Confirm is used to confirm a user about certain action, and decide between two choices depending on what the user chooses. <body> <script type="text/javascript"> var x=window.confirm("Are you sure?") if (x) window.alert("Yes!") else window.alert("No") </script> </body> window.prompt(): Prompt is used to allow a user to enter something, and do something with that info: <body> <script type="text/javascript"> var y=window.prompt("Enter your name here...") window.alert(y) </script> </body>

Simple Gallery Application In Android

Here is simple gallery application.Copy and download the code and try it out..... public class mygalleryactivity extends Activity { Integer[] imageIDs = { R.drawable.pic1, R.drawable.pic2, R.drawable.pic3, R.drawable.pic4, R.drawable.pic5, R.drawable.pic6, R.drawable.pic7 }; Gallery gallery; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); gallery=(Gallery) findViewById(R.id.Gallery01); gallery.setAdapter(new ImageAdapter(this)); gallery.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView parent, View v, int position ,long id) { // TODO Auto-generated method stub Toast.makeText(getBaseContext(), "pic" + (position + 1) + "selected", Toast.LENGTH_SHORT).show(); ImageView imageView =(ImageView) findViewById(R.id.image1); imag

Android Get Current Time and Date

For getting current (today) date and time in android application, we used calendar class get the current instance of android phone clock. After getting calendar class object, we required a formatted object for date and time. Calendar c = Calendar.getInstance(); SimpleDateFormat sdf = new SimpleDateFormat("dd:MMMM:yyyy HH:mm:ss a"); String strDate = sdf.format(c.getTime()); System.out.println("================>>>"+strDate); Android Time formats table d single digit date e.g. 5 dd double digit date e.g. 05 M single digit month e.g. 1 MM double digit month e.g. 01 MMM three-letter abbreviation for month e.g. Jan MMMM month spelled out in full e.g. January yy double digit year e.g. 13 yyyy four digit year e.g. 2013 Android Time format table h single digit hours in 12 h

How to sign an android APK, a simplest way

After completing your Android Project, you have to sign it before you upload it.And here in this post we explain an easy way to sign an apk via eclipse. Double click the Android Manifest file and and clearly provide the package and version code and version name. Below that there is link called “use the export wizard”. Click on that. then another window will open, there select your desired project. click Next, then you will be asked for a keystore, if you have a keystore file then browse and locate the file. OR Create a new one. If you have a keystore file the after locating the file you have to give the password. Click on Finish and your APK file will be created in the destination directory. If you are creating a new one then… Go through these steps by filling in the details that appear in the dialog. Clicking on Finish will create your signed APK. Now Give a location for you signed apk file.- Click finish -> Your signed APK is ready for uplo

What is Static Member?

Static member is a member that belongs to the class and not to the objects of the class. Static members are specified using the keyword static. The three valid static members of a class are static constructor, static variable and static method. Static Variables: When a variable or attribute of a class is declared as static then it is called as Static Variable. Only one copy of static variable will be stored in the memory. All the objects of the class will be accessing the same copy of it. Static Methods: Static methods are the methods which are marked as static. Static method can access only static members of a class. Static methods cannot access non-static or instance members of a class. Static Constructors: Static constructors are special type of constructors that are called when the class is loaded for the first time. Static constructors are used to initialize static variables of a class.

What is a Constructor in Object Oriented Programming?

Constructor is specialized method that is contained in a class. Constructor will be triggered automatically when an object is created. Purpose of the Constructors is to initialize an object of a class. Constructor’s name is identical to the Class name. Constructors can take parameters but constructors have no return type. This is because; constructors return an object by itself. Static Constructor When a constructor of a class is marked with static modifier, then the constructor is called static constructor. Unlike other constructors, Static constructor cannot be triggered while creating instances of that class. Static constructors will be automatically triggered when the class is loaded for the first time. Static constructors are used to initialize values for the static variables of that class.

Google Glass prescription frames, shades are coming

Google Glass is getting glasses. Google is adding prescription frames and new styles of detachable sunglasses to its computerized, internet-connected goggles known as Glass. The move comes as Google Inc. prepares to make Glass available to the general population later this year. Currently, Glass is available only to the tens of thousands of people who are testing and creating apps for it. Glass hasn't actually had glasses in its frame until now. read more from ........