Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search Coderanch
Advance search
Google search
Register / Login
Gopinath Karyadath
Ranch Hand
+ Follow
news
86
Posts
4
Threads
since Oct 14, 2009
Merit badge:
grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads
Recent posts by Gopinath Karyadath
Call a web service from j2me application
Hi
Create stub for using web service. you can use that stub class file for calling web service.
need more clarification on that I can help you.
Regrads
Gopinath
show more
13 years ago
Java Micro Edition
j2me
Hi
If anybody need JAVAME Applications Please contact me :
[email protected]
Regards
Gopinath
show more
13 years ago
Blatant Advertising
byte array to string conversion?
String testString = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; byte[] testBytes = testString.getBytes(); // String backToString = testBytes.toString(); String backToString = new String( testBytes , 0, testBytes.length ) System.out.println ("Length of backToString: " + backToString.length() ); // 26
Regards
Gopinath
show more
13 years ago
Java Micro Edition
toUpper in J2ME
String des = "gopinath " ; des = des.toUpperCase() // GOPINATH
Regards
show more
13 years ago
Java Micro Edition
Basic question about file Creation in J2ME
String checkMCRoot() { String rootMC = System.getProperty("fileconn.dir.memorycard"); String fpath = null; if (rootMC != null) { fpath = rootMC; } else { fpath = getRootlist(); } return fpath; } private String getRootlist() { String des = null; Enumeration roots = null; try { roots = javax.microedition.io.file.FileSystemRegistry.listRoots(); while (roots.hasMoreElements()) { des = ("file:///" + (String) roots.nextElement()); // System.out.println((String) roots.nextElement()+ " ayyooo/"); break; } } catch (NoClassDefFoundError e) { return null; } catch (Exception e) { return null; } return des; } private DataInputStream Fileconnection(String filePath) { OutputStream os = null; DataInputStream is = null; try { FileConnection filecon = (FileConnection) javax.microedition.io.Connector.open(file, javax.microedition.io.Connector.READ_WRITE); if (!filecon.exists()) { filecon.create(); os = filecon.openOutputStream(); } else { is = new DataInputStream(filecon.openDataInputStream()); } filecon.close(); } catch (IOException ioe) { } catch (java.lang.IllegalArgumentException e) { } return is ; }
Happy coding........
Regards
Gopinath
show more
13 years ago
Java Micro Edition
A simple silly question about PNG import
hi
Image image ; try { image = Image.createImage("/foto.png"); } catch (IOException ex) { System.out.println(ex.toString()); } grpahics.drawImage(image,0,0,0)
regards
show more
13 years ago
Java Micro Edition
I am not able to retrive the data from RecordStore of rms file
Hi Rajesh
I dont know which Emulator is you using. In Nokia & Samsung Emulator , there is an option for delete RMS before starting Midlet.
I am always working with Nokia & Samsung.Your code will work in real Device.
Regards
Gopinath
show more
13 years ago
Java Micro Edition
I am not able to retrive the data from RecordStore of rms file
Hi Rajesh
Are you working with Emulator ?? If please check the properties of your Emulator.
In real device it will work.
Regards
show more
13 years ago
Java Micro Edition
Can we store "Record Store" into Memory Card?
Sorry Dear !
show more
14 years ago
Java Micro Edition
J2ME with IDEA
Dear
Use jar file ins ted of jad file.
Regards
show more
14 years ago
Java Micro Edition
How to read text file in memory card from MIDlet?
You are Welcome .. Happy Coding
show more
14 years ago
Java Micro Edition
How to read text file in memory card from MIDlet?
// get memcard path path private String checkMCRoot() { String rootMC = System.getProperty("fileconn.dir.memorycard"); String fpath = null; if (rootMC != null) { fpath = rootMC; } else { return fpath; } return fpath; } [color=red]// Call Readfile //String[] arrayitems = Readfile(checkMCRoot()+"/yourfilename.txt" [/color] [b] private String[] readfile(String file) throws IOException { String des = ""; Vector v = new Vector(); int ch = 0; String[] listItems = new String[0]; FileConnection f = (FileConnection) Connector.open(file); if (!f.exists()) { return null; } DataInputStream fis = f.openDataInputStream(); // f.openInputStream(); int i = 0; try { while ((ch = fis.read()) != -1) { des += ((char) ch); if (ch == 13) { des = des.trim().toUpperCase(); v.addElement( des) ); des = ""; System.gc(); } } } catch (IOException ex) { System.out.println(ex.toString() ); } finally { try { fis.close(); } catch (IOException ex) { ex.printStackTrace(); } } System.gc(); if (!v.isEmpty()) { if (v.size() > 0) { listItems = new String[v.size()]; v.copyInto(listItems); v.removeAllElements(); } } v = null; des = null; System.gc(); return listItems ; } [/b]
show more
14 years ago
Java Micro Edition
Time format problem in MIDLet
Hi
Please go through this article.
http://www.odi.ch/prog/design/datetime.php
show more
14 years ago
Java Micro Edition
Time format problem in MIDLet
//* Gopinath - C-Square info Solutions Pvtd Ltd - Bangalore import java.util.Calendar; import java.util.Date; public class gDate { public gDate(){ } public static final int DATE_FORMAT_DD_MM_YY = 0 ; public static final int DATE_FORMAT_DD_MM_YYYY = 1 ; public static final int DATE_FORMAT_MM_DD_YYYY = 2 ; public static final int DATE_FORMAT_DDMMYYYY = 3 ; public static final int DATE_FORMAT_MMDDYYYY = 4 ; public static final int DATE_FORMAT_YYYYMMDD = 5; public static final int DATE_FORMAT_YYYY_MM_DD = 6; private int format = 0; private String sep = "-" ; public String getDate(int format,String separater,String stringdate) { this.format = format; String day ; String month ; String year ; if (stringdate == null) { Date xdate = new Date(); java.util.Calendar rightNow = java.util.Calendar.getInstance(); rightNow.setTime(xdate); year = String.valueOf(rightNow.get(java.util.Calendar.YEAR)); month = String.valueOf(rightNow.get(java.util.Calendar.MONTH) + 1); day = String.valueOf(rightNow.get(java.util.Calendar.DATE)); if (day.length() < 2) { day = "0" + day; } if (month.length() < 2) { month = "0" + month; } } else { // System.out.println(stringdate); day = (stringdate.substring(0, 2)); month = (stringdate.substring(3, 5)); year = (stringdate.substring(6)); } if (separater == null) { separater=sep ; } String ndate = year + "-" + month + "-" + day; ndate = year + month + day; switch ( format) { case 0 : ndate = day+separater+month+separater+year.substring(year.length()-2) ; break; case 1 :ndate = day+separater+month+separater+year ; break; case 2 :ndate = month+separater+day+separater+year ; break; case 3 :ndate = day+month+year ; break; case 4 :ndate = month+day+year ; break; case 5 :ndate = year + month + day; ; break; case 6 :ndate = year +separater+month +separater+day; ; break; } day = null; month = null; year = null; return ndate; } public boolean validateDate(String stringdate ) { boolean valid = false; if (stringdate.length() < 10) { return valid; } // System.out.println(stringdate.substring(0, 2) + "//"+ stringdate); // System.out.println( stringdate.substring(3, 5) ) ; // System.out.println(stringdate.substring(8)) ; String a = (stringdate.substring(0, 2)) ; String b = (stringdate.substring(3, 5) ) ; String c = (stringdate.substring(6)) ; //System.out.println("dfkgfgkdfjghkfdhgkdfhgk11") ; // System.out.println( Integer.parseInt(a) ) ; // System.out.println("dfkgfgkdfjghkfdhgkdfhgk22") ; // System.out.println( Integer.parseInt(b) ) ; // System.out.println("dfkgfgkdfjghkfdhgkdfhgk333") ; ////// System.out.println( Integer.parseInt(c) ) ; // System.out.println("dfkgfgkdfjghkfdhgkdfhgk44") ; Calendar cal = Calendar.getInstance(); cal.set(Calendar.DATE, Integer.parseInt(a ) ); cal.set(Calendar.MONTH, Integer.parseInt(b)-1 ); cal.set(Calendar.YEAR, Integer.parseInt(c )); try { cal.getTime(); valid = true; } catch (IllegalArgumentException ex) { System.out.println(ex.getMessage()); return valid; } return valid; } public Date setDate(String dte) { String dyStr = dte.substring(0, 2); String mtStr = dte.substring(3, 5); String yrStr = dte.substring(6); Calendar cal = Calendar.getInstance(); cal.set(Calendar.DATE, Integer.parseInt(dyStr)); cal.set(Calendar.MONTH, Integer.parseInt(mtStr)); cal.set(Calendar.YEAR,Integer.parseInt(yrStr)); try { cal.getTime(); } catch (IllegalArgumentException ex) { System.out.println(ex.getMessage()); } return new Date(); } public boolean isDate(Date date) { Date olddate = setDate("12610101"); if (!date.equals(olddate)) { return false; } return true; } }
ENJOY .... HAPPY CODING
show more
14 years ago
Java Micro Edition
Copy/Move files
public boolean writeFile(String s) { byte[] data = s.getBytes(); file = System.getProperty("fileconn.dir.photos") + "myfile.txt"; //;append=true"; FileConnection c = null; java.io.OutputStream os = null; try { c = (FileConnection) Connector.open(file, Connector.READ_WRITE); if (c.exists()) { c.delete(); } c.create(); os = c.openOutputStream(); os.write(data); os.flush(); os.close(); c.close(); data = null; s = null; return true; } catch (Exception e) { data = null; s = null; System.gc(); return false; } finally { try { if (os != null) { os.close(); } if (c != null) { c.close(); } } catch (Exception ex) { ex.printStackTrace(); } data = null; s = null; } }
show more
14 years ago
Java Micro Edition