Posts

Showing posts from July, 2012

Generate Android key hash For Facebook App in Windows

You need to download Openssl-for-windows library.

And you need to create a folder in C:\ drive or(folder you want). And unzip all the files from openssl-for-windows library zip file.

And go to where your Java installation resides, and execute the following code. (C:\Program Files\Java\jdk1.7.0_03\bin)

keytool -export -alias myAlias -keystore C:\Users\Isuru\.android\myKeyStore | C:\openssl\bin\openssl sha1 -binary | C:\openssl\bin\openssl enc -a -e
Hit Enter, and type your password.

CATHOLICISM Faith Formation Part II

Image

How to change Eclipse Theme?

I wanted to change the Eclipse theme or template here how I did it.

There is a good website called http://eclipsecolorthemes.org . You can download Eclipse Preferences(epf) file for chosen theme.

And you have to import that file.

Go to File -> Import -> General -> Preferences -> Browse(your downloaded epf file.)


How to import Eclipse Preferences (*.epf) from Roger Dudler on Vimeo.

Creating and Showing an Android System Notification

A Android system notifications are normally used for sending notifications by Android services.

Here how you create simple notification.

public void showNotification(CharSequence message) { final int notifyRef = 1; final int notifyIcon = R.drawable.icon; final long notifyWhen = System.currentTimeMillis(); final String notifyService = Context.NOTIFICATION_SERVICE;   NotificationManager notifyManager = (NotificationManager)getSystemService(notifyService); Notification notification = new Notification( notifyIcon, message, notifyWhen);   Context context = getApplicationContext(); CharSequence notifyTitle = message; CharSequence notifyText = "You saved this message."; Intent notifyIntent = new Intent( this, MyAndroidSdkAppActivity2.class); PendingIntent contentIntent = PendingIntent.getActivity( this, 0, notifyIntent, 0); notification.setLatestEventInfo( context, notifyTitle, notifyText, content…

Showing an Android Alert Dialog

Following code will show Android Alert Dialog.


public void showOkAlertDialog(CharSequence message) { new AlertDialog.Builder(this) .setMessage(message) .setPositiveButton("OK", null) .show(); } Message Must be something you need to show to user.

Exiting an Application Activity

I didn't check this, because normally in android you not exit from the app, android os take the garbage collection for the app.

So here is the code for existing from an activity.


exitButton = (Button)findViewById(R.id.exit_button); exitButton.setOnClickListener( new Button.OnClickListener() { public void onClick (View v){ Log.d(TAG, v.toString() + ": Leaving activity..."); Runtime.getRuntime().exit(0); } } );

Install JDownloader in Ubuntu

JDownloader is the best Download manager I worked with, here how you install it in Ubuntu.

Go to terminal, and type.

sudo add-apt-repository ppa:jd-team/jdownloader sudo apt-get update && sudo apt-get install jdownloader

Ubuntu Bluetooth disabled by switch error.

I got this error and couldn't start bluetooth of my PC. But restarting bluetooth service solved the problem.


# sudo /etc/init.d/bluetooth restart

 To check device added.

# dmesg |tail