Image Gallery on Android 3 - android

I run this program it is show normally but when I click this image or scroll this image it is crashed.Please Help me!
My code Here: enter link description here
My Error:
05-18 14:18:56.064: E/AndroidRuntime(1375): FATAL EXCEPTION: main
05-18 14:18:56.064: E/AndroidRuntime(1375): java.lang.OutOfMemoryError
05-18 14:18:56.064: E/AndroidRuntime(1375): at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
05-18 14:18:56.064: E/AndroidRuntime(1375): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:502)
05-18 14:18:56.064: E/AndroidRuntime(1375): at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:355)
05-18 14:18:56.064: E/AndroidRuntime(1375): at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:785)
05-18 14:18:56.064: E/AndroidRuntime(1375): at android.content.res.Resources.loadDrawable(Resources.java:1965)
05-18 14:18:56.064: E/AndroidRuntime(1375): at android.content.res.Resources.getDrawable(Resources.java:660)
05-18 14:18:56.064: E/AndroidRuntime(1375): at android.widget.ImageView.resolveUri(ImageView.java:616)
05-18 14:18:56.064: E/AndroidRuntime(1375): at android.widget.ImageView.setImageResource(ImageView.java:349)
05-18 14:18:56.064: E/AndroidRuntime(1375): at com.example.gallerycookbook.GalleryImageAdapter.getView(GalleryImageAdapter.java:47)
05-18 14:18:56.064: E/AndroidRuntime(1375): at android.widget.Gallery.makeAndAddView(Gallery.java:865)
05-18 14:18:56.064: E/AndroidRuntime(1375): at android.widget.Gallery.fillToGalleryRightLtr(Gallery.java:819)
05-18 14:18:56.064: E/AndroidRuntime(1375): at android.widget.Gallery.fillToGalleryRight(Gallery.java:763)
05-18 14:18:56.064: E/AndroidRuntime(1375): at android.widget.Gallery.trackMotionScroll(Gallery.java:393)
05-18 14:18:56.064: E/AndroidRuntime(1375): at android.widget.Gallery.onScroll(Gallery.java:1043)
05-18 14:18:56.064: E/AndroidRuntime(1375): at android.view.GestureDetector.onTouchEvent(GestureDetector.java:572)
05-18 14:18:56.064: E/AndroidRuntime(1375): at android.widget.Gallery.onTouchEvent(Gallery.java:958)
05-18 14:18:56.064: E/AndroidRuntime(1375): at android.view.View.dispatchTouchEvent(View.java:7246)
05-18 14:18:56.064: E/AndroidRuntime(1375): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2168)
05-18 14:18:56.064: E/AndroidRuntime(1375): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1903)
05-18 14:18:56.064: E/AndroidRuntime(1375): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2174)
05-18 14:18:56.064: E/AndroidRuntime(1375): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1917)
05-18 14:18:56.064: E/AndroidRuntime(1375): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2174)
05-18 14:18:56.064: E/AndroidRuntime(1375): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1917)
05-18 14:18:56.064: E/AndroidRuntime(1375): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2174)
05-18 14:18:56.064: E/AndroidRuntime(1375): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1917)
05-18 14:18:56.064: E/AndroidRuntime(1375): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2174)
05-18 14:18:56.064: E/AndroidRuntime(1375): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1917)
05-18 14:18:56.064: E/AndroidRuntime(1375): at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1953)
05-18 14:18:56.064: E/AndroidRuntime(1375): at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1405)
05-18 14:18:56.064: E/AndroidRuntime(1375): at android.app.Activity.dispatchTouchEvent(Activity.java:2410)
05-18 14:18:56.064: E/AndroidRuntime(1375): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1901)
05-18 14:18:56.064: E/AndroidRuntime(1375): at android.view.View.dispatchPointerEvent(View.java:7426)
05-18 14:18:56.064: E/AndroidRuntime(1375): at android.view.ViewRootImpl.deliverPointerEvent(ViewRootImpl.java:3220)
05-18 14:18:56.064: E/AndroidRuntime(1375): at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:3165)
05-18 14:18:56.064: E/AndroidRuntime(1375): at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:4292)
05-18 14:18:56.064: E/AndroidRuntime(1375): at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:4271)
05-18 14:18:56.064: E/AndroidRuntime(1375): at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:4363)

