Skip to main content

Posts

Showing posts with the label Android

Getting started with IBM worklight Mobile App In Eclipse using Ionic / Angularjs

Install Eclipse and add IBM MobileFirst Platform Studio 7.1.0 .  You can follow the following steps : Goto Help > > Eclipse Market Place >> and search for IBM MobileFirst Platform Studio 7.1.0 . and u can add and install thet plugin and get started with ionic - angular app development. You can start the new project and so can add your Environment needed and start development. After creating the sample project you can add ionic bundle folder inside your application so that you get all the necessary features of ionic development. Details and other way of installation is explained here  

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 comm...

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_...

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.

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...

How to align your TabHost at the bottom of the screen

There is a simplest way to align Tabbar at the bottom of the page. The code is given below copy and download the code and try it... In the previous example we learned a simple example to add Tabs to our application.Only a small change can give you tabs at the bottom of the page. In the previous example the xml was like this... <TabHost xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@android:id/tabhost" android:layout_width="fill_parent" android:layout_height="fill_parent" tools:context=".MainActivity" > <LinearLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <TabWidget android:id="@android:id/tabs" android:layout_width="fill_parent" ...

Change Tabbar Text (title) dynamically in Android - a simple example

Changing title of tabbar is bit easier in android Copy and download the code below and try it.... Basic tabbar tutorials see here... import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.TabHost; import android.widget.TabHost.TabSpec; import android.widget.TabWidget; import android.widget.TextView; import android.app.TabActivity; import android.content.Intent; public class MainActivity extends TabActivity { TabWidget tw; TabHost tabHost; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); /** TabHost will have Tabs */ tabHost = (TabHost)findViewById(android.R.id.tabhost); TabSpec firstTabSpec = tabHost.newTabSpec("tab_id1"); TabSpec secondTabSpec = tabHost.newTabSpec("tab_id2"); TabSpec thirdTabSpec = tabHost.newTabSpec("tab_id3"); ...

Using TabHost to create a simple Tabbar application - An Android Example

For creating a tabbar application first create a tabhost object to create tabs In activity_main.xml we create TabHost and specify a layout where we are going to insert the tabs. Copy and download the code and try it yourself.... Now we are going to create three tabs. Lets us now first make the xml for it activity_main.xml : TabHost provided flexibility of managing data in different views by providing tabbed interface(compared to TabLayout). TabHost basically a container, where you need to put tab widget, which will host tabbed interface and FrameLayout, within which the different views are presented. TabHost ( main container of tab view ) TabWidget ( used to navigate between tabs ) FrameLayout ( for tab content ) <TabHost xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@android:id/tabhost" android:layout_width="fill_parent" android:l...

What is the difference between Services, Thread and an AsyncTask in Android?

Thread Example n ANDROID -- Timer Thread Example Non Runnable States in Multithreading - Different states while thread is in runnable states What is a thread in java ? How to write interfaces in java or Android? More on Android ? Service is like an Activity but has no interface. Probably if you want to fetch the weather for example you won’t create a blank activity for it, for this you will use a Service. A Thread is a Thread, probably you already know it from other part. You need to know that you cannot update UI from a Thread. You need to use a Handler for this, but read further. An AsyncTask is an intelligent Thread that is advised to be used. Intelligent as it can help with it’s methods, and there are two methods that run on UI thread, which is good to update UI components.

Android using Bundle for sharing variables

Sharing variables between Activities is quite important point during development time of your Application. This  Example suppose Activity1 from where you run up other Activity2 .   We gonna share variable myValue. In Activity1 : myValue="string values"; Intent intent = new Intent(MainActivity.this,NewClass.class); Bundle bundle = new Bundle(); bundle.putString("myValue", myValue); intent.putExtras(bundle); startActivity(intent); or Intent intent = new Intent(MainActivity.this,NewClass.class); intent.putExtra("myValue",AnyValue); startActivity(intent); In Activity2 : Bundle bundle = getIntent().getExtras(); String value= bundle.getString(“myValue“); or Intent intent=getIntent(); Bundle bundle=intent.getExtras(); String value= bundle.getString(“myValue“);

Android JellyBean new features

# WI-Fi Direct # 1080p video recording for stock Android devices # Improved error correction on the keyboard # You can directly access the apps from the lock screen # Upgraded copy and paste functionality # Support for the WebP image format # Hardware acceleration of the universal Interface # Soft buttons from Android 3.x are now available for use on phones # Widgets in a new tab can be separated, listed in a similar manner to apps # Folders can easily be created with a drag-and-drop style # Launcher Customizer # Enhanced visual voicemail with the ability to speed up or slow down voicemail messages # Pinch-to-zoom functionality in the calendar # Integrated screenshot capture (accomplished by holding down the Power and Volume-Down buttons) # Improved voice integration and continuous, real-time speech to text dictation # Face Unlock, a feature that allows users to unlock handsets using facial recognitionsoftware # New tabbed web browser under Google’s Chrome brand, allowing up to 16 tab...

Load html file to WebView from assets in Android

Put the html file inside asset folder and use the code given below : public class MainActivity extends Activity { WebView myWebView; TextView tv; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); myWebView=(WebView) findViewById(R.id.webView1); myWebView.loadUrl("file:///android_asset/Noun.htm"); } Copy and download the code and try your self.

Intex launches Android phones Cloud X4, Cloud Y2 at Rs 4,590, Rs 6,190

Intex announced the launch of two new entry-level 3G smartphones under its Cloud range - Cloud X4 and Cloud Y2. Running on the Android 4.2 Jelly Bean OS, the Cloud X4 has a 3.5-inch screen, while the Cloud Y2 has a 4-inch screen. The former is equipped with a 1 GHz processor, while the latter is powered by a 1.2 GHz dual-core processor. Both are dual SIM phones.   read more .....

Interview Questions 31 -- 40

What is the importance of having an emulator within the Android environment? The emulator provides an interface that acts as if it were an actual mobile device. They can write and test codes, and even debug. Emulators are a safe place for testing codes especially if it is in the early design phase. Differentiate Activities from Services. Activities can be closed, or terminated anytime the user wishes. On the other hand, services are designed to run behind the scenes, and can act independently. Most services run continuously, regardless of whether there are certain or no activities being executed. What are containers? Containers, as the name itself implies, holds objects and widgets together, depending on which specific items are needed and in what particular arrangement that is wanted. Containers may hold labels, fields, buttons, or even child containers, as examples. What is Orientation? Orientation, which can be set using setOrientation(), dictates if the LinearLayout is...

What does Android Gingerbread mean?

Android Gingerbread is the codename given to version 2.3 of the Android platform. Some of the improvements in this version include a refined user interface, faster text input, support for near field communication (NFC) and system enhancements for game development.

Delete A row in ListView with Animation

Listview is simply a group of view that displays a list of scrolling items. "Adapters" are used to insert list items to the list.By default we are able to provide only text as list items.In order to delete a row from listview, copy or download this javacode and try yourself. Also see here : Android – Bullets in ListView ListView in Alphabetic Order in ANDROID Single Selection ListView in android Simple ListView in Android java file : public class SimpleListViewActivity extends Activity { private ListView mainListView; private ArrayAdapter<String> listAdapter; ArrayList<String> all_rowtext = new ArrayList<String>() ; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); // Find the ListView resource. mainListView = (ListView) findViewById(R.id.mainListView); all_rowtext.add("Angel"); all_rowtext.add("Mark"); all_rowtext.add("Coding...