Android Facebook SkImageDecoder::Factory returned null - android

I'm new to the Facebook API, try to load Facebook profile image to load in imageview but I got error SkImageDecoder::Factory returned null.
My code:
URL image_value = new URL("http://graph.facebook.com/"+ id + "/picture?type=large");
Bitmap bmp = BitmapFactory.decodeStream(image_value.openConnection().getInputStream());
iv1.setImageBitmap(bmp);
This is log I have:
10-15 14:05:46.782: D/skia(25501): --- SkImageDecoder::Factory returned null
10-15 14:05:46.782: W/System.err(25501): android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views.
10-15 14:05:46.782: W/System.err(25501): at android.view.ViewRootImpl.checkThread(ViewRootImpl.java:6669)
10-15 14:05:46.782: W/System.err(25501): at android.view.ViewRootImpl.requestLayout(ViewRootImpl.java:972)
10-15 14:05:46.783: W/System.err(25501): at android.view.View.requestLayout(View.java:16757)
10-15 14:05:46.783: W/System.err(25501): at android.view.View.requestLayout(View.java:16757)
10-15 14:05:46.783: W/System.err(25501): at android.view.View.requestLayout(View.java:16757)
10-15 14:05:46.783: W/System.err(25501): at android.view.View.requestLayout(View.java:16757)
10-15 14:05:46.783: W/System.err(25501): at android.widget.RelativeLayout.requestLayout(RelativeLayout.java:369)
10-15 14:05:46.783: W/System.err(25501): at android.view.View.requestLayout(View.java:16757)
10-15 14:05:46.783: W/System.err(25501): at android.widget.ImageView.setImageDrawable(ImageView.java:424)
10-15 14:05:46.783: W/System.err(25501): at android.widget.ImageView.setImageBitmap(ImageView.java:439)
10-15 14:05:46.783: W/System.err(25501): at com.example.intellitick.a1$3.onComplete(a1.java:197)
10-15 14:05:46.783: W/System.err(25501): at com.facebook.android.AsyncFacebookRunner$2.run(AsyncFacebookRunner.java:276)
10-15 14:05:46.783: D/dalvikvm(25501): threadid=12: exiting

Ey I just add the next code Hope it helps

Related

Crashed app after change the package name

I try to change the package name.First, I rename package that is src folder, then select rename package name in android tools menu.Now when run the app: crashed the app.
Logcat errors :
10-15 15:35:19.747: E/AndroidRuntime(1272): FATAL EXCEPTION: main
10-15 15:35:19.747: E/AndroidRuntime(1272): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.nabproduct.nabege/com.nabproduct.nabege.Collection_List_Activity}: java.lang.NullPointerException
10-15 15:35:19.747: E/AndroidRuntime(1272): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059)
10-15 15:35:19.747: E/AndroidRuntime(1272): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
10-15 15:35:19.747: E/AndroidRuntime(1272): at android.app.ActivityThread.access$600(ActivityThread.java:130)
10-15 15:35:19.747: E/AndroidRuntime(1272): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
10-15 15:35:19.747: E/AndroidRuntime(1272): at android.os.Handler.dispatchMessage(Handler.java:99)
10-15 15:35:19.747: E/AndroidRuntime(1272): at android.os.Looper.loop(Looper.java:137)
10-15 15:35:19.747: E/AndroidRuntime(1272): at android.app.ActivityThread.main(ActivityThread.java:4745)
10-15 15:35:19.747: E/AndroidRuntime(1272): at java.lang.reflect.Method.invokeNative(Native Method)
10-15 15:35:19.747: E/AndroidRuntime(1272): at java.lang.reflect.Method.invoke(Method.java:511)
10-15 15:35:19.747: E/AndroidRuntime(1272): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
10-15 15:35:19.747: E/AndroidRuntime(1272): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
10-15 15:35:19.747: E/AndroidRuntime(1272): at dalvik.system.NativeStart.main(Native Method)
10-15 15:35:19.747: E/AndroidRuntime(1272): Caused by: java.lang.NullPointerException
10-15 15:35:19.747: E/AndroidRuntime(1272): at com.nabproduct.nabege.DB_Nabege_helper.count_collection(DB_Nabege_helper.java:156)
10-15 15:35:19.747: E/AndroidRuntime(1272): at com.nabproduct.nabege.Collection_List_Activity.fill_listView(Collection_List_Activity.java:361)
10-15 15:35:19.747: E/AndroidRuntime(1272): at com.nabproduct.nabege.Collection_List_Activity.onCreate(Collection_List_Activity.java:199)
10-15 15:35:19.747: E/AndroidRuntime(1272): at android.app.Activity.performCreate(Activity.java:5008)
10-15 15:35:19.747: E/AndroidRuntime(1272): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
10-15 15:35:19.747: E/AndroidRuntime(1272): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
there is a lot of thing you should change. have you changed the application ID in the gradle file??? it doesn't change automatically. have you updated the android manifest file?
try considering there...
I set the database path with a string like this: "/data/data/com.example. nabege/databases/". I changed it and solved the problem.Thank you for answering