This line shows the problem :
05-18 14:18:56.064: E/AndroidRuntime(1375): FATAL EXCEPTION: main
05-18 14:18:56.064: E/AndroidRuntime(1375): java.lang.OutOfMemoryError
from oracle doc :
Thrown when the Java Virtual Machine cannot allocate an object because it is out of memory, and no more memory could be made available by the garbage collector. OutOfMemoryError objects may be constructed by the virtual machine as if suppression were disabled and/or the stack trace was not writable.
use this code to down scale your picture :
private Bitmap downscaleBitmapUsingDensities(final int sampleSize,final int imageResId)
{
final Options bitmapOptions=new Options();
bitmapOptions.inDensity=sampleSize;
bitmapOptions.inTargetDensity=1;
final Bitmap scaledBitmap=BitmapFactory.decodeResource(getResources(),imageResId,bitmapOptions);
scaledBitmap.setDensity(Bitmap.DENSITY_NONE);
return scaledBitmap;
}

You ran out of memory. This is usually when you try to show many images in one view. You should use bitmaps efficiently. One way to do it would be to use library like Universal Image loader which uses lazyloading. See here for more details.

You are trying to open image that fill whole memory that android gave to process. To avoid it you have to down sample image before show it. I suggest to use very cool library - Android Query.

Related

error facebook sdk 4.1.2 LoginButton to eclipse

05-18 19:05:06.591: E/AndroidRuntime(23525): FATAL EXCEPTION: main
05-18 19:05:06.591: E/AndroidRuntime(23525): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.fbtest/com.example.fbtest.MainActivity}: android.view.InflateException: Binary XML file line #11: Error inflating class com.facebook.login.widget.LoginButton
05-18 19:05:06.591: E/AndroidRuntime(23525): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2372)
05-18 19:05:06.591: E/AndroidRuntime(23525): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2424)
05-18 19:05:06.591: E/AndroidRuntime(23525): at android.app.ActivityThread.access$600(ActivityThread.java:169)
05-18 19:05:06.591: E/AndroidRuntime(23525): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1388)
05-18 19:05:06.591: E/AndroidRuntime(23525): at android.os.Handler.dispatchMessage(Handler.java:107)
05-18 19:05:06.591: E/AndroidRuntime(23525): at android.os.Looper.loop(Looper.java:194)
05-18 19:05:06.591: E/AndroidRuntime(23525): at android.app.ActivityThread.main(ActivityThread.java:5433)
05-18 19:05:06.591: E/AndroidRuntime(23525): at java.lang.reflect.Method.invokeNative(Native Method)
05-18 19:05:06.591: E/AndroidRuntime(23525): at java.lang.reflect.Method.invoke(Method.java:525)
05-18 19:05:06.591: E/AndroidRuntime(23525): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:924)
05-18 19:05:06.591: E/AndroidRuntime(23525): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:691)
05-18 19:05:06.591: E/AndroidRuntime(23525): at dalvik.system.NativeStart.main(Native Method)
05-18 19:05:06.591: E/AndroidRuntime(23525): Caused by: android.view.InflateException: Binary XML file line #11: Error inflating class com.facebook.login.widget.LoginButton
05-18 19:05:06.591: E/AndroidRuntime(23525): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:698)
05-18 19:05:06.591: E/AndroidRuntime(23525): at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
05-18 19:05:06.591: E/AndroidRuntime(23525): at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
05-18 19:05:06.591: E/AndroidRuntime(23525): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
05-18 19:05:06.591: E/AndroidRuntime(23525): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
05-18 19:05:06.591: E/AndroidRuntime(23525): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:274)
05-18 19:05:06.591: E/AndroidRuntime(23525): at android.app.Activity.setContentView(Activity.java:1895)
05-18 19:05:06.591: E/AndroidRuntime(23525): at com.example.fbtest.MainActivity.onCreate(MainActivity.java:23)
05-18 19:05:06.591: E/AndroidRuntime(23525): at android.app.Activity.performCreate(Activity.java:5179)
05-18 19:05:06.591: E/AndroidRuntime(23525): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1146)
05-18 19:05:06.591: E/AndroidRuntime(23525): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2336)
05-18 19:05:06.591: E/AndroidRuntime(23525): ... 11 more
05-18 19:05:06.591: E/AndroidRuntime(23525): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.facebook.login.widget.LoginButton" on path: DexPathList[[zip file "/data/app/com.example.fbtest-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.example.fbtest-2, /vendor/lib, /system/lib, /data/datalib]]
05-18 19:05:06.591: E/AndroidRuntime(23525): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:53)
05-18 19:05:06.591: E/AndroidRuntime(23525): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
05-18 19:05:06.591: E/AndroidRuntime(23525): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
05-18 19:05:06.591: E/AndroidRuntime(23525): at android.view.LayoutInflater.createView(LayoutInflater.java:552)
05-18 19:05:06.591: E/AndroidRuntime(23525): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:687)
05-18 19:05:06.591: E/AndroidRuntime(23525): ... 21 more
Have you import sdk library into eclipse,have you mark project As Library, and import that to your project?

