次のコードを使用して、画像ビュー内にビットマップ画像を表示しようとしています:
ImageView imageView = (ImageView) findViewById(R.id.item_picture);
byte[] decodedString = Base64.decode(temp, Base64.DEFAULT);
Bitmap decodedByte = BitmapFactory.decodeByteArray(decodedString, 0, decodedString.length);
imageView.setImageBitmap(decodedByte);
ただし、最後の行でクラッシュし続け、その理由はわかりません。
ログキャットは次のとおりです。
09-08 09:29:01.626: E/SoundPool(275): error loading /system/media/audio/ui/Effect_Tick.ogg
09-08 09:29:01.636: E/SoundPool(275): error loading /system/media/audio/ui/Effect_Tick.ogg
09-08 09:29:01.636: E/SoundPool(275): error loading /system/media/audio/ui/Effect_Tick.ogg
09-08 09:29:01.636: E/SoundPool(275): error loading /system/media/audio/ui/Effect_Tick.ogg
09-08 09:29:01.636: E/SoundPool(275): error loading /system/media/audio/ui/Effect_Tick.ogg
09-08 09:29:01.636: E/SoundPool(275): error loading /system/media/audio/ui/KeypressStandard.ogg
09-08 09:29:01.636: E/SoundPool(275): error loading /system/media/audio/ui/KeypressSpacebar.ogg
09-08 09:29:01.646: E/SoundPool(275): error loading /system/media/audio/ui/KeypressDelete.ogg
09-08 09:29:01.646: E/SoundPool(275): error loading /system/media/audio/ui/KeypressReturn.ogg
09-08 09:29:03.549: E/SoundPool(275): error loading /system/media/audio/ui/Effect_Tick.ogg
09-08 09:29:03.556: E/SoundPool(275): error loading /system/media/audio/ui/Effect_Tick.ogg
09-08 09:29:03.556: E/SoundPool(275): error loading /system/media/audio/ui/Effect_Tick.ogg
09-08 09:29:03.556: E/SoundPool(275): error loading /system/media/audio/ui/Effect_Tick.ogg
09-08 09:29:03.556: E/SoundPool(275): error loading /system/media/audio/ui/Effect_Tick.ogg
09-08 09:29:03.556: E/SoundPool(275): error loading /system/media/audio/ui/KeypressStandard.ogg
09-08 09:29:03.556: E/SoundPool(275): error loading /system/media/audio/ui/KeypressSpacebar.ogg
09-08 09:29:03.566: E/SoundPool(275): error loading /system/media/audio/ui/KeypressDelete.ogg
09-08 09:29:03.566: E/SoundPool(275): error loading /system/media/audio/ui/KeypressReturn.ogg
09-08 09:29:08.727: E/AndroidRuntime(7288): FATAL EXCEPTION: main
09-08 09:29:08.727: E/AndroidRuntime(7288): java.lang.NullPointerException
09-08 09:29:08.727: E/AndroidRuntime(7288): at com.myCompany.myApp.SearchActivity$MyListAdapter.getView(SearchActivity.java:139)
09-08 09:29:08.727: E/AndroidRuntime(7288): at android.widget.AbsListView.obtainView(AbsListView.java:2177)
09-08 09:29:08.727: E/AndroidRuntime(7288): at android.widget.ListView.measureHeightOfChildren(ListView.java:1247)
09-08 09:29:08.727: E/AndroidRuntime(7288): at android.widget.ListView.onMeasure(ListView.java:1159)
09-08 09:29:08.727: E/AndroidRuntime(7288): at android.view.View.measure(View.java:15848)
09-08 09:29:08.727: E/AndroidRuntime(7288): at android.widget.RelativeLayout.measureChild(RelativeLayout.java:698)
09-08 09:29:08.727: E/AndroidRuntime(7288): at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:494)
09-08 09:29:08.727: E/AndroidRuntime(7288): at android.view.View.measure(View.java:15848)
09-08 09:29:08.727: E/AndroidRuntime(7288): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5008)
09-08 09:29:08.727: E/AndroidRuntime(7288): at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
09-08 09:29:08.727: E/AndroidRuntime(7288): at android.view.View.measure(View.java:15848)
09-08 09:29:08.727: E/AndroidRuntime(7288): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5008)
09-08 09:29:08.727: E/AndroidRuntime(7288): at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1404)
09-08 09:29:08.727: E/AndroidRuntime(7288): at android.widget.LinearLayout.measureVertical(LinearLayout.java:695)
09-08 09:29:08.727: E/AndroidRuntime(7288): at android.widget.LinearLayout.onMeasure(LinearLayout.java:588)
09-08 09:29:08.727: E/AndroidRuntime(7288): at android.view.View.measure(View.java:15848)
09-08 09:29:08.727: E/AndroidRuntime(7288): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5008)
09-08 09:29:08.727: E/AndroidRuntime(7288): at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
09-08 09:29:08.727: E/AndroidRuntime(7288): at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2189)
09-08 09:29:08.727: E/AndroidRuntime(7288): at android.view.View.measure(View.java:15848)
09-08 09:29:08.727: E/AndroidRuntime(7288): at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:1905)
09-08 09:29:08.727: E/AndroidRuntime(7288): at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1104)
09-08 09:29:08.727: E/AndroidRuntime(7288): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1284)
09-08 09:29:08.727: E/AndroidRuntime(7288): at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1004)
09-08 09:29:08.727: E/AndroidRuntime(7288): at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5481)
09-08 09:29:08.727: E/AndroidRuntime(7288): at android.view.Choreographer$CallbackRecord.run(Choreographer.java:749)
09-08 09:29:08.727: E/AndroidRuntime(7288): at android.view.Choreographer.doCallbacks(Choreographer.java:562)
09-08 09:29:08.727: E/AndroidRuntime(7288): at android.view.Choreographer.doFrame(Choreographer.java:532)
09-08 09:29:08.727: E/AndroidRuntime(7288): at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:735)
09-08 09:29:08.727: E/AndroidRuntime(7288): at android.os.Handler.handleCallback(Handler.java:730)
09-08 09:29:08.727: E/AndroidRuntime(7288): at android.os.Handler.dispatchMessage(Handler.java:92)
09-08 09:29:08.727: E/AndroidRuntime(7288): at android.os.Looper.loop(Looper.java:137)
09-08 09:29:08.727: E/AndroidRuntime(7288): at android.app.ActivityThread.main(ActivityThread.java:5103)
09-08 09:29:08.727: E/AndroidRuntime(7288): at java.lang.reflect.Method.invokeNative(Native Method)
09-08 09:29:08.727: E/AndroidRuntime(7288): at java.lang.reflect.Method.invoke(Method.java:525)
09-08 09:29:08.727: E/AndroidRuntime(7288): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
09-08 09:29:08.727: E/AndroidRuntime(7288): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
09-08 09:29:08.727: E/AndroidRuntime(7288): at dalvik.system.NativeStart.main(Native Method)
09-08 09:29:11.216: E/SoundPool(275): error loading /system/media/audio/ui/Effect_Tick.ogg
09-08 09:29:11.226: E/SoundPool(275): error loading /system/media/audio/ui/Effect_Tick.ogg
09-08 09:29:11.226: E/SoundPool(275): error loading /system/media/audio/ui/Effect_Tick.ogg
09-08 09:29:11.226: E/SoundPool(275): error loading /system/media/audio/ui/Effect_Tick.ogg
09-08 09:29:11.236: E/SoundPool(275): error loading /system/media/audio/ui/Effect_Tick.ogg
09-08 09:29:11.236: E/SoundPool(275): error loading /system/media/audio/ui/KeypressStandard.ogg
09-08 09:29:11.236: E/SoundPool(275): error loading /system/media/audio/ui/KeypressSpacebar.ogg
09-08 09:29:11.236: E/SoundPool(275): error loading /system/media/audio/ui/KeypressDelete.ogg
09-08 09:29:11.246: E/SoundPool(275): error loading /system/media/audio/ui/KeypressReturn.ogg
getView コードは次のとおりです。
@Override
public View getView(int position, View convertView, ViewGroup parent)
{
//make sure we have a view to work with (may have been given null)
View itemView = convertView;
if(itemView == null)
{
itemView = getLayoutInflater().inflate(R.layout.list_item, parent, false);
}
//Find the user to work with
Users currentUser = myUsers.get(position);
//Fill the view
TextView text;
text = (TextView) itemView.findViewById(R.id.item_name);
text.setText(currentUser.getName());
text = (TextView) itemView.findViewById(R.id.item_location);
text.setText(currentUser.getLocation());
String temp = currentUser.getPicture();
if(!temp.equals("noPicture"))
{
ImageView imageView = (ImageView) findViewById(R.id.item_picture);
byte[] decodedString = Base64.decode(temp, Base64.DEFAULT);
Bitmap decodedByte = BitmapFactory.decodeByteArray(decodedString, 0, decodedString.length);
imageView.setImageBitmap(decodedByte);
}
return itemView;
}
誰かがクラッシュする理由を見ることができますか??