Monday, May 6, 2013

Appeal : Help Required for Anvi's Bone Marrow Transplant

Dear All,

Today I receive this mail from Anvi's mom , she needs approximately INR. 21, 30,000.

Please spread the word.

Here is the original mail.

Tuesday, April 2, 2013

KDE 4.10 Applications Get Major Overhaul

KDE 4.10 delivers a long list of application upgrades for this release which cannot be overlooked. There are some new applications available and loads of fun features, meaning more fun for KDE lovers everywhere. Here is a closer look at all the latest excitement that you have all been waiting for.

http://linuxlibrary.org/kde-4-10-applications-major-overhaul/

Monday, March 4, 2013

What's new in Intelij IDEA 12

Recently when I checked update for Intellij IDEA I found that new version of ide has been released. Check the link below to see new features:

http://www.jetbrains.com/idea/whatsnew/

What I noticed is that Android support has been improved. With update to Android 4.2, IDEA 11 was no longer working with SDK, which is working now.

Wednesday, February 27, 2013

Connecting internet with tata docomo on Ubuntu

Here is a small post for those who still likes or are bound to use wvdial to connect to Internet.

I have a Tata Docomo sim with huawei e173 usb modem.Following is my /etc/wvdial.conf on Ubuntu 10.4.


[Dialer Defaults]
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Password = internet
Phone = *99#
Modem Type = Analog Modem
Stupid Mode = 1
Init3 = AT+CGDCONT=1, "IP", "TATA.DOCOMO.INTERNETHVC"
Baud = 9600
New PPPD = yes
Modem = /dev/ttyUSB_utps_modem
ISDN = 0
Username = internet
Auto Reconnect = yes

Though officially (at the time of writing this) only Tata Docomo dongles are supported, and most probably you will get this reply from CC. Still a helpful soul at CC sms'd me this line

AT+CGDCONT=1, "IP", "TATA.DOCOMO.INTERNETHVC

rest is from other sources from Internet and auto generated. A good way is to run wvdialconf and then try to add the missing lines from above, rather than copy pasting whole file.

Hope that helps.

Monday, December 3, 2012

Please help Anvi fifteen months old

Hi All,

This post is to support the cause of  treatment of Anvi. She is fifteen months old from Mumbai and she needs a life saving bone marrow transplant operation. Please read more about her here:

Please spread the word more and more to support her treatment. You could be a part of saving the life of this fifteen month child.

http://www.ndtv.com/article/cities/mumbai-couple-struggle-to-save-their-daughter-here-s-how-you-can-help-300360?fb

Saturday, November 24, 2012

Calling system applications in Android

In my previous posts I have used reading contacts through API calls, however there is an easy method for doing standard tasks by calling system's pre installed apps. In this post I am going to cover the details of how we can call the system apps through intents.


We are going to create a spinner control for providing the user some options and hit a submit button.

Here's main.xml which defines the UI.

 <?xml version="1.0" encoding="utf-8"?>  
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"  
        android:orientation="vertical"  
        android:layout_width="fill_parent"  
        android:layout_height="fill_parent"  
     >  
   <Spinner  
       android:id="@+id/spinner1"  
       android:layout_width="match_parent"  
       android:layout_height="wrap_content"  
       android:entries="@array/application_array"  
       android:prompt="@string/app_prompt" />  
   <Button  
       android:id="@+id/btnSubmit"  
       android:layout_width="wrap_content"  
       android:layout_height="wrap_content"  
       android:text="Submit"  
       android:onClick="btnSubmitOnClick"/>  
 </LinearLayout>  


Spinner control requires a string array (application_array) for it's entries which is defined in strings.xml.

 <?xml version="1.0" encoding="utf-8"?>  
 <resources>  
   <string name="app_name">callingsystemapps</string>  
   <string name="app_prompt">Choose a application</string>  
   <string-array name="application_array">  
     <item>Browser</item>  
     <item>Dialler</item>  
     <item>Map</item>  
     <item>Contacts</item>  
   </string-array>  
 </resources>  


In main.xml we have also have defined onClick method btnSubmitOnClick which is defined in MyActivity.java

   public void btnSubmitOnClick (View v)  
   {  
     Spinner spinner1 = (Spinner) findViewById(R.id.spinner1);  
     if (spinner1.getSelectedItem().toString().equals("Browser")){  
       Intent i = new  
           Intent(android.content.Intent.ACTION_VIEW,  
           Uri.parse("http://www.google.com"));  
       startActivity(i);  
     }  
     else if (spinner1.getSelectedItem().toString().equals("Dialler")){  
       Intent i = new  
           Intent(android.content.Intent.ACTION_DIAL);  
       startActivity(i);  
     }  
     else if (spinner1.getSelectedItem().toString().equals("Map")) {  
         Intent i = new  
             Intent(android.content.Intent.ACTION_VIEW,  
             Uri.parse("geo:37.827500,-122.481670"));  
         startActivity(i);  
     }  
     else if (spinner1.getSelectedItem().toString().equals("Contacts")) {  
       Intent i = new  
           Intent(android.content.Intent.ACTION_PICK);  
       i.setType(ContactsContract.CommonDataKinds.Phone.CONTENT_TYPE);  
       startActivity(i);  
     }  


Only difference between the four is the passing intent which is as below:

ACTION_VIEW
ACTION_DIAL
ACTION_PICK


Along with that we are passing parameters depending upon intent type. After that it's just calling startActivity on the intent.

Try running the example and you shall get like this.




Thanks for reading, don't forget to check links page for resources.

Wednesday, November 21, 2012

getActionBar and targetSdkVersion in Android development

Hi All,

Recently I was trying to reiterate Android docs training just to fill in anything I missed previously. There I came across this piece of code:

     // Initialize member TextView so we can manipulate it later  
     mTextView = (TextView) findViewById(R.id.edit_message);  
     // Make sure we're running on Honeycomb or higher to use ActionBar APIs  
     if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {  
       // For the main activity, make sure the app icon in the action bar  
       // does not behave as a button  
       ActionBar actionBar = getActionBar();  
       actionBar.setHomeButtonEnabled(false);  
     }  


I tried to put that in a simple hello world example and it worked on an 2.2 emulator, however it failed to run on 4.0 emulator. On debugging it turned out that getActionBar was returning null value. Though there was on-line help available for some other directions it just came to my mind to check AndroidManifest.xml file. There I saw only "android:minSdkVersion="8"" I remembered that there was a target SDK  as well which can be defined. So I checked a project created by eclipse and found the "android:targetSdkVersion="15"" line and added it to "uses-sdk " tag in AndroidManifest.xml and the app started working on 4.0 emulator.

This clears two things, first is that Idea IDE adds only minSDKVersion while eclipse adds targetSDKVersion as well. Which is reflected in new project also but could effect like this.

Second, if you search for getActionBar returning null you get loads of advice but maybe not this. So check if you are having this issue.

Thanks for reading. Thanks for Android guys for creating such a good documentation, which by and large so much better than Facebook developer docs. Only wish Facebook docs were also as clear as the Android docs.