Monday, September 26, 2011

Nexus S 4g 2.3.5 & 2.3.7, Nexus S 2.3.6 updates

Before you start updating, you should know if your phone needs an update or not?
Google released its 2.3.5 update for Nexus 4g which had a fix related to 3g singals and wifi which was not a issue in its 3G Nexus, So dont complaint about your phone not getting 2.3.5 update.

For Nexus S 3g Google rolled out 2.3.6 update which had fix for certain builds of phone related to voice search. So only the phones with this issues will be getting this update on their devices.

So before you update your phone please verify the phone falls in below mentioned category.
in case there is an error in updating (Certificate error) don't worry this one is not for you. :) May be you deserve a better update. So relax.

So go in your phone Settings, click on About Phone and check for following:

Nexus S 4G:
Version 2.3.7 : Build Number GRJ90 (2.3.5) model: Nexus D720  - > GWK74 (2.3.7) Released
Version 2.3.5:  Build Number GRJ22 (2.3.4) model: Nexus D720 -> GRJ90 (2.3.5) Released

Nexus S 3G:

Version 2.3.6: Build Number  GRJ22(2.3.4)  model : I9020A -> (2.3.6) Released


Update Procedure: 
1. Download the files from the provided link.
2. Rename to update and paste it at root of sdcard
3. Shutdown your phone.
4. While holding the volume up, press the power to turn on the phone.
5. use the up/down volume to select recovery press power to make the selection.
6. Your phone will now reboot into recovery.
7. When you see the little droid, while holding the power, press the volume up to bring up a menu.
8. Select "Apply update from /sdcard"
9. Scroll down to the update file you downloaded it, make sure it's highlighted then press power to select.

The update should be performed smoothly. In case the update is not performing this means only 2 things
1. Wrong version
2. Your phone is rooted. 

For rest of you you already are at top of Hierarchy for now as there is no new version for you.

Cheers... :)

Wednesday, September 21, 2011

Join Hangout from Google+ Mobile App

This is the feature i have been desperately waiting for.
Google plus announced its hangout feature for mobile phones.
Now you can join in the Hangout sessions via Google+ Mobile application.

This brings happiness to loads of user who have been willing to use it on their devices.
Hope you gonna use it to max :)

Monday, September 5, 2011

Android Infinite Looping Gallery


Hey there,
For a very long time i had been watching people struggling for developing a Infinite Looping Gallery in Android.

Saw very different solutions... some seriously complicated and some ... Not even close to solutions. So, drafted a small snippet which details about how you can create your (Virtually) Infinite Gallery.

Virtually -> No we are not going to use any thing like Integer.MAX_VALUE for number of elements in the list. No crazy circular linked list or anything of that sort and yes no copy pasting from Android Source.

Enough talk, lets code :D

All you need is a Gallery from android and some small peice of code.

Associate this listener to your Gallery

/**
* Copyright [2011] [Abhinava Srivastava]
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License. You may obtain a
* copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*/

// Constants
public final static int ADDED_EXTRA = 6;
public final static int[] mImageIds = {R.drawable.a,R.drawable.b,R.drawable.c,
R.drawable.d,R.drawable.e,R.drawable.f,
R.drawable.g,R.drawable.h,R.drawable.i,
R.drawable.j,R.drawable.k,R.drawable.l,
R.drawable.m,R.drawable.n};


// Associate it to your gallery.

private OnItemSelectedListener listner = new OnItemSelectedListener() {


public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2,
long arg3) {
if (arg2 < ImageAdapter.ADDED_EXTRA / 2)
((Gallery) findViewById(R.id.gallery1)).setSelection(
mImageIds.length + 2, false);
if (arg2 > mImageIds.length + ImageAdapter.ADDED_EXTRA / 2) {
((Gallery) findViewById(R.id.gallery1)).setSelection(4, false);
}
}


public void onNothingSelected(AdapterView<?> arg0) {
((Gallery) findViewById(R.id.gallery1)).setSelection(3, false);
}
};

In your Adapter just need to modify 2 places.