Google API for android crashed and I doing any thing right

I'm trying to develop some app with Google Maps API.
I'm followed this tutorial step by step and the app crashed!
I tried so many tutorials, even this one, but I get always the same error:
05-18 00:53:16.466: E/AndroidRuntime(17073): FATAL EXCEPTION: main
05-18 00:53:16.466: E/AndroidRuntime(17073): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.googlemaps/com.example.googlemaps.MainActivity}: android.view.InflateException: Binary XML file line #6: Error inflating class fragment
05-18 00:53:16.466: E/AndroidRuntime(17073): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2295)
05-18 00:53:16.466: E/AndroidRuntime(17073): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2349)
05-18 00:53:16.466: E/AndroidRuntime(17073): at android.app.ActivityThread.access$700(ActivityThread.java:159)
05-18 00:53:16.466: E/AndroidRuntime(17073): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1316)
05-18 00:53:16.466: E/AndroidRuntime(17073): at android.os.Handler.dispatchMessage(Handler.java:99)
05-18 00:53:16.466: E/AndroidRuntime(17073): at android.os.Looper.loop(Looper.java:137)
05-18 00:53:16.466: E/AndroidRuntime(17073): at android.app.ActivityThread.main(ActivityThread.java:5419)
05-18 00:53:16.466: E/AndroidRuntime(17073): at java.lang.reflect.Method.invokeNative(Native Method)
05-18 00:53:16.466: E/AndroidRuntime(17073): at java.lang.reflect.Method.invoke(Method.java:525)
05-18 00:53:16.466: E/AndroidRuntime(17073): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1187)
05-18 00:53:16.466: E/AndroidRuntime(17073): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
05-18 00:53:16.466: E/AndroidRuntime(17073): at dalvik.system.NativeStart.main(Native Method)
05-18 00:53:16.466: E/AndroidRuntime(17073): Caused by: android.view.InflateException: Binary XML file line #6: Error inflating class fragment
05-18 00:53:16.466: E/AndroidRuntime(17073): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:719)
05-18 00:53:16.466: E/AndroidRuntime(17073): at android.view.LayoutInflater.rInflate(LayoutInflater.java:761)
05-18 00:53:16.466: E/AndroidRuntime(17073): at android.view.LayoutInflater.inflate(LayoutInflater.java:498)
05-18 00:53:16.466: E/AndroidRuntime(17073): at android.view.LayoutInflater.inflate(LayoutInflater.java:398)
05-18 00:53:16.466: E/AndroidRuntime(17073): at android.view.LayoutInflater.inflate(LayoutInflater.java:354)
05-18 00:53:16.466: E/AndroidRuntime(17073): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:361)
05-18 00:53:16.466: E/AndroidRuntime(17073): at android.app.Activity.setContentView(Activity.java:1956)
05-18 00:53:16.466: E/AndroidRuntime(17073): at com.example.googlemaps.MainActivity.onCreate(MainActivity.java:20)
05-18 00:53:16.466: E/AndroidRuntime(17073): at android.app.Activity.performCreate(Activity.java:5372)
05-18 00:53:16.466: E/AndroidRuntime(17073): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1104)
05-18 00:53:16.466: E/AndroidRuntime(17073): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2257)
05-18 00:53:16.466: E/AndroidRuntime(17073): ... 11 more
05-18 00:53:16.466: E/AndroidRuntime(17073): Caused by: java.lang.IllegalStateException: The meta-data tag in your app's AndroidManifest.xml does not have the right value. Expected 4132500 but found 0. You must have the following declaration within the <application> element: <meta-data android:name="com.google.android.gms.version" android:value="#integer/google_play_services_version" />
05-18 00:53:16.466: E/AndroidRuntime(17073): at com.google.android.gms.common.GooglePlayServicesUtil.n(Unknown Source)
05-18 00:53:16.466: E/AndroidRuntime(17073): at com.google.android.gms.common.GooglePlayServicesUtil.isGooglePlayServicesAvailable(Unknown Source)
05-18 00:53:16.466: E/AndroidRuntime(17073): at com.google.android.gms.maps.internal.q.v(Unknown Source)
05-18 00:53:16.466: E/AndroidRuntime(17073): at com.google.android.gms.maps.internal.q.u(Unknown Source)
05-18 00:53:16.466: E/AndroidRuntime(17073): at com.google.android.gms.maps.MapsInitializer.initialize(Unknown Source)
05-18 00:53:16.466: E/AndroidRuntime(17073): at com.google.android.gms.maps.MapFragment$b.eb(Unknown Source)
05-18 00:53:16.466: E/AndroidRuntime(17073): at com.google.android.gms.maps.MapFragment$b.a(Unknown Source)
05-18 00:53:16.466: E/AndroidRuntime(17073): at com.google.android.gms.dynamic.a.a(Unknown Source)
05-18 00:53:16.466: E/AndroidRuntime(17073): at com.google.android.gms.dynamic.a.onInflate(Unknown Source)
05-18 00:53:16.466: E/AndroidRuntime(17073): at com.google.android.gms.maps.MapFragment.onInflate(Unknown Source)
05-18 00:53:16.466: E/AndroidRuntime(17073): at android.app.Activity.onCreateView(Activity.java:4965)
05-18 00:53:16.466: E/AndroidRuntime(17073): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:695)
05-18 00:53:16.466: E/AndroidRuntime(17073): ... 21 more
Can someone help?
Replace #integer/google_play_services_version with 4132500
see this
google-play-services_lib --> res --> values --> version.xml
for the correct version of your google play services