Where get database path in database open helper?

I try to get the database path in the constructor of database helper class like this:
public DB_Nabege_helper(Context context) {
super(context, DBname, null, 1);
Nabege_context = context;
DBpath=Nabege_context.getDatabasePath(DBname).getPath();
}
When run app : crashed app
10-15 16:41:37.164: E/AndroidRuntime(1420): FATAL EXCEPTION: main
10-15 16:41:37.164: E/AndroidRuntime(1420): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.nabproduct.nabege/com.nabproduct.nabege.Collection_List_Activity}: java.lang.NullPointerException
10-15 16:41:37.164: E/AndroidRuntime(1420): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1983)
10-15 16:41:37.164: E/AndroidRuntime(1420): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
10-15 16:41:37.164: E/AndroidRuntime(1420): at android.app.ActivityThread.access$600(ActivityThread.java:130)
10-15 16:41:37.164: E/AndroidRuntime(1420): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
10-15 16:41:37.164: E/AndroidRuntime(1420): at android.os.Handler.dispatchMessage(Handler.java:99)
10-15 16:41:37.164: E/AndroidRuntime(1420): at android.os.Looper.loop(Looper.java:137)
10-15 16:41:37.164: E/AndroidRuntime(1420): at android.app.ActivityThread.main(ActivityThread.java:4745)
10-15 16:41:37.164: E/AndroidRuntime(1420): at java.lang.reflect.Method.invokeNative(Native Method)
10-15 16:41:37.164: E/AndroidRuntime(1420): at java.lang.reflect.Method.invoke(Method.java:511)
10-15 16:41:37.164: E/AndroidRuntime(1420): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
10-15 16:41:37.164: E/AndroidRuntime(1420): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
10-15 16:41:37.164: E/AndroidRuntime(1420): at dalvik.system.NativeStart.main(Native Method)
10-15 16:41:37.164: E/AndroidRuntime(1420): Caused by: java.lang.NullPointerException
10-15 16:41:37.164: E/AndroidRuntime(1420): at android.content.ContextWrapper.getDatabasePath(ContextWrapper.java:231)
10-15 16:41:37.164: E/AndroidRuntime(1420): at com.nabproduct.nabege.DB_Nabege_helper.<init>(DB_Nabege_helper.java:44)
10-15 16:41:37.164: E/AndroidRuntime(1420): at com.nabproduct.nabege.Collection_List_Activity.<init>(Collection_List_Activity.java:165)
10-15 16:41:37.164: E/AndroidRuntime(1420): at java.lang.Class.newInstanceImpl(Native Method)
10-15 16:41:37.164: E/AndroidRuntime(1420): at java.lang.Class.newInstance(Class.java:1319)
10-15 16:41:37.164: E/AndroidRuntime(1420): at android.app.Instrumentation.newActivity(Instrumentation.java:1053)
10-15 16:41:37.164: E/AndroidRuntime(1420): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1974)
I add more code as an answer.
I see from the stacktrace that you create DB helper in the activity constructor or field initializer possibly. In both cases activity isn't initialized yet (moreover you don't need to override activity constructor in the most cases). Move DB helper assignment inside the activity onCreate() method.