/**
* Copyright [2011] [Abhinava Srivastava]
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License. You may obtain a
* copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*/


public int getCount() {
return mImageIds.length + ADDED_EXTRA;
}



public View getView(int position, View convertView, ViewGroup parent) {
if (position < ADDED_EXTRA / 2) {
position = GalleryTestActivity.mImageIds.length
- (ADDED_EXTRA / 2 - position);
} else if (position >= (GalleryTestActivity.mImageIds.length + (ADDED_EXTRA / 2))) {
position = position
- (GalleryTestActivity.mImageIds.length + (ADDED_EXTRA / 2));
} else {
position -= (ADDED_EXTRA / 2);
}
View view = convertView;
if (view == null) {
view = inflater.inflate(R.layout.items, parent, false);
}
try {
((ImageView) view)
.setImageResource(GalleryTestActivity.mImageIds[position]);
} catch (Exception e) {
Log.i("ARRAY INDEX", "Position" + position, e);
}
return view;
}



yeah that's it.. nothing more... you are ready with you infinite looping circular gallery.

Friday, September 2, 2011

Sharing your PC Internet to Android Device (Wifi)

I had been stuck in situations when i was not able to use any 3G or Wifi (Hotspot) internet (Mostly happens in companies).
So in case you want to share your internet connection to your Android devices. There is a very simple yet powerful tool known as Connectify.

YOU CAN ONLY DO THIS ON WINDOWS 7 AND ABOVE ONLY + YOUR PC SHOULD BE  WiFi ENABLED.

Very handy and easy to use tool. Best part you can use it free.
Just visit the site: www.connectify.me and download the application.

1. Install
2. Wifi is ready to be shared :D
3. Find your wifi network you just created on your mobile
4. Start browsing :)

Hope this info will be useful.


Disclaimer: Connectify is a third party tool which i recently came across, and worked very well for me. In case it is not working for you... Sorry cannot help... 

Thursday, September 1, 2011

Showing circle around a point in Android (Code)



I had been trying to draw circle around my GeoPoint on the maps. I came across several links, the only limitation in all of them was that i was not able to see my circle growing like Google maps and stuff when i zoom in my maps.

So, finally i had to do this....
Here is a reference for the same...  feel free to use it :)


 public MyOverlay(Drawable defaultMarker, Context context, GeoPoint gp) {
super(defaultMarker, context);
mContext = context;
globalGeoPoint = new GeoPoint(gp.getLatitudeE6(), gp.getLongitudeE6());
maxSizeAreaGP = new GeoPoint(gp.getLatitudeE6()+10000,
gp.getLongitudeE6());
}

private Context mContext;
private GeoPoint globalGeoPoint;
private GeoPoint maxSizeAreaGP;

@Override
public void draw(Canvas canvas, MapView mapV, boolean shadow) {
Projection projection = mapV.getProjection();
if (shadow && projection != null) {
Point pt = new Point();
projection.toPixels(globalGeoPoint, pt);
Point pt1 = new Point();
projection.toPixels(maxSizeAreaGP, pt1);
float circleRadius = (float)Math.sqrt(Math.pow(pt1.x-pt.x, 2)+Math.pow(pt1.y-pt.y, 2));
Paint circlePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
circlePaint.setColor(0x186666ff);
circlePaint.setStyle(Style.FILL_AND_STROKE);
canvas.drawCircle((float) pt.x, (float) pt.y, circleRadius,
circlePaint);
circlePaint.setColor(0xff6666ff);
circlePaint.setStyle(Style.STROKE);
canvas.drawCircle((float) pt.x, (float) pt.y, circleRadius,
circlePaint);
Bitmap markerBitmap = BitmapFactory.decodeResource(
getApplicationContext().getResources(), R.drawable.pin);
canvas.drawBitmap(markerBitmap, pt.x,
pt.y - markerBitmap.getHeight(), null);
super.draw(canvas, mapV, shadow);
}

You can use the above code to show blue circle on the map around a point which will be pan able...
The size of circle will increasing according to zoom level.

Let me know if its not working for you...