[android-developers] Re: OpenGL Basics
Hi Smith, Thanks a Million for ur response..After going through several times i m able to understand GLSurfaceView to some extent.but still some portion of the code remains obscure Correct me if am wrong.it looks like the animation which we want to display should be implemented in the form of Renderer classand that Renderer instance has to be passed to GLThread classGLThread class takes care of displaying the Animation. Having Said that, we must purely concentrate on CubeRenderer Class and Cube class.is that correct??? Thanks in Advance Thanks JavaAndroid On Nov 3, 9:13 pm, DSmith [EMAIL PROTECTED] wrote: If you just want to get some animation running quickly, don't worry about understanding GLSurfaceView: reuse it as is and concentrate on understanding the CubeRenderer class. You can even reuse most of that class, just rewrite the drawFrame method to draw what you want. DSmith --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] OpenGL Basics
Hi All, I m planning to do some animation in Android. I have tried few sample tutorials and i m finding this GLSurfaceView class difficult to understand http://code.google.com/android/samples/ApiDemos/src/com/example/android/apis/graphics/GLSurfaceView.html Can Any Android Veterans throw some light on this SurafceView concept and CallBack handler, and the hierarchy of Object initialization, Renderer class and GLThread class. I feel only if we get good basics in this topic we can go ahead and create some animation Any help is highly appreciated.. Thanks in Advance Thanks JavaAndroid --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Inflating Buttons / Custom Views
Hi All, I m a novice in Android. Can anyone shed some light on Inflating Buttons and Custom Views. What is the exacet meaning of Inflating Buttons and Custom Views? Can you provide some links or Tutorials for trying out them in Activity Screen.. Thanks in Advance Thanks JavaAndroid --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Issue in LinearLayout,Button
Hi All, I tried quite a few applications present in web.. I was making a custom view using Button and LinearLayout public class SingleWeatherInfoView extends LinearLayout { public SingleWeatherInfoView(Context context) { super(context); } @SuppressWarnings(unchecked) public SingleWeatherInfoView(Context context, AttributeSet attrs, Map inflateParams) { super(context, attrs,inflateParams); } } Im getting error at this line super(context, attrs,inflateParams); it says this constructor is undefined. I feel this Class might have written for previous version of Emulator, Now its not recognizing this constructor. Is there any way to make it work in m5 version. Thanks in Advance Thanks JavaAndroid --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] XML Parsing Error
): at org.apache.harmony.luni.platform.OSNetworkSystem.createSocketImpl(Native Method) 10-18 19:46:33.757: ERROR/ParsingXML(203): at org.apache.harmony.luni.platform.OSNetworkSystem.createSocket(OSNetworkSystem.java: 79) 10-18 19:46:33.757: ERROR/ParsingXML(203): at org.apache.harmony.luni.net.PlainSocketImpl2.create(PlainSocketImpl2.java: 59) 10-18 19:46:33.757: ERROR/ParsingXML(203): at java.net.Socket.checkClosedAndCreate(Socket.java:763) 10-18 19:46:33.757: ERROR/ParsingXML(203): at java.net.Socket.connect(Socket.java:910) 10-18 19:46:33.757: ERROR/ParsingXML(203): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnection.init(HttpConnection.java: 61) 10-18 19:46:33.757: ERROR/ParsingXML(203): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnectionManager $ConnectionPool.getHttpConnection(HttpConnectionManager.java:145) 10-18 19:46:33.757: ERROR/ParsingXML(203): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnectionManager.getConnection(HttpConnectionManager.java: 67) 10-18 19:46:33.757: ERROR/ParsingXML(203): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection.getHTTPConnection(HttpURLConnection.java: 800) 10-18 19:46:33.757: ERROR/ParsingXML(203): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java: 786) 10-18 19:46:33.757: ERROR/ParsingXML(203): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java: 1030) 10-18 19:46:33.757: ERROR/ParsingXML(203): at java.net.URL.openStream(URL.java:664) 10-18 19:46:33.757: ERROR/ParsingXML(203): at com.dreamapp.parsingxml.activity.ParsingXML.onCreate(ParsingXML.java: 34) 10-18 19:46:33.757: ERROR/ParsingXML(203): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java: 1122) 10-18 19:46:33.757: ERROR/ParsingXML(203): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java: 2103) 10-18 19:46:33.757: ERROR/ParsingXML(203): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java: 2156) 10-18 19:46:33.757: ERROR/ParsingXML(203): at android.app.ActivityThread.access$1800(ActivityThread.java:112) 10-18 19:46:33.757: ERROR/ParsingXML(203): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1580) 10-18 19:46:33.757: ERROR/ParsingXML(203): at android.os.Handler.dispatchMessage(Handler.java:88) 10-18 19:46:33.757: ERROR/ParsingXML(203): at android.os.Looper.loop(Looper.java:123) 10-18 19:46:33.757: ERROR/ParsingXML(203): at android.app.ActivityThread.main(ActivityThread.java:3742) 10-18 19:46:33.757: ERROR/ParsingXML(203): at java.lang.reflect.Method.invokeNative(Native Method) 10-18 19:46:33.757: ERROR/ParsingXML(203): at java.lang.reflect.Method.invoke(Method.java:515) 10-18 19:46:33.757: ERROR/ParsingXML(203): at com.android.internal.os.ZygoteInit $MethodAndArgsCaller.run(ZygoteInit.java:739) 10-18 19:46:33.757: ERROR/ParsingXML(203): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:497) 10-18 19:46:33.757: ERROR/ParsingXML(203): at dalvik.system.NativeStart.main(Native Method) I m clueless...can somene figure out the error? Thanks in Advance Thanks JavaAndroid --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Error While Starting Emulator
) 10-18 19:32:46.116: ERROR/AndroidRuntime(188): at com.android.commands.am.Am.runStart(Am.java:197) 10-18 19:32:46.116: ERROR/AndroidRuntime(188): at com.android.commands.am.Am.run(Am.java:73) 10-18 19:32:46.116: ERROR/AndroidRuntime(188): at com.android.commands.am.Am.main(Am.java:51) 10-18 19:32:46.116: ERROR/AndroidRuntime(188): at com.android.internal.os.RuntimeInit.finishInit(Native Method) 10-18 19:32:46.116: ERROR/AndroidRuntime(188): at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:186) 10-18 19:32:46.116: ERROR/AndroidRuntime(188): at dalvik.system.NativeStart.main(Native Method) 10-18 19:32:46.156: ERROR/JavaBinder(188): Unknown binder error code. 0xfff7 10-18 19:32:46.167: ERROR/AndroidRuntime(188): Crash logging skipped, no checkin service is this a serious issue??? Thanks in Advance Thanks JavaAndroid --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: what the hell is these errors to my emulator bootup every time??
Hi, Even i m getting this error while emulator starts up.this looks very sacry..Whats the reason for this? Is there any way to fix this one... Thanks in Advance Thanks JavaAndroid On Sep 15, 2:25 am, Megha Joshi [EMAIL PROTECTED] wrote: 2008/9/14 Nickname [EMAIL PROTECTED] Thanks, Megha God! Is it reasonable to make these non-critical scary errors as warnings? Yes, could you please log a bug in the public issue tracker for this. On Sep 13, 5:39 pm, Megha Joshi [EMAIL PROTECTED] wrote: 2008/9/13 Nickname [EMAIL PROTECTED] And, what is /etc/gps.conf stuff? is it critical? how to fix the problem? Looks scary gps.conf error is not critical...this file is not needed for the mock gps feature on emulator. So you can ignore this error. (attached error log) --- 09-13 17:28:03.009: ERROR/mountd(20): could not read initial mass storage state 09-13 17:29:47.819: ERROR/MemoryHeapBase(52): error opening /dev/pmem: No such file or directory 09-13 17:29:48.050: ERROR/SurfaceFlinger(52): Couldn't open /sys/ android_power/wait_for_fb_sleep or /sys/android_power/wait_for_fb_wake 09-13 17:29:48.369: ERROR/GLLogger(52): couldn't load libhgl.so library (Cannot find library) 09-13 17:29:49.910: ERROR/GLLogger(52): couldn't load libhgl.so library (Cannot find library) 09-13 17:30:51.270: ERROR/BatteryService(52): Could not open '/sys/ class/power_supply/usb/online' 09-13 17:30:51.339: ERROR/BatteryService(52): Could not open '/sys/ class/power_supply/battery/batt_vol' 09-13 17:30:51.358: ERROR/BatteryService(52): Could not open '/sys/ class/power_supply/battery/batt_temp' 09-13 17:30:54.029: ERROR/EventHub(52): could not get driver version for /dev/input/mouse0, Not a typewriter 09-13 17:30:54.099: ERROR/EventHub(52): could not get driver version for /dev/input/mice, Not a typewriter 09-13 17:30:55.030: ERROR/System(52): Failure starting core service 09-13 17:30:55.030: ERROR/System(52): java.lang.SecurityException 09-13 17:30:55.030: ERROR/System(52): at android.os.BinderProxy.transact(Native Method) 09-13 17:30:55.030: ERROR/System(52): at android.os.ServiceManagerProxy.addService(ServiceManagerNative.java: 146) 09-13 17:30:55.030: ERROR/System(52): at android.os.ServiceManager.addService(ServiceManager.java:72) 09-13 17:30:55.030: ERROR/System(52): at com.android.server.ServerThread.run(SystemServer.java:151) 09-13 17:30:55.219: ERROR/AndroidRuntime(52): Crash logging skipped, no checkin service 09-13 17:31:01.809: ERROR/GpsLocationProvider(52): Could not open GPS configuration file /etc/gps.conf 09-13 17:31:01.809: ERROR/GpsLocationProvider(52): java.io.FileNotFoundException: /etc/gps.conf 09-13 17:31:01.809: ERROR/GpsLocationProvider(52): at org.apache.harmony.luni.platform.OSFileSystem.open(OSFileSystem.java: 227) 09-13 17:31:01.809: ERROR/GpsLocationProvider(52): at java.io.FileInputStream.init(FileInputStream.java:76) 09-13 17:31:01.809: ERROR/GpsLocationProvider(52): at com.android.internal.location.GpsLocationProvider.init(GpsLocationProvider.java: 179) 09-13 17:31:01.809: ERROR/GpsLocationProvider(52): at com.android.server.LocationManagerService._loadProvidersNoSync(LocationManagerService.java: 312) 09-13 17:31:01.809: ERROR/GpsLocationProvider(52): at com.android.server.LocationManagerService.loadProvidersNoSync(LocationManagerService.java: 296) 09-13 17:31:01.809: ERROR/GpsLocationProvider(52): at com.android.server.LocationManagerService.loadProviders(LocationManagerService.java: 289) 09-13 17:31:01.809: ERROR/GpsLocationProvider(52): at com.android.server.LocationManagerService.init(LocationManagerService.java: 403) 09-13 17:31:01.809: ERROR/GpsLocationProvider(52): at com.android.server.ServerThread.run(SystemServer.java:225) 09-13 17:31:01.919: ERROR/AndroidRuntime(52): Crash logging skipped, no checkin service 09-13 17:31:31.380: ERROR/jdwp(94): Failed sending reply to debugger: Broken pipe 09-13 17:31:32.089: ERROR/jdwp(94): ERROR: bad handshake ''- Hide quoted text - - Show quoted text - --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: XML Parsing Error
Hi Ludwig, Thanks for ur Response.. i added that entry. After adding uses- permission tag in androidmanifest.xml, i was getting UnknownHostException...it was basically due to URL classI replaced everything with HTTPClient classes Here is my modified class and it worked me. import java.io.InputStream; import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; import org.apache.commons.httpclient.HostConfiguration; import org.apache.commons.httpclient.HttpConnection; import org.apache.commons.httpclient.HttpConnectionManager; import org.apache.commons.httpclient.HttpState; import org.apache.commons.httpclient.HttpURL; import org.apache.commons.httpclient.SimpleHttpConnectionManager; import org.apache.commons.httpclient.methods.PostMethod; import org.xml.sax.InputSource; import org.xml.sax.XMLReader; import android.app.Activity; import android.os.Bundle; import android.util.Log; import android.widget.TextView; public class ParsingXML extends Activity { private final String DEBUG_TAG = ParsingXML; protected HttpConnectionManager connectionManager = new SimpleHttpConnectionManager(); /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); TextView tv = new TextView(this); String baseURL = http://www.anddev.org/images/tut/basic/ parsingxml/example.xml; HttpConnection connection = null; try{ HttpURL httpURL = new HttpURL(baseURL); HostConfiguration host = new HostConfiguration(); host.setHost(httpURL.getHost(), httpURL.getPort()); connection = connectionManager.getConnection(host); Log.d(MyLogger, Before Opening Conn); connection.open(); PostMethod postMethod = new PostMethod(baseURL); postMethod.execute(new HttpState(), connection); InputStream response = postMethod.getResponseBodyAsStream(); Log.d(MyLogger, response.toString()); SAXParserFactory spf = SAXParserFactory.newInstance(); SAXParser sp = spf.newSAXParser(); XMLReader xmlReader = sp.getXMLReader(); ExampleHandler exampleHandler = new ExampleHandler(); xmlReader.setContentHandler(exampleHandler); xmlReader.parse(new InputSource(response)); ParsedExampleDataSet parsedExampleDataSet = exampleHandler.getParsedData(); tv.setText(parsedExampleDataSet.toString()); }catch(Exception e){ tv.setText(Error: + e.getMessage()); Log.e(DEBUG_TAG, ParsingXMLError, e); } this.setContentView(tv); } } i got response from that Specified URL Thanks JavaAndroid On Oct 18, 9:37 pm, Ludwig [EMAIL PROTECTED] wrote: I think you can see from your stack that you do not even get near your XML parsing code.It is my impression that you fail open the Http connection to get the file. This might be because you have not given permission to your app to access the internet. Could you check that you have uses-permission android:name=android.permission.INTERNET / in your AndroidManifest.xml? Ludwig 2008/10/18 JavaAndroid [EMAIL PROTECTED] Hi All, I m just tried XML parsing in Android activity class...When i run the application i m getting unKnown Error in Screen... This is my Activity Class import java.net.URL; import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; import org.xml.sax.InputSource; import org.xml.sax.XMLReader; import android.app.Activity; import android.os.Bundle; import android.util.Log; import android.widget.TextView; public class ParsingXML extends Activity { private final String DEBUG_TAG = ParsingXML; /** Called when the activity is first created. */ [EMAIL PROTECTED] public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); TextView tv = new TextView(this); try{ URL url = new URL(http://www.anddev.org/images/tut/basic/ parsingxml/example.xmlhttp://www.anddev.org/images/tut/basic/parsingxml/example.xml ); SAXParserFactory spf = SAXParserFactory.newInstance(); SAXParser sp = spf.newSAXParser(); XMLReader xmlReader = sp.getXMLReader(); ExampleHandler exampleHandler = new ExampleHandler(); xmlReader.setContentHandler(exampleHandler); xmlReader.parse(new InputSource(url.openStream())); ParsedExampleDataSet parsedExampleDataSet = exampleHandler.getParsedData(); tv.setText(parsedExampleDataSet.toString()); }catch(Exception e){ tv.setText(Error: + e.getMessage()); Log.e
[android-developers] Re: Displaying Images
Hi All, I figured out the problemthe problem is with main.xml Earlier it was Gallery d=@+id/gallery android:layout_width=fill_parent android:layout_height=wrap_content android:gravity=bottom / i changed it to this Gallery android:id=@+id/gallery android:layout_width=fill_parent android:layout_height=wrap_content android:gravity=bottom / this resolved the error... Thanks JavaAndroid On Oct 17, 4:56 pm, JavaAndroid [EMAIL PROTECTED] wrote: Hi All, I tried displaying a small image in ContentView. But when i run the application It says ImageApplication closed unexpectedly This is my Activity Class... public class ImageApplication extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.main); ((Gallery) findViewById(R.id.gallery)) .setAdapter(new ImageAdapter(this)); } } And my Image Adapter class is this public class ImageAdapter extends BaseAdapter { /** The parent context */ private Context myContext; /** All images to be displayed. * Put some images to project-folder: * '/res/drawable/uvw.xyz' .*/ private int[] myImageIds = { R.drawable.image1 }; /** Simple Constructor saving the 'parent' context. */ public ImageAdapter(Context c) { this.myContext = c; } /** Returns the amount of images we have defined. */ public int getCount() { return this.myImageIds.length; } /* Use the array-Positions as unique IDs */ public Object getItem(int position) { return position; } public long getItemId(int position) { return position; } /** Returns a new ImageView to * be displayed, depending on * the position passed. */ public View getView(int position, View convertView, ViewGroup parent) { ImageView i = new ImageView(this.myContext); i.setImageResource(this.myImageIds[position]); /* Image should be scaled as width/height are set. */ i.setScaleType(ImageView.ScaleType.FIT_XY); /* Set the Width/Height of the ImageView. */ i.setLayoutParams(new Gallery.LayoutParams(150, 150)); return i; } /** Returns the size (0.0f to 1.0f) of the views * depending on the 'offset' to the center. */ public float getScale(boolean focused, int offset) { /* Formula: 1 / (2 ^ offset) */ return Math.max(0, 1.0f / (float)Math.pow(2, Math.abs(offset))); } } When i run the appliction i m getting this Exception in console... 10-17 17:14:09.864: ERROR/AndroidRuntime(203): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.dreamapp.imageapplication.activity/ com.dreamapp.imageapplication.activity.ImageApplication}: java.lang.NullPointerException 10-17 17:14:09.864: ERROR/AndroidRuntime(203): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java: 2140) 10-17 17:14:09.864: ERROR/AndroidRuntime(203): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java: 2156) 10-17 17:14:09.864: ERROR/AndroidRuntime(203): at android.app.ActivityThread.access$1800(ActivityThread.java:112) 10-17 17:14:09.864: ERROR/AndroidRuntime(203): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1580) 10-17 17:14:09.864: ERROR/AndroidRuntime(203): at android.os.Handler.dispatchMessage(Handler.java:88) 10-17 17:14:09.864: ERROR/AndroidRuntime(203): at android.os.Looper.loop(Looper.java:123) 10-17 17:14:09.864: ERROR/AndroidRuntime(203): at android.app.ActivityThread.main(ActivityThread.java:3742) 10-17 17:14:09.864: ERROR/AndroidRuntime(203): at java.lang.reflect.Method.invokeNative(Native Method) 10-17 17:14:09.864: ERROR/AndroidRuntime(203): at java.lang.reflect.Method.invoke(Method.java:515) 10-17 17:14:09.864: ERROR/AndroidRuntime(203): at com.android.internal.os.ZygoteInit $MethodAndArgsCaller.run(ZygoteInit.java:739) 10-17 17:14:09.864: ERROR/AndroidRuntime(203): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:497) 10-17 17:14:09.864: ERROR/AndroidRuntime(203): at dalvik.system.NativeStart.main(Native Method) 10-17 17:14:09.864: ERROR/AndroidRuntime(203): Caused by: java.lang.NullPointerException 10-17 17:14:09.864: ERROR/AndroidRuntime(203): at com.dreamapp.imageapplication.activity.ImageApplication.onCreate(ImageApplication.java: 17) 10-17 17:14:09.864: ERROR/AndroidRuntime(203): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java: 1122) 10-17 17:14:09.864: ERROR/AndroidRuntime(203): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java: 2103) 10-17 17:14:09.864: ERROR/AndroidRuntime(203): ... 11 more I have entry for id named gallery
[android-developers] Re: Displaying Images
Hi All, I tried displaying a small image in ContentView. But when i run the application It says ImageApplication closed unexpectedly This is my Activity Class... public class ImageApplication extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.main); ((Gallery) findViewById(R.id.gallery)) .setAdapter(new ImageAdapter(this)); } } And my Image Adapter class is this public class ImageAdapter extends BaseAdapter { /** The parent context */ private Context myContext; /** All images to be displayed. * Put some images to project-folder: * '/res/drawable/uvw.xyz' .*/ private int[] myImageIds = { R.drawable.image1 }; /** Simple Constructor saving the 'parent' context. */ public ImageAdapter(Context c) { this.myContext = c; } /** Returns the amount of images we have defined. */ public int getCount() { return this.myImageIds.length; } /* Use the array-Positions as unique IDs */ public Object getItem(int position) { return position; } public long getItemId(int position) { return position; } /** Returns a new ImageView to * be displayed, depending on * the position passed. */ public View getView(int position, View convertView, ViewGroup parent) { ImageView i = new ImageView(this.myContext); i.setImageResource(this.myImageIds[position]); /* Image should be scaled as width/height are set. */ i.setScaleType(ImageView.ScaleType.FIT_XY); /* Set the Width/Height of the ImageView. */ i.setLayoutParams(new Gallery.LayoutParams(150, 150)); return i; } /** Returns the size (0.0f to 1.0f) of the views * depending on the 'offset' to the center. */ public float getScale(boolean focused, int offset) { /* Formula: 1 / (2 ^ offset) */ return Math.max(0, 1.0f / (float)Math.pow(2, Math.abs(offset))); } } When i run the appliction i m getting this Exception in console... 10-17 17:14:09.864: ERROR/AndroidRuntime(203): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.dreamapp.imageapplication.activity/ com.dreamapp.imageapplication.activity.ImageApplication}: java.lang.NullPointerException 10-17 17:14:09.864: ERROR/AndroidRuntime(203): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java: 2140) 10-17 17:14:09.864: ERROR/AndroidRuntime(203): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java: 2156) 10-17 17:14:09.864: ERROR/AndroidRuntime(203): at android.app.ActivityThread.access$1800(ActivityThread.java:112) 10-17 17:14:09.864: ERROR/AndroidRuntime(203): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1580) 10-17 17:14:09.864: ERROR/AndroidRuntime(203): at android.os.Handler.dispatchMessage(Handler.java:88) 10-17 17:14:09.864: ERROR/AndroidRuntime(203): at android.os.Looper.loop(Looper.java:123) 10-17 17:14:09.864: ERROR/AndroidRuntime(203): at android.app.ActivityThread.main(ActivityThread.java:3742) 10-17 17:14:09.864: ERROR/AndroidRuntime(203): at java.lang.reflect.Method.invokeNative(Native Method) 10-17 17:14:09.864: ERROR/AndroidRuntime(203): at java.lang.reflect.Method.invoke(Method.java:515) 10-17 17:14:09.864: ERROR/AndroidRuntime(203): at com.android.internal.os.ZygoteInit $MethodAndArgsCaller.run(ZygoteInit.java:739) 10-17 17:14:09.864: ERROR/AndroidRuntime(203): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:497) 10-17 17:14:09.864: ERROR/AndroidRuntime(203): at dalvik.system.NativeStart.main(Native Method) 10-17 17:14:09.864: ERROR/AndroidRuntime(203): Caused by: java.lang.NullPointerException 10-17 17:14:09.864: ERROR/AndroidRuntime(203): at com.dreamapp.imageapplication.activity.ImageApplication.onCreate(ImageApplication.java: 17) 10-17 17:14:09.864: ERROR/AndroidRuntime(203): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java: 1122) 10-17 17:14:09.864: ERROR/AndroidRuntime(203): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java: 2103) 10-17 17:14:09.864: ERROR/AndroidRuntime(203): ... 11 more I have entry for id named gallery in main.xml. but it says NullPointerException at this line ((Gallery) findViewById(R.id.gallery)) .setAdapter(new ImageAdapter(this)); Can anybody identify the error, i m stuck up with this for the past 2 days.. Thanks in Advance Thanks JavaAndroid On Oct 15, 11:55 am, JavaAndroid [EMAIL PROTECTED] wrote: Hi Shailesh, Thanks a lot for ur Help. Let me try that...Thanks again. On Oct 15, 11:45 am, shailesh prakash [EMAIL PROTECTED] wrote: Hi, you may like to try this :http://code.google.com/p/apps-for-android/source/browse/trunk/Photost... On 10/15/08
[android-developers] Re: ListView Issue in Notepad Application
Thanks Peli, For ur valuable response. I tried with that too but it was not working the problem is protected void onListItemClick(ListView l, View v, int position, long _id) this rowId value _id in onListItemClick remains on 0 for all records, hence the value which we set in Intent remains to be 0 Intent i = new Intent(this,EmployeeEdit.class); i.putExtra(EmployeeDAO.KEY_ROW_ID, _id); TO overcome that what i have done is // After moving to the required Position in Cursor, i m taking the rowId from Cursor.. Since rowId forms the first coulumn in the returned result set c.moveToPosition(position); Log.d(TAG, Row Id for the selected Record+c.getLong(0)); _id = c.getLong(0); Intent i = new Intent(this,EmployeeEdit.class); i.putExtra(EmployeeDAO.KEY_ROW_ID, _id); this worked for me... now i m able to update each record without any Problem... Thanks Again Thanks JavaAndroid The problem is On Oct 14, 10:32 pm, Peli [EMAIL PROTECTED] wrote: In EmployeeEdit.onCreate() you set mRowId = null; Peli On Oct 14, 7:15 pm, JavaAndroid [EMAIL PROTECTED] wrote: Hi All, I could trouble shoot my issue. I could insert a new record and delete an existing one..But while editing and updating i m getting rowId as 0. it simply displays 0 for all records... i feel we are setting the rowId to intent in this method.. protected void onListItemClick(ListView l, View v, int position, long _id) protected void onListItemClick(ListView l, View v, int position, long _id){ super.onListItemClick(l, v, position, _id); Cursor c = mCursor; Log.d(TAG, Position in the List +position); Log.d(TAG, Cursor-+c); c.moveToPosition(position); Log.d(TAG, Row Id for the selected Record+c.getLong(0)); Intent i = new Intent(this,EmployeeEdit.class); i.putExtra(EmployeeDAO.KEY_ROW_ID,_id); i.putExtra(EmployeeDAO.EMP_NAME, c.getString( c.getColumnIndexOrThrow(EmployeeDAO.EMP_NAME))); i.putExtra(EmployeeDAO.EMP_AGE, c.getInt( c.getColumnIndexOrThrow(EmployeeDAO.EMP_AGE))); i.putExtra(EmployeeDAO.EMP_QUALIFICATION, c.getString( c.getColumnIndexOrThrow(EmployeeDAO.EMP_QUALIFICATION))); i.putExtra(EmployeeDAO.EMP_DEPT, c.getString( c.getColumnIndexOrThrow(EmployeeDAO.EMP_DEPT))); startActivityForResult(i, ACTIVITY_EDIT); } protected void onActivityResult(int requestCode, int resultCode, Intent intent){ super.onActivityResult(requestCode, resultCode, intent); Bundle extras = intent.getExtras(); switch(requestCode){ case ACTIVITY_CREATE: String employeeName = extras.getString(EmployeeDAO.EMP_NAME); int employeeAge = Integer.parseInt(extras.getString(EmployeeDAO.EMP_AGE)); String employeeQualification = extras.getString(EmployeeDAO.EMP_QUALIFICATION); String employeeDept = extras.getString(EmployeeDAO.EMP_DEPT); employee.insertEmployeeInformation(employeeName, employeeAge, employeeQualification, employeeDept); fillData(); break; case ACTIVITY_EDIT: Long rowId = extras.getLong(EmployeeDAO.KEY_ROW_ID); Log.d(TAG, RowId in Activity Edit+rowId); if(rowId != null){ Log.d(TAG, RowId While Updating the record +rowId); String updateEmployeeName = extras.getString(EmployeeDAO.EMP_NAME); int updateEmployeeAge = Integer.parseInt(extras.getString(EmployeeDAO.EMP_AGE)); String updateEmployeeQualification = extras.getString(EmployeeDAO.EMP_QUALIFICATION); String updateEmployeeDept = extras.getString(EmployeeDAO.EMP_DEPT); employee.updateEmployeeInformation(rowId, updateEmployeeName, updateEmployeeAge, updateEmployeeQualification, updateEmployeeDept); fillData(); break; } } we would be taking this value in onActivityResult() method and calling DAO layer from there. i have debugged this, but rowId always remains at 0 can anybody find where the Problem is?? All classes are present in first Post... Thanks in Advance Thanks JavaAndroid On Oct 13, 10:57 pm, JavaAndroid [EMAIL PROTECTED] wrote: Peli Thanks a million for your timely help. Logcat was really helpful in identifying the issue, and i got my application working.thanks again JavaAndroid On Oct 13, 6:15 pm, Peli [EMAIL PROTECTED] wrote: The answer is in the last post here:http://groups.google.com/group/android
[android-developers] Displaying Images
Hi All, Can anyone direct me to some links / tutorials that will help me to start experimenting on displaying images in Android . Is there any way to add Servlet/JSP API in Android Application. Can i refer image that is residing in a web server. Thanks in Advance Thanks JavaAndroid --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Displaying Images
Hi Shailesh, Thanks a lot for ur Help. Let me try that...Thanks again. On Oct 15, 11:45 am, shailesh prakash [EMAIL PROTECTED] wrote: Hi, you may like to try this :http://code.google.com/p/apps-for-android/source/browse/trunk/Photost... On 10/15/08, JavaAndroid [EMAIL PROTECTED] wrote: Hi All, Can anyone direct me to some links / tutorials that will help me to start experimenting on displaying images in Android . Is there any way to add Servlet/JSP API in Android Application. Can i refer image that is residing in a web server. Thanks in Advance Thanks JavaAndroid- Hide quoted text - - Show quoted text - --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: UI Controls
Thanks ShaileshThat forum is really awesome...it looks to be a best place to start withThanks a million.. :) On Oct 15, 11:51 am, shailesh prakash [EMAIL PROTECTED] wrote: you can try link:http://www.anddev.org, it is a good site to start with Android. On 10/15/08, JavaAndroid [EMAIL PROTECTED] wrote: Hi All Can i add UI controls like Checkbox, Radio button, Select Box, Drop down menus in my Android application... If yes could you suggest some links/tutorials that shed light in this topic. Thanks in Advance Thanks JavaAndroid- Hide quoted text - - Show quoted text - --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: ListView Issue in Notepad Application
Hi All, I could trouble shoot my issue. I could insert a new record and delete an existing one..But while editing and updating i m getting rowId as 0. it simply displays 0 for all records... i feel we are setting the rowId to intent in this method.. protected void onListItemClick(ListView l, View v, int position, long _id) protected void onListItemClick(ListView l, View v, int position, long _id){ super.onListItemClick(l, v, position, _id); Cursor c = mCursor; Log.d(TAG, Position in the List +position); Log.d(TAG, Cursor-+c); c.moveToPosition(position); Log.d(TAG, Row Id for the selected Record+c.getLong(0)); Intent i = new Intent(this,EmployeeEdit.class); i.putExtra(EmployeeDAO.KEY_ROW_ID,_id); i.putExtra(EmployeeDAO.EMP_NAME, c.getString( c.getColumnIndexOrThrow(EmployeeDAO.EMP_NAME))); i.putExtra(EmployeeDAO.EMP_AGE, c.getInt( c.getColumnIndexOrThrow(EmployeeDAO.EMP_AGE))); i.putExtra(EmployeeDAO.EMP_QUALIFICATION, c.getString( c.getColumnIndexOrThrow(EmployeeDAO.EMP_QUALIFICATION))); i.putExtra(EmployeeDAO.EMP_DEPT, c.getString( c.getColumnIndexOrThrow(EmployeeDAO.EMP_DEPT))); startActivityForResult(i, ACTIVITY_EDIT); } protected void onActivityResult(int requestCode, int resultCode, Intent intent){ super.onActivityResult(requestCode, resultCode, intent); Bundle extras = intent.getExtras(); switch(requestCode){ case ACTIVITY_CREATE: String employeeName = extras.getString(EmployeeDAO.EMP_NAME); int employeeAge = Integer.parseInt(extras.getString(EmployeeDAO.EMP_AGE)); String employeeQualification = extras.getString(EmployeeDAO.EMP_QUALIFICATION); String employeeDept = extras.getString(EmployeeDAO.EMP_DEPT); employee.insertEmployeeInformation(employeeName, employeeAge, employeeQualification, employeeDept); fillData(); break; case ACTIVITY_EDIT: Long rowId = extras.getLong(EmployeeDAO.KEY_ROW_ID); Log.d(TAG, RowId in Activity Edit+rowId); if(rowId != null){ Log.d(TAG, RowId While Updating the record +rowId); String updateEmployeeName = extras.getString(EmployeeDAO.EMP_NAME); int updateEmployeeAge = Integer.parseInt(extras.getString(EmployeeDAO.EMP_AGE)); String updateEmployeeQualification = extras.getString(EmployeeDAO.EMP_QUALIFICATION); String updateEmployeeDept = extras.getString(EmployeeDAO.EMP_DEPT); employee.updateEmployeeInformation(rowId, updateEmployeeName, updateEmployeeAge, updateEmployeeQualification, updateEmployeeDept); fillData(); break; } } we would be taking this value in onActivityResult() method and calling DAO layer from there. i have debugged this, but rowId always remains at 0 can anybody find where the Problem is?? All classes are present in first Post... Thanks in Advance Thanks JavaAndroid On Oct 13, 10:57 pm, JavaAndroid [EMAIL PROTECTED] wrote: Peli Thanks a million for your timely help. Logcat was really helpful in identifying the issue, and i got my application working.thanks again JavaAndroid On Oct 13, 6:15 pm, Peli [EMAIL PROTECTED] wrote: The answer is in the last post here:http://groups.google.com/group/android-beginners/browse_thread/thread... Since there can be several emulators open at a time, you also have to open the devices list, and click on your emulator to activate the logcat output. Peli On Oct 13, 10:25 am, JavaAndroid [EMAIL PROTECTED] wrote: Hi Peli, Thanks for ur Valuable response. I m not aware of this logcat tab in eclipse. Is that present in any Window?? Thanks JavaAndroid On Oct 13, 12:42 pm, Peli [EMAIL PROTECTED] wrote: You have to use logcat to see the debugging statements. Either from Eclipse open the logcat tab and choose the device from the devices list. Or in a shell enter adb logcat. Peliwww.openintents.org On Oct 13, 2:49 am, JavaAndroid [EMAIL PROTECTED] wrote: Hi All, I m a novice in Google Android.. Just started with couple of tutorials present in Google Android Documentation page. I have modified theNotePadapplicationpresent there. I have four textfields namely, employeeName,employeeAge, employeeQualification, employeeDept. I could insert a new record and delete an existing record, but i m facing problem in editing an existing record. When i click a record it says, theApplicationEmployeeInformation has stopped
[android-developers] Doubt in Notepad Application
Hi All, I m a neebie with Android. Jus went through the Notepad application. I have several of doubts regarding the application. 1. What is the exact purpose of Intent class? 2. Why do we pass this Intent object to startActivityForResult(i, ACTIVITY_CREATE); method. 3. What happens at the end of startActivityForResult(i, ACTIVITY_CREATE); method, which method is getting called after that? 4. What is the purpose of onActivityResult(int requestCode, int resultCode, Intent intent) method?? Any explanation would be highly appreciated Thanks in Advance Thanks JavaAndroid --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: ListView Issue in Notepad Application
Peli Thanks a million for your timely help. Logcat was really helpful in identifying the issue, and i got my application working.thanks again JavaAndroid On Oct 13, 6:15 pm, Peli [EMAIL PROTECTED] wrote: The answer is in the last post here:http://groups.google.com/group/android-beginners/browse_thread/thread... Since there can be several emulators open at a time, you also have to open the devices list, and click on your emulator to activate the logcat output. Peli On Oct 13, 10:25 am, JavaAndroid [EMAIL PROTECTED] wrote: Hi Peli, Thanks for ur Valuable response. I m not aware of this logcat tab in eclipse. Is that present in any Window?? Thanks JavaAndroid On Oct 13, 12:42 pm, Peli [EMAIL PROTECTED] wrote: You have to use logcat to see the debugging statements. Either from Eclipse open the logcat tab and choose the device from the devices list. Or in a shell enter adb logcat. Peliwww.openintents.org On Oct 13, 2:49 am, JavaAndroid [EMAIL PROTECTED] wrote: Hi All, I m a novice in Google Android.. Just started with couple of tutorials present in Google Android Documentation page. I have modified theNotePadapplicationpresent there. I have four textfields namely, employeeName,employeeAge, employeeQualification, employeeDept. I could insert a new record and delete an existing record, but i m facing problem in editing an existing record. When i click a record it says, theApplicationEmployeeInformation has stopped unexpectedly. Here is my EmployeeInfo class package com.dreamapp.employeeinfo.activity; import android.app.ListActivity; import android.content.Intent; import android.database.Cursor; import android.os.Bundle; import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.ListView; import android.widget.SimpleCursorAdapter; import com.dreamapp.employeeinfo.util.EmployeeDAO; public class EmployeeInfo extends ListActivity { private static final int ACTIVITY_CREATE =0; private static final int ACTIVITY_EDIT =1; private static final int INSERT_ID = Menu.FIRST; private static final int DELETE_ID = Menu.FIRST+1; private EmployeeDAO employee; private Cursor mCursor; private static final String TAG=EmployeeInfo; /** Called when the activity is first created. */ [EMAIL PROTECTED] public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.employee_list); employee = new EmployeeDAO(this); employee.open(); fillData(); } public void fillData(){ mCursor = employee.fetchAllEmployeeInformation(); startManagingCursor(mCursor); String[] from = new String[] {EmployeeDAO.EMP_NAME}; int[] to = new int[] {R.id.text1}; SimpleCursorAdapter employeeList = new SimpleCursorAdapter(this, R.layout.employee_row, mCursor,from, to); setListAdapter(employeeList); } public boolean onCreateOptionsMenu(Menu menu){ super.onCreateOptionsMenu(menu); menu.add(0, INSERT_ID, 0, R.string.menu_insert); menu.add(0, DELETE_ID, 0, R.string.menu_delete); return true; } public boolean onMenuItemSelected(int featureId, MenuItem item){ switch(item.getItemId()){ case INSERT_ID: insertEmployeeInformation(); return true; case DELETE_ID: employee.deleteEmployeenformation(getListView(). getSelectedItemId()); fillData(); return true; } return super.onMenuItemSelected(featureId, item); } public void insertEmployeeInformation(){ Intent i = new Intent(this,EmployeeEdit.class); startActivityForResult(i, ACTIVITY_CREATE); } protected void onListItemClick(ListView l, View v, int position, long id){ super.onListItemClick(l, v, position, id); Cursor c = mCursor; Log.w(TAG, Position in the List +position); c.moveToPosition(position); Intent i = new Intent(this,EmployeeEdit.class); i.putExtra(EmployeeDAO.KEY_ROW_ID, id); i.putExtra(EmployeeDAO.EMP_NAME, c.getString( c.getColumnIndexOrThrow(EmployeeDAO.EMP_NAME))); i.putExtra(EmployeeDAO.EMP_AGE, id); i.putExtra(EmployeeDAO.EMP_QUALIFICATION, c.getInt( c.getColumnIndexOrThrow(EmployeeDAO.EMP_QUALIFICATION))); i.putExtra(EmployeeDAO.EMP_QUALIFICATION, c.getString( c.getColumnIndexOrThrow(EmployeeDAO.EMP_QUALIFICATION))); i.putExtra(EmployeeDAO.EMP_DEPT
[android-developers] ListView Issue in Notepad Application
, DATABASE_VERSION); } @Override public void onCreate(SQLiteDatabase db) { db.execSQL(DATABASE_CREATE); } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { Log.w(TAG, Upgrading database from version + oldVersion + to + newVersion + , which will destroy all old data); db.execSQL(DROP TABLE IF EXISTS employeeMaster); } } public EmployeeDAO(Context ctx){ this.mCtx = ctx; } public EmployeeDAO open() throws SQLException{ mDbHelper = new DatabaseHelper(mCtx); mDb = mDbHelper.getWritableDatabase(); return this; } public void close(){ mDbHelper.close(); } public long insertEmployeeInformation(String employeeName, int employeeAge, String employeeQualification,String employeeDept){ ContentValues initiaValues = new ContentValues(); initiaValues.put(EMP_NAME, employeeName); initiaValues.put(EMP_AGE, employeeAge); initiaValues.put(EMP_QUALIFICATION, employeeQualification); initiaValues.put(EMP_DEPT, employeeDept); Log.w(TAG, Values Before Inserting an Employee Information + initiaValues); return mDb.insert(DATABASE_TABLE, null, initiaValues); } public boolean deleteEmployeenformation(long rowId){ Log.w(TAG, Deleting this Employee Information + rowId); return mDb.delete(DATABASE_TABLE, KEY_ROW_ID + = + rowId , null) 0; } public Cursor fetchAllEmployeeInformation(){ Log.w(TAG, Fetching all EmployeeInformation from DB); return mDb.query(DATABASE_TABLE, new String[] {KEY_ROW_ID,EMP_NAME, EMP_AGE,EMP_QUALIFICATION,EMP_DEPT}, null, null, null, null, null); } public Cursor fetchEmployeeInformation(long rowId){ Cursor mCursor = mDb.query(DATABASE_TABLE, new String[] {KEY_ROW_ID,EMP_NAME, EMP_AGE,EMP_QUALIFICATION,EMP_DEPT}, KEY_ROW_ID + = + rowId,null, null, null, null, null); if(mCursor!= null){ mCursor.moveToFirst(); } return mCursor; } public boolean updateEmployeeInformation(long rowId, String employeeName, int employeeAge, String employeeQualification, String employeeDept) { ContentValues updateValues = new ContentValues(); updateValues.put(EMP_NAME, employeeName); updateValues.put(EMP_AGE, employeeAge); updateValues.put(EMP_QUALIFICATION, employeeQualification); updateValues.put(EMP_DEPT, employeeDept); Log.w(TAG, Updating this Information +updateValues); return mDb.update(DATABASE_TABLE, updateValues , KEY_ROW_ID + = + rowId , null) 0; } } and one more thing is i have added many logger statements throughout my application, but these aren`t getting printed on Anroid Console. Is there any other technique to print these debuggigng statements. Log.w(TAG, Position in the List +position); Any help for the above mentioned issue is highly appreciated... Thanks in Advance Thanks JavaAndroid --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---