couldn't run Google Map Marker Cluster

I tried alot added all libraries with no use and followed documentation to make it work any help would be appreciated
Here's what appear at my logcat:
05-18 17:26:50.480: E/dalvikvm(5818): Could not find class 'com.google.maps.android.utils.demo.ClusteringDemoActivity', referenced from method com.google.maps.android.utils.demo.MainActivity.onCreate
05-18 17:26:50.552: E/AndroidRuntime(5818): FATAL EXCEPTION: main
05-18 17:26:50.552: E/AndroidRuntime(5818): java.lang.NoClassDefFoundError: com.google.maps.android.utils.demo.ClusteringDemoActivity
05-18 17:26:50.552: E/AndroidRuntime(5818): at com.google.maps.android.utils.demo.MainActivity.onCreate(MainActivity.java:22)
05-18 17:26:50.552: E/AndroidRuntime(5818): at android.app.Activity.performCreate(Activity.java:5133)
05-18 17:26:50.552: E/AndroidRuntime(5818): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
05-18 17:26:50.552: E/AndroidRuntime(5818): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2175)
05-18 17:26:50.552: E/AndroidRuntime(5818): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
05-18 17:26:50.552: E/AndroidRuntime(5818): at android.app.ActivityThread.access$600(ActivityThread.java:141)
05-18 17:26:50.552: E/AndroidRuntime(5818): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
05-18 17:26:50.552: E/AndroidRuntime(5818): at android.os.Handler.dispatchMessage(Handler.java:99)
05-18 17:26:50.552: E/AndroidRuntime(5818): at android.os.Looper.loop(Looper.java:137)
05-18 17:26:50.552: E/AndroidRuntime(5818): at android.app.ActivityThread.main(ActivityThread.java:5103)
05-18 17:26:50.552: E/AndroidRuntime(5818): at java.lang.reflect.Method.invokeNative(Native Method)
05-18 17:26:50.552: E/AndroidRuntime(5818): at java.lang.reflect.Method.invoke(Method.java:525)
05-18 17:26:50.552: E/AndroidRuntime(5818): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
05-18 17:26:50.552: E/AndroidRuntime(5818): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
05-18 17:26:50.552: E/AndroidRuntime(5818): at dalvik.system.NativeStart.main(Native Method)

How to generate QR code with Zxing 2.1 library?

