If you get "JVM Error 102" when starting your Blackberry, read this before you wipe everything!!
I had spent hours searching for a solution to this problem (I even went to my service provider) and all I could find was that I would have to wipe the contents of my phone and start all over again -- tough luck if I didn't have backups for my contacts, appointments, program data, etc.
What it comes down to is that the JVM 102 error means that a .cod file on your phone seems to be corrupt, so the phone refuses to load it. Why wipe everything for one bad file? You might not need to!
Follow these steps:
Download JL_Cmder
Connect your phone to your PC using the USB cable that came with it.
Run JL_Cmder and select option 2 (event log)
Scroll to the bottom of the log and look for "JVM Error 102." The line before it should tell you exactly what file is causing the error. It might look something like this. Save the file name; you will need it later.
Go to Start > Run, and type "cmd" then press Enter.
Change directory to the JL_Cmder installation folder.
e.g., type: cd "C:\Program Files\JL_Cmder\" and press enter
Type the following command to remove the offending file:
javaloader.exe -u erase -f FILENAME
where FILENAME is the name of the .cod file.
Disconnect your phone from your PC and restart it.
This might not be a permanent solution, but it should at least let you boot up your Blackberry so that you can back up all your data before reinstalling everything.
reference:
http://supportforums.blackberry.com/t5/BlackBerry-Curve/JVM-Error-102-BEFORE-YOU-WIPE-YOUR-SYSTEM/td-p/92398
Wednesday, June 22, 2011
Wednesday, June 15, 2011
Install and Uninstall Blackberry COD file using Command prompt
To uninstall the cod using command prompt
Go to Command prompt
The above mentioned is specific to my device.It may vary from device to device depending on installation.
To install the cod Using command prompt
Go to command prompt
Mention the local path of COd File while installation
Go to Command prompt
C:\Program Files\Research In Motion\BlackBerry JDE 4.7.0\bin\JavaLoader.exe -u erase -f yourcod.cod
The above mentioned is specific to my device.It may vary from device to device depending on installation.
To install the cod Using command prompt
Go to command prompt
C:\Program Files\Research In Motion\BlackBerry JDE 4.7.0\bin\JavaLoader.exe -u load yourpath\yourcod.cod
Mention the local path of COd File while installation
Monday, May 30, 2011
Share in Android
Android provides a nice feature IntentFilter.An application is said to accept share if and only if Activity has IntentFilter ACTION_SEND in Manifest.All the apps such as Twitter,FaceBook,Mail etc.. have ACTION_SEND as Intent Filter in their Manifest Files.
The above code pops a list of apps to recive share event like
Inorder to share to a particular App,First of all Know whether target application is installed in the device using packageManager.
Use following piece,
For Twitter the package is "com.twitter.android" and share class is "com.twitter.android.PostActivity".
For all the data like text,image,video just set the type of intent to "text/*" and pass the required url in putExtra(ExtraText).
Currently, In FaceBook we cannot share text.At any cost we have to send only Link URL.Otherwise it will ask for the link to post.
Intent picMessageIntent = new Intent(android.content.Intent.ACTION_SEND); picMessageIntent.setType("text/*"); picMessageIntent.putExtra(Intent.EXTRA_TEXT, "http://www.gpuri.com/images/705/70592.png"); startActivity(Intent.createChooser(picMessageIntent, "Share your picture using:"));
The above code pops a list of apps to recive share event like
Inorder to share to a particular App,First of all Know whether target application is installed in the device using packageManager.
Use following piece,
Intent sendShareIntent = new Intent(Intent.ACTION_SEND); PackageManager pm = getPackageManager(); List activityList = pm.queryIntentActivities(sendShareIntent, 0); for (int i = 0; i < activityList.size(); i++) {
ResolveInfo app = activityList.get(i); Log.e("###", "Name: " + app.activityInfo.name); }So,I will check for my FaceBook app installed in my phone or not and i'll directly start facebook share activity using Intent
Intent sendShareIntent = new Intent(Intent.ACTION_SEND); sendShareIntent.setClassName("com.facebook.katana", "com.facebook.katana.ShareLinkActivity"); sendShareIntent.setType("text/*"); sendShareIntent.putExtra(android.content.Intent.EXTRA_TEXT, "http://www.google.com/"); startActivity(sendShareIntent);This will activate facebook app directly if is present.It would be like
For Twitter the package is "com.twitter.android" and share class is "com.twitter.android.PostActivity".
For all the data like text,image,video just set the type of intent to "text/*" and pass the required url in putExtra(ExtraText).
Currently, In FaceBook we cannot share text.At any cost we have to send only Link URL.Otherwise it will ask for the link to post.
Run On UIThread in Android
To push the piece of code running in a thread to main UI thread ,
MyActivityObject.runOnUiThread(new Runnable() { @Override public void run() { //code out here } });
One of the usecase will be, modify an UI element's data from doinbackground()
method of Asynctask.
Tuesday, May 10, 2011
Loader for WebView : Android
To set Loader for webview,Set the webviewclient and override OnpageStarted,onPageFinished and onReceivedError.
When onPageStarted is called ,start the dialog and finish in onPageFinished , onRecievedError() methods.
ProgressDialog _dialog ; // Global Variable WebView webView = (WebView)findViewById(R.id.webview); webView.setWebViewClient(new WebViewClient(){ @Override public void onPageStarted(WebView view, String url, Bitmap favicon) { _dialog =ProgressDialog.show(CurrentActivity.this, "", "Please wait..."); super.onPageStarted(view, url, favicon); } // end OnPageStarted @Override public void onPageFinished(WebView view, String url) { super.onPageFinished(view, url); _dialog.dismiss(); } // end OnPageFinished() @Override public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) { super.onReceivedError(view, errorCode, description, failingUrl); try{ _dialog.dismiss(); }catch (Exception e) { // TODO: handle exception } } // end onReceivedError() }); // end WebViewclient
When onPageStarted is called ,start the dialog and finish in onPageFinished , onRecievedError() methods.
LWUIT 1.5 and latest Netbeans6.9 for J2Me updates
Attended Oracle developer seminar,Chen revealed some of the latest features of the upcoming LWUIT to be released in a month or so.
Key features:
1)Introduction of GUI builder.
This would minimize the time for UI development.We can do the total page design in Resource Editor.The internal methods of components can be accessed directly from Resource Editor.This will gonna be an amazing feature for developers.
2)Cross platform support
Cross Platfrom support enables to install our build in various devices like nokia,Blackberry etc.For Blackberry we have build the code in a different way.Yet to know.
In latest Netbeans 6.9 we have many features that will be enabled on J2ME integration.They are:
1)On Device Debugging.
Till date there is no onDeviceDebugging for NetBeans.LWUIT 1.5 adds Device Debugging.
2)CPU and N/w Monitor.
The CPU and n/w monitor will trace the amount of time taken to connect,which threads are taking more time etc.
3)List of devices support
An option under Netbeans 6.9 enables us to get the list of devices supported by our Midp . And also we can just check the JSR ,which will give the list of suppoted devices.
4)Different resolutions testing.One solution
The emulator can be maximized ,minimized and change to size what ever you want using cursor.So all resolutions testing can be done very easily.
Key features:
1)Introduction of GUI builder.
This would minimize the time for UI development.We can do the total page design in Resource Editor.The internal methods of components can be accessed directly from Resource Editor.This will gonna be an amazing feature for developers.
2)Cross platform support
Cross Platfrom support enables to install our build in various devices like nokia,Blackberry etc.For Blackberry we have build the code in a different way.Yet to know.
In latest Netbeans 6.9 we have many features that will be enabled on J2ME integration.They are:
1)On Device Debugging.
Till date there is no onDeviceDebugging for NetBeans.LWUIT 1.5 adds Device Debugging.
2)CPU and N/w Monitor.
The CPU and n/w monitor will trace the amount of time taken to connect,which threads are taking more time etc.
3)List of devices support
An option under Netbeans 6.9 enables us to get the list of devices supported by our Midp . And also we can just check the JSR ,which will give the list of suppoted devices.
4)Different resolutions testing.One solution
The emulator can be maximized ,minimized and change to size what ever you want using cursor.So all resolutions testing can be done very easily.
Saturday, May 7, 2011
Setting Connection timeout using HTTPClient
To provide timeout for HttpClient create a HttpParams Object and set Http timeout and socket timeouts .
Code Snippet
Code Snippet
HttpParams httpParameters = new BasicHttpParams(); // Set the timeout in milliseconds HttpConnectionParams.setConnectionTimeout(httpParameters, 30000); HttpConnectionParams.setSoTimeout(httpParameters,30000); DefaultHttpClient httpClient = new DefaultHttpClient(httpParameters);
Authentication for Connection,WebView,VideoView
Authentication for Connections in android can be set very easily by just a pice of code:
Authentication for WebView in android can be set using following snippet:
Register a new webclient for webview and override onReceivedHttpAuthRequest method,Set handler parameter the required authentication .
Authentication for VideoView:
I didnt get any method for authentication of VideoView but a possible solution might be :
you should provide auth parameters (username/password) inside the URL. Usually this will be accepted (but not necessatilly, you should test):
Any suggestions on videoview Auth are welcomed.
DefaultHttpClient httpClient = new DefaultHttpClient(); httpClient.getCredentialsProvider().setCredentials( new AuthScope(AuthScope.ANY_HOST, AuthScope.ANY_PORT), new UsernamePasswordCredentials("username", "password")); //if you dont know which host and port you are going to connect use // AuthScope.ANY_HOST ,AuthScope.ANY_PORT or else respective values
Authentication for WebView in android can be set using following snippet:
Register a new webclient for webview and override onReceivedHttpAuthRequest method,Set handler parameter the required authentication .
//_webView is object for WebView class _webView.setWebViewClient(new WebViewClient(){ @Override public void onReceivedHttpAuthRequest(WebView view, HttpAuthHandler handler, String host, String realm) { handler.proceed("username","password"); } });
Authentication for VideoView:
I didnt get any method for authentication of VideoView but a possible solution might be :
you should provide auth parameters (username/password) inside the URL. Usually this will be accepted (but not necessatilly, you should test):
http://username:password@www.yourhostname.com/whatever
Any suggestions on videoview Auth are welcomed.
Post Code Snippetes in Blogger as you like
Reference link:
http://techwordsinfo.wordpress.com/2012/11/10/simple-way-to-post-code-snippets-on-blogger/
It worked out for me.
http://techwordsinfo.wordpress.com/2012/11/10/simple-way-to-post-code-snippets-on-blogger/
It worked out for me.
Create a Border shapes for Layouts
We can create border for a layout using in Android.
Define this shape xml in drawable and set this shape as background for whatever layout you want.
android:right="7dp" android:bottom="7dp" />
Define this shape xml in drawable and set this shape as background for whatever layout you want.
Monday, April 11, 2011
Set Scroll position of a listview
Requirement :
Doesn't change the scroll position even if some list items are added to Listview dynamically.
problem faced : Scroll moving to first after listitems are added.
Solution:
Ref:
http://stackoverflow.com/questions/3014089/scroll-to-a-position-in-a-listview
Doesn't change the scroll position even if some list items are added to Listview dynamically.
problem faced : Scroll moving to first after listitems are added.
Solution:
// save index and top position int index = mList.getFirstVisiblePosition(); View v = mList.getChildAt(0); int top = (v == null) ? 0 : v.getTop(); // ... // restore mList.setSelectionFromTop(index, top);
Ref:
http://stackoverflow.com/questions/3014089/scroll-to-a-position-in-a-listview
Thursday, April 7, 2011
Disable BackButton (Escape) and Default MenuItems in Blackberry
While implementing loader screen on network call, i faced a problem with back button(escape) on the device which removes the loader screen from the stack resulting in unexpected results.So i override the keychar method
I still faced an issue loader screen closing on Blackberry button press.
So i overrided the onMenu method as
Finally solved...
protected boolean keyChar(char arg0, int arg1, int arg2) { if(arg0 == Keypad.KEY_ESCAPE ){ return true; }else return super.keyChar(arg0, arg1, arg1); };
I still faced an issue loader screen closing on Blackberry button press.
So i overrided the onMenu method as
public boolean onMenu(int instance) { if(instance==1073741824) return super.onMenu(instance); //returning false to intimate menu is not created return false; }
Finally solved...
Monday, February 21, 2011
ObjectChoiceField ( DropDown ) Selection change event in Blackberry
The DropDown class in BB is ObjectChoiceField.Inorder to know the field selection change in the list of objectChoiceField, overRide fieldChangeNotify( int Context ) method.
Sample piece of code
context value 2 represents the field changed.
Sample piece of code
context value 2 represents the field changed.
Tuesday, February 15, 2011
setting Connection Timeout in J2ME , LWUIT
Connection Timedout can be achieved by 2 ways as per my knowledge.
1)Setting third param in Connector.open(,,boolean timedout) to true.The genearal default timedout is nearly 2-3 minutes.There is no way to override the default timedout value.If there is , please let me know...
Use 2nd way to overcome this.
2)Use a TimerTask ,Close the connection in TimerTask.
Look at the sample code here.
The problem in this method is the connection closing is taking 1 minute additional time for me.In order to overcome this one i closed connection in a separate thread , did my things parallelly so that this time won't effect my code and connection will be closed successfully.This is one of the reasons for separate thread implementation.
And closing connection in a separate thread is a good practice.
Note:Make sure that connection objects and stream objects are not used while closing.
1)Setting third param in Connector.open(,,boolean timedout) to true.The genearal default timedout is nearly 2-3 minutes.There is no way to override the default timedout value.If there is , please let me know...
Use 2nd way to overcome this.
2)Use a TimerTask ,Close the connection in TimerTask.
Look at the sample code here.
The problem in this method is the connection closing is taking 1 minute additional time for me.In order to overcome this one i closed connection in a separate thread , did my things parallelly so that this time won't effect my code and connection will be closed successfully.This is one of the reasons for separate thread implementation.
And closing connection in a separate thread is a good practice.
Note:Make sure that connection objects and stream objects are not used while closing.
RTL implementation in LWUIT
While doing the RTL implementation in LWUIT,the components should automatically reverse their positions.But for some reason they dont behave normally as we think in some cases.
for ex:
The order of components in LTR is c1,c2,c3.
The order in RTL must be c3,c2,c1.
The order may not be as expected in RTL.
According to some observations,
--Though the components add from right to left,the x position 0 represents the left most part.So if you want override the setx in RTL please go with setx(0) for c3,c2.setx(c3.getwidth) and so on ..
There is no guarantee that this will work.This is for some cases only. i.e for simple components additions.If we go for complex Component additions( component in a component in a component etc..) this behavior differs.
for ex:
The order of components in LTR is c1,c2,c3.
The order in RTL must be c3,c2,c1.
The order may not be as expected in RTL.
According to some observations,
--Though the components add from right to left,the x position 0 represents the left most part.So if you want override the setx in RTL please go with setx(0) for c3,c2.setx(c3.getwidth) and so on ..
There is no guarantee that this will work.This is for some cases only. i.e for simple components additions.If we go for complex Component additions( component in a component in a component etc..) this behavior differs.
Subscribe to:
Posts (Atom)