Tuesday, March 13, 2012

Opening a website as an Android App

Reference Link : http://developer.android.com/resources/tutorials/views/hello-webview.html

1)Create a simple HelloAndroid application in Eclipse using ADT plugin.

2)Open the res/layout/main.xml file and replace the code with the below snippet :
< ? xml version="1.0" encoding="utf-8"? >
< WebView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/webview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/ >

3)Now update HelloWebView.java file as below in the onCreate() method,
WebView mWebView;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView
(R.layout.main);

mWebView
= (WebView) findViewById(R.id.webview);
mWebView
.getSettings().setJavaScriptEnabled(true);
mWebView
.loadUrl("http://www.google.com");
}
This will update the view with a Webview widget.

4)Because this application needs access to the Internet, you need to add the appropriate permissions to the Android manifest file. Hence include the below tag in the AndroidManifest.xml file before the Application tag;
< uses-permission android:name="android.permission.INTERNET" / >

5)remove the title bar, with the "NoTitleBar" theme bu including the below attribute in the activity tag
android:theme="@android:style/Theme.NoTitleBar"

6)Now add the below class as a nested class within the Activity class,
private class HelloWebViewClient extends WebViewClient {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view
.loadUrl(url);
return true;
}
}

7)Set the instance of the above nested class from witing the onCreate() method as below:
mWebView.setWebViewClient(new HelloWebViewClient());

8)To handle the BACK button key press on the device, add the following method inside the HelloWebView Activity:

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if ((keyCode == KeyEvent.KEYCODE_BACK) && mWebView.canGoBack()) {
mWebView
.goBack();
return true;
}
return super.onKeyDown(keyCode, event);
}

Now run your application ...



Wednesday, August 31, 2011

Removal of unwanted Plugin-s Actionsets from Toolbar of RCP

I noticed that "search" and "debug" were still visible in my RCP after I had branded and exported it.

The solution to remove these options from my RCP was to just include the below Extension in my RCP's plugin.xml file.

< extension point="org.eclipse.ui.activities">

< activity id="rcpcolibri.disablextensions" name="Hidden activities"/>

< activityPatternBinding activityId="rcpcolibri.disablextensions"pattern="org.eclipse.debug.ui.*" / >

< activityPatternBinding activityId="rcpcolibri.disablextensions"pattern="org.eclipse.search.*" / >< / extension>

Monday, August 29, 2011

Quit Xcode via command-line

1) open Applications >> terminal

2) type, "ps aux 1 grep Xcode" >> Enter.

The above command will list a set of lines with possible xcode processes. Select the one which has the 2nd index statement of 4 digit number(????) with "xcode" in that line.

3) Now, type, "kill -9 ????" >> Enter.

Monday, August 22, 2011

Provisioning Profile for IPhone App

developer.apple.com

1) sign in with ID and password for apple.
2)Add the devices to which you want to deploy.
To do this, you need to have the device "ID" and name. The device ID can be accessed by selecting the device form 'Application > > Utilities > > Iphone Configuration Utility
3)Now click on "Provisioning" tab
4) New Profile
5)AdHoc
6)Select the device
7)"Submit"
8) Download the profile
9) Double click on the downloaded profile(file with .mobileprovision) extension
10)Click on "Add to Library"

Using this profile ID in XCode :

1) Open XCODE
2) select 'Build Settings'
3) in 'Code Sign' - select Profile that you just downloaded for all

4) Set AppID to "App ID in the provisioning profile"
5)set 'Bundle ID' of the file , -info.plist, to this same ID.

Now App is ready to be 'Build' and 'Run'.

Wednesday, July 13, 2011

Perl Upgrade in Mac

Upgrading perl :

perl -MCPAN -e shell 
cpan> install MD5 
cpan> install CPAN 
cpan> reload cpan 
cpan> q

cd /usr/local/src/ 
curl http://www.cpan.org/src/stable.tar.gz -o stable.tar.gz

gunzip stable.tar.gz tar
xvf stable.tar 
cd perl-5.8.0
./Configure -de 
make && make test 
make install
Note :
If in case any of the commands dont work.. just type the same command with prefix as 'sudo'

for examples.. if the first command,
perl -MCPAN -e shell
 does not work, then type it as
sudo perl -MCPAN -e shell
Installing extra perl modules :
  1. Even after install, if some of the modules are missing in perl, YOu need to install them in mac using the cpan utility as below :
    • browse to the perl install location, most often this location is usr/bin/perl by default. This location can also be modified during installation.
    • Type in >> ./cpan
    • >>install <> ..... For examples, if the module is XMP::Parser which is throwing error.. then, it would be, >> install XML::Parser
    • type yes. enter
    • again type yes. enter
2. Now, set perl from Preferences in eclipse to the installed location. In my above case, browse to usr/bin/perl

Now the module missing error would vanish.

************************************************************

Monday, July 4, 2011

Resetting Admin password in MacMini

This method is by using the install CD.

  • Restart the system with the cd for installation in the system.
  • Proceed with the installation until you see a toolbar appearing on the screen along with the install wizard.
  • Select "Utilities" menu from the toolbar and reset the password over there.
  • Now cancel the installation. This will prompt for system restart.
  • Restart on promt and login with your neww password.

Wednesday, June 8, 2011

Install Android and Set Eclipse for Android in MAC

Download and install Android SDK for Mac:


1) Download android sdk for mac from : http://developer.android.com/sdk/index.html 2) The downloaded sdk is still not in a usable format. This sdk needs to be updated with the required packages.
3)Browse to the installed directory >>tool>> and execute 'android'
4)This opens the 'SDK/AVD Manager' window. Select 'Installed packages' and you will see only one item under the 'installed packages ' to the right.
5)Click on 'Update all..'
6)Accept >> install all the packages.
7)Now you will see that the folder of android has been updated with many more sub-folders.
8) Hence now, the android sdk is in usable state.


Updating eclipse for android development:


1) In Eclipse , Help >> Install software. This opens an 'install' window.
2)Click on 'Add'. Enter the update site link : https://dl-ssl.google.com/android/eclipse/ in 'Location' and give it a name, say , 'Android' in the 'name' field.
note : If the above update site link doesn't work, Try to replace https with http
3)Click, 'OK' in order to obtain the plugin list for android in the 'install' window.
4) Select the plugins to be installed >> next >> next >> accept >> finish
5) Restart eclipse to update with android.
6) Now from the menu bar of Eclipse, select .. Eclipse >> Preferences >> Android. (In Windows, Window >> Preferences >> Android).
7) Set the 'SDK location' by browsing to the root folder of Android sdk. In my case, I had downloaded android to the location, /Volumes/Macintosh Backup/ECLIPSE/android-sdk-mac_x86
8) Press, apply >> OK.


Hence now, Eclipse is set for Android application development. :)



***************************************************