OOM error in volley diskbased cache

I have below OOM error on android i have used volley library for network image loading in android.
10-15 11:48:01.690: E/AndroidRuntime(22735): java.lang.OutOfMemoryError
10-15 11:48:01.690: E/AndroidRuntime(22735): at com.android.volley.toolbox.DiskBasedCache.streamToBytes(DiskBasedCache.java:322)
10-15 11:48:01.690: E/AndroidRuntime(22735): at com.android.volley.toolbox.DiskBasedCache.readString(DiskBasedCache.java:532)
10-15 11:48:01.690: E/AndroidRuntime(22735): at com.android.volley.toolbox.DiskBasedCache.readStringStringMap(DiskBasedCache.java:554)
10-15 11:48:01.690: E/AndroidRuntime(22735): at com.android.volley.toolbox.DiskBasedCache$CacheHeader.readHeader(DiskBasedCache.java:398)
10-15 11:48:01.690: E/AndroidRuntime(22735): at com.android.volley.toolbox.DiskBasedCache.initialize(DiskBasedCache.java:156)
10-15 11:48:01.690: E/AndroidRuntime(22735): at com.android.volley.CacheDispatcher.run(CacheDispatcher.java:84)

Illegal argument exception with Json

I get this error when running my code, and I don't receive anything back from json
10-15 00:29:22.396: WARN/System.err(562): java.lang.IllegalArgumentException: Illegal character in query at index 68: http://www.hotels-in-london-hotels.com/mytrolly/service.php?request={"mode":"category"}
10-15 00:29:22.425: WARN/System.err(562): at java.net.URI.create(URI.java:970)
10-15 00:29:22.425: WARN/System.err(562): at org.apache.http.client.methods.HttpGet.<init>(HttpGet.java:75)
10-15 00:29:22.436: WARN/System.err(562): at com.sampleapp.MainActivity$iTab.readTwitterFeed(MainActivity.java:128)
10-15 00:29:22.436: WARN/System.err(562): at com.sampleapp.MainActivity$iTab.<init>(MainActivity.java:65)
10-15 00:29:22.436: WARN/System.err(562): at java.lang.reflect.Constructor.constructNative(Native Method)
10-15 00:29:22.446: WARN/System.err(562): at java.lang.reflect.Constructor.newInstance(Constructor.java:446)
10-15 00:29:22.446: WARN/System.err(562): at android.view.LayoutInflater.createView(LayoutInflater.java:500)
10-15 00:29:22.456: WARN/System.err(562): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:565)
10-15 00:29:22.456: WARN/System.err(562): at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
10-15 00:29:22.466: WARN/System.err(562): at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
10-15 00:29:22.466: WARN/System.err(562): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
10-15 00:29:22.466: WARN/System.err(562): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
10-15 00:29:22.476: WARN/System.err(562): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:198)
10-15 00:29:22.476: WARN/System.err(562): at android.app.Activity.setContentView(Activity.java:1647)
10-15 00:29:22.476: WARN/System.err(562): at com.sampleapp.MainActivity.onCreate(MainActivity.java:362)
10-15 00:29:22.486: WARN/System.err(562): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
10-15 00:29:22.486: WARN/System.err(562): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
10-15 00:29:22.486: WARN/System.err(562): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
10-15 00:29:22.496: WARN/System.err(562): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
10-15 00:29:22.496: WARN/System.err(562): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
10-15 00:29:22.496: WARN/System.err(562): at android.os.Handler.dispatchMessage(Handler.java:99)
10-15 00:29:22.506: WARN/System.err(562): at android.os.Looper.loop(Looper.java:123)
10-15 00:29:22.506: WARN/System.err(562): at android.app.ActivityThread.main(ActivityThread.java:4627)
10-15 00:29:22.506: WARN/System.err(562): at java.lang.reflect.Method.invokeNative(Native Method)
10-15 00:29:22.506: WARN/System.err(562): at java.lang.reflect.Method.invoke(Method.java:521)
10-15 00:29:22.506: WARN/System.err(562): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
10-15 00:29:22.506: WARN/System.err(562): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
10-15 00:29:22.506: WARN/System.err(562): at dalvik.system.NativeStart.main(Native Method)
Basically I'm trying to use json, and the problem I'm having is with this line
HttpGet httpGet = new HttpGet(
"http://www.hotels-in-london-hotels.com/mytrolly/service.php?request={\"mode\":\"category\"}");
I've encoded the string, and I still get the exception
try {
url = "http://www.hotels-in-london-hotels.com/mytrolly/service.php?request={\"mode\":\"category\"}";
String encodedurl = URLEncoder.encode(url,"UTF-8");
Log.d("TEST", encodedurl);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
Any solutions?
You probably need to URL encode your parameter string. Try using URLEncoder
Character 68 is =, by the way.
Also, is there a problem beyond this warning (like you don't get desired result)? Note - it's not an error but warning.
The problem is the curly braces. I'd expect URLEncoder to take care of it, but you can also just manually replace them. '{' should be %7B and '}' should be "%7D".
This may helps you
String link="http://example.php?string1="+URLEncoder.encode(string1)+"&string2="+URLEncoder
.encode(string2)+"&string3="+URLEncoder.encode(string3)+"&string4="+URLEncoder.encode(string4)+"";

I got an error during activity start [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
07-26 13:32:38.705: ERROR/Zygote(32): setreuid() failed. errno: 2
07-26 13:32:46.206: ERROR/Zygote(32): setreuid() failed. errno: 17
07-26 13:32:47.526: ERROR/BatteryService(58): usbOnlinePath not found
07-26 13:32:47.526: ERROR/BatteryService(58): batteryVoltagePath not found
07-26 13:32:47.526: ERROR/BatteryService(58): batteryTemperaturePath not found
07-26 13:32:47.556: ERROR/SurfaceFlinger(58): Couldn't open /sys/power/wait_for_fb_sleep or /sys/power/wait_for_fb_wake
07-26 13:32:54.275: ERROR/EventHub(58): could not get driver version for /dev/input/mouse0, Not a typewriter
07-26 13:32:54.285: ERROR/EventHub(58): could not get driver version for /dev/input/mice, Not a typewriter
07-26 13:32:54.496: ERROR/System(58): Failure starting core service
07-26 13:32:54.496: ERROR/System(58): java.lang.SecurityException
07-26 13:32:54.496: ERROR/System(58): at android.os.BinderProxy.transact(Native Method)
07-26 13:32:54.496: ERROR/System(58): at android.os.ServiceManagerProxy.addService(ServiceManagerNative.java:146)
07-26 13:32:54.496: ERROR/System(58): at android.os.ServiceManager.addService(ServiceManager.java:72)
07-26 13:32:54.496: ERROR/System(58): at com.android.server.ServerThread.run(SystemServer.java:184)
07-26 13:32:55.756: ERROR/SoundPool(58): error loading /system/media/audio/ui/Effect_Tick.ogg
07-26 13:32:55.765: ERROR/SoundPool(58): error loading /system/media/audio/ui/KeypressStandard.ogg
07-26 13:32:55.775: ERROR/SoundPool(58): error loading /system/media/audio/ui/KeypressSpacebar.ogg
07-26 13:32:55.795: ERROR/SoundPool(58): error loading /system/media/audio/ui/KeypressDelete.ogg
07-26 13:32:55.804: ERROR/SoundPool(58): error loading /system/media/audio/ui/KeypressReturn.ogg
07-26 13:32:59.184: ERROR/ThrottleService(58): Could not open GPS configuration file /etc/gps.conf
07-26 13:33:00.706: ERROR/logwrapper(148): executing /system/bin/tc failed: No such file or directory
07-26 13:33:00.764: ERROR/logwrapper(149): executing /system/bin/tc failed: No such file or directory
07-26 13:33:00.815: ERROR/logwrapper(150): executing /system/bin/tc failed: No such file or directory
07-26 13:33:12.188: ERROR/HierarchicalStateMachine(58): TetherMaster - unhandledMessage: msg.what=3
07-26 13:34:04.617: ERROR/AndroidRuntime(276): FATAL EXCEPTION: main
07-26 13:34:04.617: ERROR/AndroidRuntime(276): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.dataApplication/com.dataApplication.Edit}: java.lang.RuntimeException: Your content must have a ListView whose id attribute is 'android.R.id.list'
07-26 13:34:04.617: ERROR/AndroidRuntime(276): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
07-26 13:34:04.617: ERROR/AndroidRuntime(276): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
07-26 13:34:04.617: ERROR/AndroidRuntime(276): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
07-26 13:34:04.617: ERROR/AndroidRuntime(276): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
07-26 13:34:04.617: ERROR/AndroidRuntime(276): at android.os.Handler.dispatchMessage(Handler.java:99)
07-26 13:34:04.617: ERROR/AndroidRuntime(276): at android.os.Looper.loop(Looper.java:123)
07-26 13:34:04.617: ERROR/AndroidRuntime(276): at android.app.ActivityThread.main(ActivityThread.java:4627)
07-26 13:34:04.617: ERROR/AndroidRuntime(276): at java.lang.reflect.Method.invokeNative(Native Method)
07-26 13:34:04.617: ERROR/AndroidRuntime(276): at java.lang.reflect.Method.invoke(Method.java:521)
07-26 13:34:04.617: ERROR/AndroidRuntime(276): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
07-26 13:34:04.617: ERROR/AndroidRuntime(276): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
07-26 13:34:04.617: ERROR/AndroidRuntime(276): at dalvik.system.NativeStart.main(Native Method)
07-26 13:34:04.617: ERROR/AndroidRuntime(276): Caused by: java.lang.RuntimeException: Your content must have a ListView whose id attribute is 'android.R.id.list'
07-26 13:34:04.617: ERROR/AndroidRuntime(276): at android.app.ListActivity.onContentChanged(ListActivity.java:245)
07-26 13:34:04.617: ERROR/AndroidRuntime(276): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:201)
07-26 13:34:04.617: ERROR/AndroidRuntime(276): at android.app.Activity.setContentView(Activity.java:1647)
07-26 13:34:04.617: ERROR/AndroidRuntime(276): at com.dataApplication.Edit.onCreate(Edit.java:32)
07-26 13:34:04.617: ERROR/AndroidRuntime(276): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
07-26 13:34:04.617: ERROR/AndroidRuntime(276): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
07-26 13:34:04.617: ERROR/AndroidRuntime(276): ... 11 more
java.lang.RuntimeException:
Your content must have a ListView whose id attribute is 'android.R.id.list'
Make sure your view file has a ListView element, with android:id="#android:id/list".
This is how the ListActivity knows where to display the data you're adding.
From http://developer.android.com/reference/android/app/ListActivity.html
ListActivity has a default layout that consists of a single, full-screen list in the center of the screen. However, if you desire, you can customize the screen layout by setting your own view layout with setContentView() in onCreate(). To do this, your own view MUST contain a ListView object with the id "#android:id/list" (or list if it's in code)
Check if you have "#android:id/list" in your xml ?

Categories

Resources