The problem:
Well, I´ve seen many examples how to do it, but in this library (Zxing 2.1) none seems to work. I want to encode a string into a QRCode and get the bitmap to show in a Imageview.
Question:
Should I use the older version? Anyone have a working sample with Zxing library 2.1?
What I´ve tried:
String contents = uniqueID;
BarcodeFormat barcodeFormat = BarcodeFormat.QR_CODE;
int width = 300;
int height = 300;
MultiFormatWriter barcodeWriter = new MultiFormatWriter();
try {
BitMatrix matrix = barcodeWriter.encode(contents, barcodeFormat, width, height);
} catch (WriterException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
And got this:
01-05 13:02:10.701: E/AndroidRuntime(1375): FATAL EXCEPTION: main
01-05 13:02:10.701: E/AndroidRuntime(1375): java.lang.NoClassDefFoundError: com.google.zxing.BarcodeFormat
01-05 13:02:10.701: E/AndroidRuntime(1375): at br.com.example.nightid.slidingsubmenu.IDcard.onCreate(IDcard.java:75)
01-05 13:02:10.701: E/AndroidRuntime(1375): at android.app.Activity.performCreate(Activity.java:4465)
01-05 13:02:10.701: E/AndroidRuntime(1375): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
01-05 13:02:10.701: E/AndroidRuntime(1375): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
01-05 13:02:10.701: E/AndroidRuntime(1375): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
01-05 13:02:10.701: E/AndroidRuntime(1375): at android.app.ActivityThread.access$600(ActivityThread.java:123)
01-05 13:02:10.701: E/AndroidRuntime(1375): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
01-05 13:02:10.701: E/AndroidRuntime(1375): at android.os.Handler.dispatchMessage(Handler.java:99)
01-05 13:02:10.701: E/AndroidRuntime(1375): at android.os.Looper.loop(Looper.java:137)
01-05 13:02:10.701: E/AndroidRuntime(1375): at android.app.ActivityThread.main(ActivityThread.java:4424)
01-05 13:02:10.701: E/AndroidRuntime(1375): at java.lang.reflect.Method.invokeNative(Native Method)
01-05 13:02:10.701: E/AndroidRuntime(1375): at java.lang.reflect.Method.invoke(Method.java:511)
01-05 13:02:10.701: E/AndroidRuntime(1375): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
01-05 13:02:10.701: E/AndroidRuntime(1375): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
01-05 13:02:10.701: E/AndroidRuntime(1375): at dalvik.system.NativeStart.main(Native Method)
And sorry If I'm doing a big mistake, first time using this library.
It says it right there. You didn't actually build these classes into your app. Nothing to do with the library.

spinner shows empty values on tablet, but works fine on mobiles

selectQType a simple spinner. The values are getting populated from the DB and they are fine.
ArrayAdapter<String> spinnerArrayAdapter1 =
new ArrayAdapter<String>(SpotlighterBasicActivity.this,
android.R.layout.simple_spinner_item, spinnerQTypeList);
spinnerArrayAdapter1.setDropDownViewResource( android.R.layout.simple_spinner_dropdown_item);
Spinner selectQType=(Spinner) findViewById(R.id.spinnerInputQType);
selectQType.setPrompt("QType");// logcat points warning on this line.
selectQType.setAdapter(spinnerArrayAdapter1);
selectQType.setSelection(QTypeIndex);
selectQType.setOnItemSelectedListener(new OnItemSelectedListener() {
...
}
This is the output i get for Tablet:
Strange part is that it is working perfectly fine for mobile category of emulators and devices, but giving warning for tablet category of emulators and devices.
Following is the logcat detail:
05-18 16:47:29.284: E/SpotlighterBasicActivity(481): QTypeIndex=0
05-18 16:47:29.284: E/SpotlighterBasicActivity(481): spinnerArrayList[1]=Type 1, spinnerQTypeID=5853, defaultQType=6307
05-18 16:47:29.294: E/SpotlighterBasicActivity(481): spinnerArrayList[2]=Type 2, spinnerQTypeID=6308, defaultQType=6307
05-18 16:47:29.304: W/System.err(481): java.lang.NullPointerException
05-18 16:47:29.304: W/System.err(481): at in.varit.spotlighter.basic.SpotlighterBasicActivity.loadQTypeSpinners(SpotlighterBasicActivity.java:334)
05-18 16:47:29.304: W/System.err(481): at in.varit.spotlighter.basic.SpotlighterBasicActivity.onCreate(SpotlighterBasicActivity.java:203)
05-18 16:47:29.304: W/System.err(481): at android.app.Activity.performCreate(Activity.java:4397)
05-18 16:47:29.304: W/System.err(481): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1048)
05-18 16:47:29.313: W/System.err(481): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1779)
05-18 16:47:29.313: W/System.err(481): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1831)
05-18 16:47:29.313: W/System.err(481): at android.app.ActivityThread.access$500(ActivityThread.java:122)
05-18 16:47:29.313: W/System.err(481): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1024)
05-18 16:47:29.325: W/System.err(481): at android.os.Handler.dispatchMessage(Handler.java:99)
05-18 16:47:29.325: W/System.err(481): at android.os.Looper.loop(Looper.java:132)
05-18 16:47:29.325: W/System.err(481): at android.app.ActivityThread.main(ActivityThread.java:4123)
05-18 16:47:29.325: W/System.err(481): at java.lang.reflect.Method.invokeNative(Native Method)
05-18 16:47:29.325: W/System.err(481): at java.lang.reflect.Method.invoke(Method.java:491)
05-18 16:47:29.334: W/System.err(481): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
05-18 16:47:29.334: W/System.err(481): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
05-18 16:47:29.334: W/System.err(481): at dalvik.system.NativeStart.main(Native Method)
selectQType is null And
check using if(null!=selectQType)
and also check id of selectQType is it right from layout.xml?

Categories

Resources