Wednesday, June 12, 2013
Tuesday, June 11, 2013
Android camera .set wallapaper
Android Camera App Tutorial
In this tutorial how to take a photo using the Android Phone camera and set the photo as wallpaper.Here we are using a Image View and 2 buttons for two actions.Lets start learning.
STEP BY STEP
Facebook key-android hash key
To get android key hash code follow these steps (for facebook apps)
- Download the openssl for windows here
- now unzip to c drive
- open cmd prompt
- type
cd C:\Program Files\Java\jdk1.6.0_26\bin - then type only
keytool -export -alias myAlias -keystore C:\Users\your user name\.android\myKeyStore | C:\openssl-0.9.8k_WIN32\bin\openssl sha1 -binary | C:\openssl-0.9.8k_WIN32\bin\openssl enc -a -e
i.e
keytool -exportcert -alias androiddebugkey -keystore C:\Users\YOURUSERNAME\.android\debug.keystore | C:\openssl-0.9.8k_WIN32\bin\openssl sha1 -binary | C:\openssl-0.9.8k_WIN32\bin\openssl enc -a -e
ENTER PASSWORD: android
- Done
GOOGLE MAPS KEY
- open cmd prompt
- type
cd C:\Program Files\Java\jdk1.7.0_10\bin then type
keytool -v -list -alias androiddebugkey -keystore "C:\Users\YOUR USERNAME\.android\debug.keystore"
password is android
4.copy md5 and sh1
Sunday, May 19, 2013
How to change images on imageView after some interval
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);``
//
//
int []imageArray={R.drawable.img1,R.drawable.img2,R.drawable.img3};
final Handler handler = new Handler();
Runnable runnable = new Runnable() {
int i=0;
public void run() {
imageView.setImageResource(imageArray[i]);
i++;
if(i>imageArray.length-1)
{
i=0;
}
handler.postDelayed(this, 50); //for interval...
}
};
handler.postDelayed(runnable, 2000); //for initial delay..
}
Change text size/font size of a tabhost?
You can define themes, use styles to achieve this:
First you create the theme (name:
CustomTheme) for your Activity in your res/styles.xml:<style name="CustomTheme" parent="@android:style/Theme">
<item name="android:tabWidgetStyle">@style/CustomTabWidget</item>
</style>
<style name="CustomTabWidget" parent="@android:style/Widget.TabWidget">
<item name="android:textAppearance">@style/CustomTabWidgetText</item>
</style>
<style name="CustomTabWidgetText"
parent="@android:style/TextAppearance.Widget.TabWidget">
<item name="android:textSize">20sp</item>
<item name="android:textStyle">bold</item>
</style>
Then in your
androidManifest.xml you specify the theme above for your TabActivity orActivity containing your TabWidget:<activity android:name="MyTabActivity" android:theme="@style/CustomTheme">
This will serve you with the output you want (of course you should change the size and style for your preference).
Friday, May 17, 2013
Check internet connection on Android Phone
public boolean isInternetAvailable(){
//If not in activity
// ConnectivityManager cManager = (ConnectivityManager) Context.getSystemService(Context.CONNECTIVITY_SERVICE);
//if in Activity
ConnectivityManager cManager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo nInfo = cManager.getActiveNetworkInfo();
if(nInfo == null)
return false;
else
return nInfo.isConnected();
}
and onclick event
if(isInternetAvailable()){
do something
}else {
Toast.makeText(getApplicationContext(), "You must be connected to the internet", Toast.LENGTH_LONG).show();
}
Subscribe to:
Posts (Atom)