I have 2 Fragments linked in a MainActivity. The second Fragment has a ColorPicker Wheel with a Saturationbar and sends the rgb value of the ColorPicker to the Main Activity. Without sending the rgb value to the MainActivity the log cat just Show this warning:
W/ResourceType: Skipping entry 0x1050089 in package table 0 because it is not complex!
W/ResourceType: Skipping entry 0x1050089 in package table 0 because it is not complex!
W/ResourceType: Skipping entry 0x1050089 in package table 0 because it is not complex!
D/dalvikvm: GC_FOR_ALLOC freed 1399K, 10% free 30330K/33479K, paused 19ms, total 21ms
D/dalvikvm: GC_FOR_ALLOC freed 135K, 10% free 30465K/33479K, paused 20ms, total 20ms
I/dalvikvm-heap: Grow heap (frag case) to 32.381MB for 1441296-byte allocation
D/dalvikvm: GC_FOR_ALLOC freed <1K, 9% free 31873K/34887K, paused 34ms, total 34ms
D/dalvikvm: GC_FOR_ALLOC freed <1K, 9% free 31873K/34887K, paused 19ms, total 19ms
I/dalvikvm-heap: Grow heap (frag case) to 35.476MB for 3244816-byte allocation
D/dalvikvm: GC_CONCURRENT freed 0K, 8% free 35041K/38087K, paused 2ms+2ms, total 26ms
D/dalvikvm: GC_FOR_ALLOC freed 1471K, 9% free 34803K/38087K, paused 17ms, total 17ms
I/dalvikvm-heap: Grow heap (frag case) to 37.493MB for 2359312-byte allocation
D/dalvikvm: GC_CONCURRENT freed <1K, 9% free 37107K/40455K, paused 2ms+21ms, total 46ms
W/ResourceType: Skipping entry 0x1050089 in package table 0 because it is not complex!
W/ResourceType: Skipping entry 0x1050089 in package table 0 because it is not complex!
I already tried to find 0x01050089 in the R.java file, without result.
If I attach the intent Code into my Fragment class to send the rgb value to the MainActivity, I get the following error in the logcat and my application crashes after I select the 2 Fragment.
E/dalvikvm-heap: Out of memory on a 3244816-byte allocation.
I/dalvikvm: "main" prio=5 tid=1 RUNNABLE
I/dalvikvm: | group="main" sCount=0 dsCount=0 obj=0x41063508 self=0x40e5ab08
I/dalvikvm: | sysTid=6777 nice=0 sched=0/0 cgrp=apps handle=1074536240
I/dalvikvm: | schedstat=( 2552959394 1319248728 5243 ) utm=210 stm=44 core=1
I/dalvikvm: at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
I/dalvikvm: at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:625)
I/dalvikvm: at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:478)
I/dalvikvm: at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:781)
I/dalvikvm: at android.content.res.Resources.loadDrawable(Resources.java:1963)
I/dalvikvm: at android.content.res.Resources.getDrawable(Resources.java:672)
I/dalvikvm: at android.support.v7.widget.TintResources.superGetDrawable(TintResources.java:48)
I/dalvikvm: at android.support.v7.widget.AppCompatDrawableManager.onDrawableLoadedFromResources(AppCompatDrawableManager.java:374)
I/dalvikvm: at android.support.v7.widget.TintResources.getDrawable(TintResources.java:44)
I/dalvikvm: at android.support.v4.content.ContextCompat.getDrawable(ContextCompat.java:323)
I/dalvikvm: at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:180)
I/dalvikvm: at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:173)
I/dalvikvm: at android.support.v7.view.menu.MenuItemImpl.getIcon(MenuItemImpl.java:421)
I/dalvikvm: at android.support.design.internal.NavigationMenuPresenter$NavigationMenuAdapter.prepareMenuItems(NavigationMenuPresenter.java:505)
I/dalvikvm: at android.support.design.internal.NavigationMenuPresenter$NavigationMenuAdapter.update(NavigationMenuPresenter.java:436)
I/dalvikvm: at android.support.design.internal.NavigationMenuPresenter.updateMenuView(NavigationMenuPresenter.java:112)
I/dalvikvm: at android.support.design.widget.NavigationView.inflateMenu(NavigationView.java:241)
I/dalvikvm: at android.support.design.widget.NavigationView.<init>(NavigationView.java:169)
I/dalvikvm: at android.support.design.widget.NavigationView.<init>(NavigationView.java:95)
I/dalvikvm: at java.lang.reflect.Constructor.constructNative(Native Method)
I/dalvikvm: at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
I/dalvikvm: at android.view.LayoutInflater.createView(LayoutInflater.java:587)
I/dalvikvm: at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:687)
I/dalvikvm: at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
I/dalvikvm: at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
I/dalvikvm: at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
I/dalvikvm: at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
I/dalvikvm: at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:267)
I/dalvikvm: at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:129)
I/dalvikvm: at com.example.christian.rapid_charge_quad_05.MainActivity.onCreate(MainActivity.java:63)
I/dalvikvm: at android.app.Activity.performCreate(Activity.java:5206)
I/dalvikvm: at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
I/dalvikvm: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2074)
I/dalvikvm: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2135)
I/dalvikvm: at android.app.ActivityThread.access$700(ActivityThread.java:140)
I/dalvikvm: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1237)
I/dalvikvm: at android.os.Handler.dispatchMessage(Handler.java:99)
I/dalvikvm: at android.os.Looper.loop(Looper.java:137)
I/dalvikvm: at android.app.ActivityThread.main(ActivityThread.java:4921)
I/dalvikvm: at java.lang.reflect.Method.invokeNative(Native Method)
I/dalvikvm: at java.lang.reflect.Method.invoke(Method.java:511)
I/dalvikvm: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1027)
I/dalvikvm: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:794)
I/dalvikvm: at dalvik.system.NativeStart.main(Native Method)
A/libc: Fatal signal 11 (SIGSEGV) at 0x000006a0 (code=1), thread 6777 (_charge_quad_05)
Fragment 2 with the ColorPicker:
#Nullable
#Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View rootview = inflater.inflate(R.layout.fragment_beleuchtung, container, false);
return rootview;
}
#Override
public void onActivityCreated(#Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
ColorPicker colorPicker = (ColorPicker)getActivity().findViewById(R.id.color_picker);
ValueBar valueBar = (ValueBar)getActivity().findViewById(R.id.valuebar);
colorPicker.addValueBar(valueBar);
colorPicker.getColor();
colorPicker.setOldCenterColor(colorPicker.getColor());
colorPicker.setOnColorChangedListener(this);
colorPicker.setShowOldCenterColor(false);
}
#Override
public void onColorChanged(final int color) {
final int c;
final String[] colorrgb = new String[3];
final TextView text = (TextView)getActivity().findViewById(R.id.Rot);
final TextView text2 = (TextView)getActivity().findViewById(R.id.Grün);
final TextView text3 = (TextView)getActivity().findViewById(R.id.Blau);
c = color;
new Handler().postDelayed(new Runnable() {
#Override
public void run() {
// text.setTextColor(Color.rgb(Color.red(c), Color.green(c), Color.blue(c)));
// text.setText("Rot" + Color.red(c)+",Blau"+Color.blue(c)+",Grün"+Color.green(c));
text.setText(""+Color.red(c));
text2.setText(""+Color.green(c));
text3.setText(""+Color.blue(c));
colorrgb[0] = String.valueOf(Color.red(c));
colorrgb[1] = String.valueOf(Color.blue(c));
colorrgb[2] = String.valueOf(Color.green(c));
}
},2000);
Intent intent = new Intent(getActivity().getBaseContext(), MainActivity.class);
intent.putExtra("color",colorrgb);
getActivity().startActivity(intent);
}
}
MainActivity part where I recieve the Color value:
Intent intent = getIntent();
if(intent.getStringExtra("color") != null) {
String[] color = intent.getStringArrayExtra("color");
}
To community with activity from Fragment, you should use callback. It's recommended on Android Developer
Ok. Just do something as below:
1) create an Interface
public interface OnColorChangeListener {
void onColorChangeListener(int[] colors);
}
2) In YourActivity class which will be the host of your Fragment:
public class YourActivity extends Activity implement OnColorChangeListener {
int[] colors;
public void onColorChangeListener(int[] colors) {
//copy array colors to this.colors and do anything with new color.
}
}
3) In your Fragment:
public class FragmentA extends Fragment {
OnColorChangeListener mListener;
#Override
public void onAttach(Activity activity) {
super.onAttach(activity);
try {
mListener = (OnColorChangeListener) activity;
} catch (ClassCastException e) {
throw new ClassCastException(activity.toString() + " must implement OnColorChangeListener");
}
}
#Override
public void onColorChanged(final int color) {
// i copy your code to demonstrate.
new Handler().postDelayed(new Runnable() {
#Override
public void run() {
// text.setTextColor(Color.rgb(Color.red(c), Color.green(c), Color.blue(c)));
// text.setText("Rot" + Color.red(c)+",Blau"+Color.blue(c)+",Grün"+Color.green(c));
text.setText(""+Color.red(c));
text2.setText(""+Color.green(c));
text3.setText(""+Color.blue(c));
colorrgb[0] = String.valueOf(Color.red(c));
colorrgb[1] = String.valueOf(Color.blue(c));
colorrgb[2] = String.valueOf(Color.green(c));
mListener.onColorChangeListener(colorrgb);
}
},2000);
}
}
Related
i'm create recycler view to display data, after that I want to pass
position of the data to the another activity, but when I use the loge for check if position is pass or not I can't found the position in logcat.
In MainActivity I add static list for Recipe model and I create method to return this list:
public class MainActivity extends AppCompatActivity {
private RecyclerView recyclerView;
private ProgressBar progressBar;
private LinearLayoutManager mLayoutManager;
private ArrayList<Model> list;
private RecyclerViewAdapter adapter;
private static List<Recipe>mListrecipe;
String url = "https://d17h27t6h515a5.cloudfront.net/";
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
recyclerView = (RecyclerView) findViewById(R.id.recycler_view);
progressBar = (ProgressBar) findViewById(R.id.progressbar);
mLayoutManager = new LinearLayoutManager(MainActivity.this, LinearLayoutManager.VERTICAL, false);
recyclerView.setLayoutManager(mLayoutManager);
/// create a list--
list = new ArrayList<>();
/// get the list from json file
getRetrofitArray();
adapter = new RecyclerViewAdapter( list, MainActivity.this);
// set adapter to recyclerview
recyclerView.setAdapter(adapter);
}
public void getRetrofitArray(){
Retrofit retrofit = new Retrofit.Builder()
.baseUrl(url)
.addConverterFactory(GsonConverterFactory.create())
.build();
RetrofitArrayAPI service = retrofit.create(RetrofitArrayAPI.class);
Call<List<Recipe>> call = service.getRecipeDetails();
call.enqueue(new Callback<List<Recipe>>() {
#Override
public void onResponse(Call<List<Recipe>> call, Response<List<Recipe>> response) {
Log.e("main ", " retrofit response "+ response.body().toString());
mListrecipe=response.body();
for (int i=0; i<response.body().size();i++){
Log.e("main ", " name "+ response.body().get(i).getName() + " serving "+
response.body().get(i).getServings());
list.add( new Model( Model.IMAGE_TYPE,response.body(), response.body().get(i).getName() ,
" Serving " +response.body().get(i).getServings() ) );
}
adapter.notifyDataSetChanged();
}
#Override
public void onFailure(Call<List<Recipe>> call, Throwable t) {
Log.e("main ", " retrofit error "+ t.toString());
}
});
}
public static List<Recipe>getList(){
return mListrecipe;
}
}
I add putExtra with key value to pass position
public class RecyclerViewAdapter extends RecyclerView.Adapter {
private ArrayList<Model> dataset;
private Context mContext;
public RecyclerViewAdapter(ArrayList<Model> mlist, Context context) {
this.dataset = mlist;
this.mContext = context;
}
public static class ImageTypeViewHolder extends RecyclerView.ViewHolder{
ImageView imageView;
TextView title, subtitle;
public ImageTypeViewHolder(View itemView) {
super(itemView);
this.title = (TextView) itemView.findViewById(R.id.title);
this.subtitle = (TextView) itemView.findViewById(R.id.subtitle);
this.imageView=(ImageView)itemView.findViewById(R.id.imageview);
}
}
#Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = LayoutInflater.from( parent.getContext()).inflate(R.layout.itemlist, parent, false);
return new ImageTypeViewHolder(view) ;
}
#Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, final int position) {
Model object = dataset.get(position);
( (ImageTypeViewHolder) holder).title.setText( object.title );
( (ImageTypeViewHolder) holder).subtitle.setText( object.subtitle );
/// dataset.get(position)
( (ImageTypeViewHolder) holder).title.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
Intent intent=new Intent(mContext,SelectReceipe.class);
intent.putExtra("itempostion",position);
mContext.startActivity(intent);
}
});
( (ImageTypeViewHolder) holder).subtitle.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
Intent intent=new Intent(mContext,SelectReceipe.class);
intent.putExtra("itempostion",position);
mContext.startActivity(intent);
}
});
( (ImageTypeViewHolder) holder).imageView.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
Intent intent=new Intent(mContext,SelectReceipe.class);
intent.putExtra("itempostion",position);
mContext.startActivity(intent);
}
});
}
#Override
public int getItemCount() {
return dataset.size() ;
}
}
this is 2 activity I pass position but i can't find value in logcat
public class SelectReceipe extends AppCompatActivity {
List<Recipe>sListRecipe;
public int itempostion;
private String TAG;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.selectreceipe);
sListRecipe=MainActivity.getList();
Intent i =getIntent();
itempostion= i.getExtras().getInt("itempostion");
Log.e(TAG,"itempostion"+String.valueOf(itempostion)+"valou"+sListRecipe.get(itempostion).getName().toString());
}
logcat:
09-26 13:34:41.355 31852-31852/? D/dalvikvm: Late-enabling CheckJNI
09-26 13:34:42.459 31852-31852/blueappsoftware.mybakingtips I/dalvikvm: Could not find method android.view.Window$Callback.onProvideKeyboardShortcuts, referenced from method android.support.v7.view.WindowCallbackWrapper.onProvideKeyboardShortcuts
09-26 13:34:42.471 31852-31852/blueappsoftware.mybakingtips W/dalvikvm: VFY: unable to resolve interface method 20343: Landroid/view/Window$Callback;.onProvideKeyboardShortcuts (Ljava/util/List;Landroid/view/Menu;I)V
09-26 13:34:42.471 31852-31852/blueappsoftware.mybakingtips D/dalvikvm: VFY: replacing opcode 0x72 at 0x0002
09-26 13:34:42.479 31852-31852/blueappsoftware.mybakingtips W/dalvikvm: VFY: unable to find class referenced in signature (Landroid/view/SearchEvent;)
09-26 13:34:42.479 31852-31852/blueappsoftware.mybakingtips I/dalvikvm: Could not find method android.view.Window$Callback.onSearchRequested, referenced from method android.support.v7.view.WindowCallbackWrapper.onSearchRequested
09-26 13:34:42.479 31852-31852/blueappsoftware.mybakingtips W/dalvikvm: VFY: unable to resolve interface method 20345: Landroid/view/Window$Callback;.onSearchRequested (Landroid/view/SearchEvent;)Z
09-26 13:34:42.479 31852-31852/blueappsoftware.mybakingtips D/dalvikvm: VFY: replacing opcode 0x72 at 0x0002
09-26 13:34:42.479 31852-31852/blueappsoftware.mybakingtips I/dalvikvm: Could not find method android.view.Window$Callback.onWindowStartingActionMode, referenced from method android.support.v7.view.WindowCallbackWrapper.onWindowStartingActionMode
09-26 13:34:42.479 31852-31852/blueappsoftware.mybakingtips W/dalvikvm: VFY: unable to resolve interface method 20349: Landroid/view/Window$Callback;.onWindowStartingActionMode (Landroid/view/ActionMode$Callback;I)Landroid/view/ActionMode;
09-26 13:34:42.479 31852-31852/blueappsoftware.mybakingtips D/dalvikvm: VFY: replacing opcode 0x72 at 0x0002
09-26 13:34:42.483 31852-31852/blueappsoftware.mybakingtips I/dalvikvm: Could not find method android.content.res.TypedArray.getChangingConfigurations, referenced from method android.support.v7.widget.TintTypedArray.getChangingConfigurations
09-26 13:34:42.495 31852-31852/blueappsoftware.mybakingtips W/dalvikvm: VFY: unable to resolve virtual method 478: Landroid/content/res/TypedArray;.getChangingConfigurations ()I
09-26 13:34:42.495 31852-31852/blueappsoftware.mybakingtips D/dalvikvm: VFY: replacing opcode 0x6e at 0x0002
09-26 13:34:42.495 31852-31852/blueappsoftware.mybakingtips I/dalvikvm: Could not find method android.content.res.TypedArray.getType, referenced from method android.support.v7.widget.TintTypedArray.getType
09-26 13:34:42.495 31852-31852/blueappsoftware.mybakingtips W/dalvikvm: VFY: unable to resolve virtual method 500: Landroid/content/res/TypedArray;.getType (I)I
09-26 13:34:42.495 31852-31852/blueappsoftware.mybakingtips D/dalvikvm: VFY: replacing opcode 0x6e at 0x0008
09-26 13:34:42.695 31852-31852/blueappsoftware.mybakingtips I/dalvikvm: Could not find method android.widget.FrameLayout.startActionModeForChild, referenced from method android.support.v7.widget.ActionBarContainer.startActionModeForChild
09-26 13:34:42.695 31852-31852/blueappsoftware.mybakingtips W/dalvikvm: VFY: unable to resolve virtual method 20822: Landroid/widget/FrameLayout;.startActionModeForChild (Landroid/view/View;Landroid/view/ActionMode$Callback;I)Landroid/view/ActionMode;
09-26 13:34:42.699 31852-31852/blueappsoftware.mybakingtips D/dalvikvm: VFY: replacing opcode 0x6f at 0x0002
09-26 13:34:42.735 31852-31852/blueappsoftware.mybakingtips I/dalvikvm: Could not find method android.view.ViewGroup.onRtlPropertiesChanged, referenced from method android.support.v7.widget.Toolbar.onRtlPropertiesChanged
09-26 13:34:42.735 31852-31852/blueappsoftware.mybakingtips W/dalvikvm: VFY: unable to resolve virtual method 20233: Landroid/view/ViewGroup;.onRtlPropertiesChanged (I)V
09-26 13:34:42.735 31852-31852/blueappsoftware.mybakingtips D/dalvikvm: VFY: replacing opcode 0x6f at 0x0007
09-26 13:34:42.739 31852-31852/blueappsoftware.mybakingtips I/dalvikvm: Could not find method android.content.Context.getColorStateList, referenced from method android.support.v7.content.res.AppCompatResources.getColorStateList
09-26 13:34:42.743 31852-31852/blueappsoftware.mybakingtips W/dalvikvm: VFY: unable to resolve virtual method 292: Landroid/content/Context;.getColorStateList (I)Landroid/content/res/ColorStateList;
09-26 13:34:42.743 31852-31852/blueappsoftware.mybakingtips D/dalvikvm: VFY: replacing opcode 0x6e at 0x0006
09-26 13:34:42.763 31852-31852/blueappsoftware.mybakingtips I/dalvikvm: Could not find method android.content.res.Resources.getDrawable, referenced from method android.support.v7.widget.ResourcesWrapper.getDrawable
09-26 13:34:42.763 31852-31852/blueappsoftware.mybakingtips W/dalvikvm: VFY: unable to resolve virtual method 441: Landroid/content/res/Resources;.getDrawable (ILandroid/content/res/Resources$Theme;)Landroid/graphics/drawable/Drawable;
09-26 13:34:42.763 31852-31852/blueappsoftware.mybakingtips D/dalvikvm: VFY: replacing opcode 0x6e at 0x0002
09-26 13:34:42.763 31852-31852/blueappsoftware.mybakingtips I/dalvikvm: Could not find method android.content.res.Resources.getDrawableForDensity, referenced from method android.support.v7.widget.ResourcesWrapper.getDrawableForDensity
09-26 13:34:42.767 31852-31852/blueappsoftware.mybakingtips W/dalvikvm: VFY: unable to resolve virtual method 443: Landroid/content/res/Resources;.getDrawableForDensity (IILandroid/content/res/Resources$Theme;)Landroid/graphics/drawable/Drawable;
09-26 13:34:42.767 31852-31852/blueappsoftware.mybakingtips D/dalvikvm: VFY: replacing opcode 0x6e at 0x0002
09-26 13:34:42.771 31852-31852/blueappsoftware.mybakingtips E/dalvikvm: Could not find class 'android.graphics.drawable.RippleDrawable', referenced from method android.support.v7.widget.AppCompatImageHelper.hasOverlappingRendering
09-26 13:34:42.771 31852-31852/blueappsoftware.mybakingtips W/dalvikvm: VFY: unable to resolve instanceof 142 (Landroid/graphics/drawable/RippleDrawable;) in Landroid/support/v7/widget/AppCompatImageHelper;
09-26 13:34:42.771 31852-31852/blueappsoftware.mybakingtips D/dalvikvm: VFY: replacing opcode 0x20 at 0x000c
09-26 13:34:42.815 31852-31853/blueappsoftware.mybakingtips D/dalvikvm: GC_CONCURRENT freed 256K, 3% free 10939K/11271K, paused 18ms+1ms, total 27ms
09-26 13:34:42.815 31852-31852/blueappsoftware.mybakingtips D/dalvikvm: WAIT_FOR_CONCURRENT_GC blocked 4ms
09-26 13:34:42.911 31852-31852/blueappsoftware.mybakingtips D/libEGL: loaded /system/lib/egl/libEGL_genymotion.so
[ 09-26 13:34:42.931 31852:31852 D/ ]
HostConnection::get() New Host Connection established 0xb7f81e90, tid 31852
09-26 13:34:43.019 31852-31852/blueappsoftware.mybakingtips D/libEGL: loaded /system/lib/egl/libGLESv1_CM_genymotion.so
09-26 13:34:43.035 31852-31852/blueappsoftware.mybakingtips D/libEGL: loaded /system/lib/egl/libGLESv2_genymotion.so
09-26 13:34:43.111 31852-31852/blueappsoftware.mybakingtips W/EGL_genymotion: eglSurfaceAttrib not implemented
09-26 13:34:43.127 31852-31852/blueappsoftware.mybakingtips D/OpenGLRenderer: Enabling debug mode 0
09-26 13:34:43.183 31852-31852/blueappsoftware.mybakingtips D/OpenGLRenderer: TextureCache::get: create texture(0xb7fa1438): name, size, mSize = 1, 4096, 4096
09-26 13:34:43.339 31852-31877/blueappsoftware.mybakingtips W/dalvikvm: VFY: unable to find class referenced in signature (Ljava/nio/file/Path;)
09-26 13:34:43.343 31852-31877/blueappsoftware.mybakingtips W/dalvikvm: VFY: unable to find class referenced in signature ([Ljava/nio/file/OpenOption;)
09-26 13:34:43.343 31852-31877/blueappsoftware.mybakingtips I/dalvikvm: Could not find method java.nio.file.Files.newOutputStream, referenced from method okio.Okio.sink
09-26 13:34:43.343 31852-31877/blueappsoftware.mybakingtips W/dalvikvm: VFY: unable to resolve static method 22787: Ljava/nio/file/Files;.newOutputStream (Ljava/nio/file/Path;[Ljava/nio/file/OpenOption;)Ljava/io/OutputStream;
09-26 13:34:43.343 31852-31877/blueappsoftware.mybakingtips D/dalvikvm: VFY: replacing opcode 0x71 at 0x000a
09-26 13:34:43.343 31852-31877/blueappsoftware.mybakingtips W/dalvikvm: VFY: unable to find class referenced in signature (Ljava/nio/file/Path;)
09-26 13:34:43.343 31852-31877/blueappsoftware.mybakingtips W/dalvikvm: VFY: unable to find class referenced in signature ([Ljava/nio/file/OpenOption;)
09-26 13:34:43.343 31852-31877/blueappsoftware.mybakingtips I/dalvikvm: Could not find method java.nio.file.Files.newInputStream, referenced from method okio.Okio.source
09-26 13:34:43.343 31852-31877/blueappsoftware.mybakingtips W/dalvikvm: VFY: unable to resolve static method 22786: Ljava/nio/file/Files;.newInputStream (Ljava/nio/file/Path;[Ljava/nio/file/OpenOption;)Ljava/io/InputStream;
09-26 13:34:43.343 31852-31877/blueappsoftware.mybakingtips D/dalvikvm: VFY: replacing opcode 0x71 at 0x000a
09-26 13:34:43.567 31852-31853/blueappsoftware.mybakingtips D/dalvikvm: GC_CONCURRENT freed 279K, 4% free 11121K/11527K, paused 24ms+10ms, total 38ms
09-26 13:34:44.079 31852-31852/blueappsoftware.mybakingtips E/main: retrofit response [blueappsoftware.mybakingtips.Recipe#536b4c20, blueappsoftware.mybakingtips.Recipe#536c68ec, blueappsoftware.mybakingtips.Recipe#536c1a24, blueappsoftware.mybakingtips.Recipe#536e27b8]
09-26 13:34:44.079 31852-31852/blueappsoftware.mybakingtips E/main: name Nutella Pie serving 8
09-26 13:34:44.079 31852-31852/blueappsoftware.mybakingtips E/main: name Brownies serving 8
09-26 13:34:44.079 31852-31852/blueappsoftware.mybakingtips E/main: name Yellow Cake serving 8
09-26 13:34:44.079 31852-31852/blueappsoftware.mybakingtips E/main: name Cheesecake serving 8
09-26 13:34:44.119 31852-31853/blueappsoftware.mybakingtips D/dalvikvm: GC_CONCURRENT freed 217K, 4% free 11298K/11655K, paused 15ms+0ms, total 20ms
09-26 13:34:44.179 31852-31852/blueappsoftware.mybakingtips D/OpenGLRenderer: TextureCache::get: create texture(0xb7f36950): name, size, mSize = 9, 33856, 37952
09-26 13:34:48.955 31852-31852/blueappsoftware.mybakingtips W/EGL_genymotion: eglSurfaceAttrib not implemented
09-26 13:34:48.955 31852-31852/blueappsoftware.mybakingtips E/RecyclerView: No adapter attached; skipping layout
09-26 13:34:48.967 31852-31852/blueappsoftware.mybakingtips E/RecyclerView: No adapter attached; skipping layout
09-26 13:52:03.367 31852-31853/blueappsoftware.mybakingtips D/dalvikvm: GC_CONCURRENT freed 332K, 4% free 11375K/11847K, paused 6ms+1ms, total 16ms
09-26 14:16:49.627 31852-31853/blueappsoftware.mybakingtips D/dalvikvm: GC_CONCURRENT freed 426K, 5% free 11345K/11911K, paused 9ms+0ms, total 9ms
You are probably not getting the list because you are using the getter from a different Activity.Instead, you can pass your list via Intent, but for that, you should implement your class as Parcelable or Serializable .Here is a nice post for that How can I make my custom objects Parcelable? And one thing if you are bound to load and temporarily save a list so that you can use anywhere in App then you can use setter and getter in Android Application class.Here is a nice post for that Using the Android Application class to persist data
My app consists of level, each level has 10 question. This is my first level and first question class..
public class level1 extends ActionBarActivity {
private EditText mans1;
private TextView mcount;
int sum;
public void Onclick(View v) {
mans1 = (EditText) findViewById(R.id.ans1);
mcount = (TextView) findViewById(R.id.count);
double answer = Double.parseDouble(mans1.getText().toString());
if (answer == (8 + 7))
{
Toast.makeText(level1.this, "الإجابة صحيحة", Toast.LENGTH_LONG).show();
mcount.setText(sum++);
}
else
{
Toast.makeText(level1.this, "الإجابة خاطئة", Toast.LENGTH_LONG).show();
mcount.setText(sum);
}
}
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_level1);
final TextView texview = (TextView)findViewById(R.id.count);
Button sendButton = (Button)findViewById(R.id.tm);
sendButton.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
int count = Integer.parseInt(texview.getText().toString());
Intent intent = new Intent(getApplicationContext(), level1.class);
intent.putExtra("mycount", sum);
startActivity(intent);
}
});
}
public void buttonOnClickgo(View v) {
Button next = (Button) v;
startActivity(new Intent(getApplicationContext(), level1q2.class));
}
public void buttonOnClickBack(View v) {
Button back = (Button) v;
startActivity(new Intent(getApplicationContext(), Activity2.class));
}
}
and this is the first level second question class.
public class level1q2 extends ActionBarActivity {
private EditText mans1;
private TextView mcount;
int sum;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_level1q2);
TextView textView = (TextView)findViewById(R.id.count);
Intent intent = getIntent();
int count = intent.getIntExtra("mycount", 0);
textView.setText(count);}
public void Onclick(View view)
{
mans1 = (EditText) findViewById(R.id.ans1);
mcount = (TextView) findViewById(R.id.count);
double answer = Double.parseDouble(mans1.getText().toString());
if (answer == (15-3)) {
Toast.makeText(level1q2.this, "الإجابة صحيحة", Toast.LENGTH_LONG).show();
int count = getIntent().getIntExtra("mycount", 0);
mcount.setText(count++);
} else {
Toast.makeText(level1q2.this, "الإجابة خاطئة", Toast.LENGTH_LONG).show();
int count = getIntent().getIntExtra("mycount", 0);
mcount.setText(count);
}
}
public void buttonOnClickgo(View v) {
Button next = (Button) v;
startActivity(new Intent(getApplicationContext(), level1q3.class));
}
public void buttonOnClickBack(View v) {
Button back = (Button) v;
startActivity(new Intent(getApplicationContext(), Activity2.class));
}
}
I did some changes in these classes because I want to pass the count variable from first question to the second question activity.
It is was working before I edited them but now it shows "unfortunately stopped" message ..
please review the codes
After debugging ..
04:30:29.101 1075-1075/com.mainuser.math.passgrade4.passgrade4 W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0xb3b03ba8)
08-23 04:30:29.121 1075-1075/com.mainuser.math.passgrade4.passgrade4 E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.mainuser.math.passgrade4.passgrade4, PID: 1075
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mainuser.math.passgrade4.passgrade4/com.mainuser.math.passgrade4.passgrade4.level1}: java.lang.ClassCastException: android.widget.ImageButton cannot be cast to android.widget.Button
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
at android.app.ActivityThread.access$800(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5017)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassCastException: android.widget.ImageButton cannot be cast to android.widget.Button
at com.mainuser.math.passgrade4.passgrade4.level1.onCreate(level1.java:34)
at android.app.Activity.performCreate(Activity.java:5231)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
at android.app.ActivityThread.access$800(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5017)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method)
08-23 04:30:37.051 1075-1075/com.mainuser.math.passgrade4.passgrade4 I/Process﹕ Sending signal. PID: 1075 SIG: 9
08-23 04:30:38.061 1118-1118/com.mainuser.math.passgrade4.passgrade4 I/dalvikvm﹕ Could not find method android.view.ViewGroup.onNestedScrollAccepted, referenced from method android.support.v7.internal.widget.ActionBarOverlayLayout.onNestedScrollAccepted
08-23 04:30:38.061 1118-1118/com.mainuser.math.passgrade4.passgrade4 W/dalvikvm﹕ VFY: unable to resolve virtual method 11347: Landroid/view/ViewGroup;.onNestedScrollAccepted (Landroid/view/View;Landroid/view/View;I)V
08-23 04:30:38.061 1118-1118/com.mainuser.math.passgrade4.passgrade4 D/dalvikvm﹕ VFY: replacing opcode 0x6f at 0x0000
08-23 04:30:38.061 1118-1118/com.mainuser.math.passgrade4.passgrade4 I/dalvikvm﹕ Could not find method android.view.ViewGroup.onStopNestedScroll, referenced from method android.support.v7.internal.widget.ActionBarOverlayLayout.onStopNestedScroll
08-23 04:30:38.071 1118-1118/com.mainuser.math.passgrade4.passgrade4 W/dalvikvm﹕ VFY: unable to resolve virtual method 11353: Landroid/view/ViewGroup;.onStopNestedScroll (Landroid/view/View;)V
08-23 04:30:38.071 1118-1118/com.mainuser.math.passgrade4.passgrade4 D/dalvikvm﹕ VFY: replacing opcode 0x6f at 0x0000
08-23 04:30:38.071 1118-1118/com.mainuser.math.passgrade4.passgrade4 I/dalvikvm﹕ Could not find method android.support.v7.internal.widget.ActionBarOverlayLayout.stopNestedScroll, referenced from method android.support.v7.internal.widget.ActionBarOverlayLayout.setHideOnContentScrollEnabled
08-23 04:30:38.071 1118-1118/com.mainuser.math.passgrade4.passgrade4 W/dalvikvm﹕ VFY: unable to resolve virtual method 9041: Landroid/support/v7/internal/widget/ActionBarOverlayLayout;.stopNestedScroll ()V
08-23 04:30:38.071 1118-1118/com.mainuser.math.passgrade4.passgrade4 D/dalvikvm﹕ VFY: replacing opcode 0x6e at 0x000e
08-23 04:30:38.101 1118-1118/com.mainuser.math.passgrade4.passgrade4 I/dalvikvm﹕ Could not find method android.content.res.TypedArray.getChangingConfigurations, referenced from method android.support.v7.internal.widget.TintTypedArray.getChangingConfigurations
08-23 04:30:38.101 1118-1118/com.mainuser.math.passgrade4.passgrade4 W/dalvikvm﹕ VFY: unable to resolve virtual method 366: Landroid/content/res/TypedArray;.getChangingConfigurations ()I
08-23 04:30:38.101 1118-1118/com.mainuser.math.passgrade4.passgrade4 D/dalvikvm﹕ VFY: replacing opcode 0x6e at 0x0002
08-23 04:30:38.111 1118-1118/com.mainuser.math.passgrade4.passgrade4 I/dalvikvm﹕ Could not find method android.content.res.TypedArray.getType, referenced from method android.support.v7.internal.widget.TintTypedArray.getType
08-23 04:30:38.111 1118-1118/com.mainuser.math.passgrade4.passgrade4 W/dalvikvm﹕ VFY: unable to resolve virtual method 388: Landroid/content/res/TypedArray;.getType (I)I
08-23 04:30:38.111 1118-1118/com.mainuser.math.passgrade4.passgrade4 D/dalvikvm﹕ VFY: replacing opcode 0x6e at 0x0002
08-23 04:30:38.591 1118-1118/com.mainuser.math.passgrade4.passgrade4 D/dalvikvm﹕ GC_FOR_ALLOC freed 125K, 7% free 2894K/3100K, paused 35ms, total 35ms
The problem is exactly what your exception says:
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mainuser.math.passgrade4.passgrade4/com.mainuser.math.passgrade4.passgrade4.level1}: java.lang.ClassCastException: android.widget.ImageButton cannot be cast to android.widget.Button
...
Caused by: java.lang.ClassCastException: android.widget.ImageButton cannot be cast to android.widget.Button
at com.mainuser.math.passgrade4.passgrade4.level1.onCreate(level1.java:34)
...
Your button is an ImageButton, but you tried to cast it to Button (which is not a superclass of ImageButton).
Logcat error: since i click to play emulate
07-28 23:16:56.813 2367-2367/kabashima.materiaisdeconstrucaoconcept W/EGL_genymotion﹕ eglSurfaceAttrib not implemented
07-28 23:16:58.493 2367-2367/kabashima.materiaisdeconstrucaoconcept D/dalvikvm﹕ GC_FOR_ALLOC freed 133K, 6% free 4119K/4356K, paused 2ms, total 2ms
07-28 23:16:58.493 2367-2367/kabashima.materiaisdeconstrucaoconcept D/dalvikvm﹕ GC_FOR_ALLOC freed 28K, 6% free 4311K/4580K, paused 2ms, total 2ms
07-28 23:16:58.497 2367-2367/kabashima.materiaisdeconstrucaoconcept I/dalvikvm-heap﹕ Grow heap (frag case) to 6.725MB for 2536932-byte allocation
07-28 23:16:58.501 2367-2376/kabashima.materiaisdeconstrucaoconcept D/dalvikvm﹕ GC_FOR_ALLOC freed <1K, 4% free 6788K/7060K, paused 3ms, total 3ms
07-28 23:16:58.645 2367-2367/kabashima.materiaisdeconstrucaoconcept D/dalvikvm﹕ GC_FOR_ALLOC freed 152K, 4% free 7731K/7984K, paused 3ms, total 3ms
07-28 23:16:58.709 2367-2367/kabashima.materiaisdeconstrucaoconcept D/dalvikvm﹕ GC_FOR_ALLOC freed 172K, 3% free 8970K/9244K, paused 3ms, total 3ms
07-28 23:16:58.777 2367-2367/kabashima.materiaisdeconstrucaoconcept D/dalvikvm﹕ GC_FOR_ALLOC freed 383K, 5% free 10411K/10896K, paused 4ms, total 4ms
07-28 23:16:58.873 2367-2367/kabashima.materiaisdeconstrucaoconcept D/dalvikvm﹕ GC_FOR_ALLOC freed 344K, 4% free 12369K/12816K, paused 4ms, total 4ms
07-28 23:16:58.993 2367-2367/kabashima.materiaisdeconstrucaoconcept D/dalvikvm﹕ GC_FOR_ALLOC freed 0K, 1% free 14567K/14672K, paused 7ms, total 7ms
07-28 23:16:59.149 2367-2367/kabashima.materiaisdeconstrucaoconcept D/dalvikvm﹕ GC_FOR_ALLOC freed 517K, 4% free 17737K/18356K, paused 7ms, total 7ms
07-28 23:16:59.341 2367-2367/kabashima.materiaisdeconstrucaoconcept D/dalvikvm﹕ GC_FOR_ALLOC freed 775K, 4% free 21706K/22584K, paused 9ms, total 9ms
07-28 23:16:59.573 2367-2367/kabashima.materiaisdeconstrucaoconcept D/dalvikvm﹕ GC_FOR_ALLOC freed 1163K, 5% free 26610K/27876K, paused 11ms, total 11ms
07-28 23:16:59.905 2367-2367/kabashima.materiaisdeconstrucaoconcept D/dalvikvm﹕ GC_FOR_ALLOC freed 0K, 1% free 32990K/33092K, paused 16ms, total 16ms
07-28 23:17:00.213 2367-2367/kabashima.materiaisdeconstrucaoconcept D/dalvikvm﹕ GC_FOR_ALLOC freed 1745K, 5% free 39436K/41284K, paused 18ms, total 18ms
07-28 23:17:00.565 2367-2367/kabashima.materiaisdeconstrucaoconcept D/dalvikvm﹕ GC_FOR_ALLOC freed 0K, 1% free 46080K/46184K, paused 22ms, total 22ms
07-28 23:17:00.805 2367-2367/kabashima.materiaisdeconstrucaoconcept D/dalvikvm﹕ GC_FOR_ALLOC freed 2618K, 6% free 51652K/54372K, paused 22ms, total 22ms
07-28 23:17:01.241 2367-2367/kabashima.materiaisdeconstrucaoconcept D/dalvikvm﹕ GC_FOR_ALLOC freed 0K, 1% free 59842K/59944K, paused 27ms, total 27ms
07-28 23:17:01.561 2367-2367/kabashima.materiaisdeconstrucaoconcept D/dalvikvm﹕ GC_FOR_ALLOC freed 0K, 1% free 65715K/65820K, paused 32ms, total 32ms
07-28 23:17:01.741 2367-2367/kabashima.materiaisdeconstrucaoconcept D/dalvikvm﹕ GC_FOR_ALLOC freed 3927K, 6% free 69979K/74008K, paused 30ms, total 30ms
07-28 23:17:02.189 2367-2367/kabashima.materiaisdeconstrucaoconcept D/dalvikvm﹕ GC_FOR_ALLOC freed 0K, 1% free 78170K/78272K, paused 34ms, total 34ms
07-28 23:17:02.645 2367-2367/kabashima.materiaisdeconstrucaoconcept D/dalvikvm﹕ GC_FOR_ALLOC freed 0K, 1% free 86362K/86464K, paused 38ms, total 38ms
07-28 23:17:03.097 2367-2367/kabashima.materiaisdeconstrucaoconcept I/dalvikvm-heap﹕ Clamp target GC heap from 100.434MB to 96.000MB
07-28 23:17:03.101 2367-2367/kabashima.materiaisdeconstrucaoconcept D/dalvikvm﹕ GC_FOR_ALLOC freed 0K, 1% free 94554K/94656K, paused 43ms, total 43ms
07-28 23:17:03.177 2367-2367/kabashima.materiaisdeconstrucaoconcept I/dalvikvm-heap﹕ Clamp target GC heap from 101.033MB to 96.000MB
07-28 23:17:03.177 2367-2367/kabashima.materiaisdeconstrucaoconcept D/dalvikvm﹕ GC_FOR_ALLOC freed 0K, 1% free 95167K/95272K, paused 46ms, total 46ms
07-28 23:17:03.177 2367-2367/kabashima.materiaisdeconstrucaoconcept I/dalvikvm-heap﹕ Forcing collection of SoftReferences for 9047800-byte allocation
07-28 23:17:03.237 2367-2367/kabashima.materiaisdeconstrucaoconcept I/dalvikvm-heap﹕ Clamp target GC heap from 101.025MB to 96.000MB
07-28 23:17:03.237 2367-2367/kabashima.materiaisdeconstrucaoconcept D/dalvikvm﹕ GC_BEFORE_OOM freed 9K, 1% free 95157K/95272K, paused 61ms, total 61ms
07-28 23:17:03.237 2367-2367/kabashima.materiaisdeconstrucaoconcept E/dalvikvm-heap﹕ Out of memory on a 9047800-byte allocation.
07-28 23:17:03.237 2367-2367/kabashima.materiaisdeconstrucaoconcept I/dalvikvm﹕ "main" prio=5 tid=1 RUNNABLE
07-28 23:17:03.237 2367-2367/kabashima.materiaisdeconstrucaoconcept I/dalvikvm﹕ | group="main" sCount=0 dsCount=0 obj=0xa4d10bd8 self=0xb8991eb0
07-28 23:17:03.237 2367-2367/kabashima.materiaisdeconstrucaoconcept I/dalvikvm﹕ | sysTid=2367 nice=0 sched=0/0 cgrp=apps handle=-1216860096
07-28 23:17:03.237 2367-2367/kabashima.materiaisdeconstrucaoconcept I/dalvikvm﹕ | state=R schedstat=( 4963745014 39782304 859 ) utm=460 stm=35 core=1
07-28 23:17:03.237 2367-2367/kabashima.materiaisdeconstrucaoconcept I/dalvikvm﹕ at java.util.ArrayList.add(ArrayList.java:~118)
07-28 23:17:03.237 2367-2367/kabashima.materiaisdeconstrucaoconcept I/dalvikvm﹕ at android.widget.ArrayAdapter.add(ArrayAdapter.java:179)
07-28 23:17:03.237 2367-2367/kabashima.materiaisdeconstrucaoconcept I/dalvikvm﹕ at kabashima.materiaisdeconstrucaoconcept.bancodedados.dominio.RepositorioEstoque.buscaEstoque(RepositorioEstoque.java:51)
07-28 23:17:03.237 2367-2367/kabashima.materiaisdeconstrucaoconcept I/dalvikvm﹕ at kabashima.materiaisdeconstrucaoconcept.EstoqueProdutos.onCreate(EstoqueProdutos.java:50)
07-28 23:17:03.237 2367-2367/kabashima.materiaisdeconstrucaoconcept I/dalvikvm﹕ at android.app.Activity.performCreate(Activity.java:5231)
07-28 23:17:03.237 2367-2367/kabashima.materiaisdeconstrucaoconcept I/dalvikvm﹕ at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
07-28 23:17:03.237 2367-2367/kabashima.materiaisdeconstrucaoconcept I/dalvikvm﹕ at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2148)
07-28 23:17:03.237 2367-2367/kabashima.materiaisdeconstrucaoconcept I/dalvikvm﹕ at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233)
07-28 23:17:03.237 2367-2367/kabashima.materiaisdeconstrucaoconcept I/dalvikvm﹕ at android.app.ActivityThread.access$800(ActivityThread.java:135)
07-28 23:17:03.237 2367-2367/kabashima.materiaisdeconstrucaoconcept I/dalvikvm﹕ at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
07-28 23:17:03.237 2367-2367/kabashima.materiaisdeconstrucaoconcept I/dalvikvm﹕ at android.os.Handler.dispatchMessage(Handler.java:102)
07-28 23:17:03.237 2367-2367/kabashima.materiaisdeconstrucaoconcept I/dalvikvm﹕ at android.os.Looper.loop(Looper.java:136)
07-28 23:17:03.237 2367-2367/kabashima.materiaisdeconstrucaoconcept I/dalvikvm﹕ at android.app.ActivityThread.main(ActivityThread.java:5001)
07-28 23:17:03.237 2367-2367/kabashima.materiaisdeconstrucaoconcept I/dalvikvm﹕ at java.lang.reflect.Method.invokeNative(Native Method)
07-28 23:17:03.237 2367-2367/kabashima.materiaisdeconstrucaoconcept I/dalvikvm﹕ at java.lang.reflect.Method.invoke(Method.java:515)
07-28 23:17:03.237 2367-2367/kabashima.materiaisdeconstrucaoconcept I/dalvikvm﹕ at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
07-28 23:17:03.237 2367-2367/kabashima.materiaisdeconstrucaoconcept I/dalvikvm﹕ at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
07-28 23:17:03.237 2367-2367/kabashima.materiaisdeconstrucaoconcept I/dalvikvm﹕ at dalvik.system.NativeStart.main(Native Method)
07-28 23:17:03.237 2367-2367/kabashima.materiaisdeconstrucaoconcept I/dalvikvm﹕ [ 07-28 23:17:03.237 2367: 2367 D/AndroidRuntime ]
Shutting down VM
07-28 23:17:03.237 2367-2367/kabashima.materiaisdeconstrucaoconcept W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0xa4d0fb20)
07-28 23:17:03.237 2367-2367/kabashima.materiaisdeconstrucaoconcept E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: kabashima.materiaisdeconstrucaoconcept, PID: 2367
java.lang.OutOfMemoryError
at java.util.ArrayList.add(ArrayList.java:118)
at android.widget.ArrayAdapter.add(ArrayAdapter.java:179)
at kabashima.materiaisdeconstrucaoconcept.bancodedados.dominio.RepositorioEstoque.buscaEstoque(RepositorioEstoque.java:51)
at kabashima.materiaisdeconstrucaoconcept.EstoqueProdutos.onCreate(EstoqueProdutos.java:50)
at android.app.Activity.performCreate(Activity.java:5231)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2148)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233)
at android.app.ActivityThread.access$800(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5001)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
at dalvik.system.NativeStart.main(Native Method)
//Banco de dados class
package kabashima.materiaisdeconstrucaoconcept.bancodedados;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import kabashima.materiaisdeconstrucaoconcept.Contact;
public class BancoDeDados extends SQLiteOpenHelper {
private static final int DATABASE_VERSION = 2;
private static final String DATABASE_NAME = "contacts.db";
private static final String TABLE_NAME = "contacts";
private static final String COLUMN_ID = "id";
private static final String COLUMN_NOME = "nome";
private static final String COLUMN_EMAIL = "email";
private static final String COLUMN_SENHA = "senha";
SQLiteDatabase db;
private static final String TABLE_CREATE = "create table contacts(id integer primary key not null ," +
"nome text not null, email text not null, senha text not null);";
public BancoDeDados(Context context){
super(context, DATABASE_NAME, null, DATABASE_VERSION);
}
#Override
public void onCreate(SQLiteDatabase db) {
db.execSQL(TABLE_CREATE);
db.execSQL( ScriptSQL.getCreateEstoqueProdutos());
// db.execSQL(TABLE_CREATE2);
this.db=db;
}
#Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
String query = "DROP TABLE IF EXISTS" + TABLE_NAME;
db.execSQL(query);
this.onCreate(db);
}
public void insertContact(Contact c) {
db = this.getWritableDatabase();
ContentValues values = new ContentValues();
String query = "select * from contacts";
Cursor cursor = db.rawQuery(query, null);
int count = cursor.getCount();
values.put(COLUMN_ID, count);
values.put(COLUMN_NOME, c.getNome());
values.put(COLUMN_EMAIL, c.getEmail());
values.put(COLUMN_SENHA, c.getSenha());
db.insert(TABLE_NAME, null, values);
db.close();
}
public String searchPass(String nome){
db = this.getReadableDatabase();
String query = "select nome, senha from " + TABLE_NAME;
Cursor cursor = db.rawQuery(query, null);
String a,b;
b = "not found";
if(cursor.moveToFirst()){
do{
a = cursor.getString(0);
if(a.equals(nome))
{
b = cursor.getString(1);
break;
}
}while (cursor.moveToNext());
}
return b;
}
}
//RepositorioEstoque class
package kabashima.materiaisdeconstrucaoconcept.bancodedados.dominio;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.widget.ArrayAdapter;
public class RepositorioEstoque {
private SQLiteDatabase conn;
public RepositorioEstoque(SQLiteDatabase conn) {
this.conn = conn;
}
public void TesteInserirProdutos() {
for (int i = 0; i < 10; i++) {
ContentValues values = new ContentValues();
values.put("NOMEPRODUTOS", "JR");
conn.insertOrThrow("ESTOQUEPRODUTOS", null, values);
}
}
public ArrayAdapter<String> buscaEstoque(Context context)
{
ArrayAdapter<String> adpEstoque = new ArrayAdapter<String>(context, android.R.layout.simple_list_item_1);
Cursor cursor = conn.query("ESTOQUEPRODUTOS",null,null,null,null,null,null);
if (cursor.getCount() > 0)
{
do {
cursor.moveToFirst();
String nome = cursor.getString(1);
adpEstoque.add(nome);
} while (cursor.moveToNext());
}
return adpEstoque;
}
}
//EstoqueProdutos class
package kabashima.materiaisdeconstrucaoconcept;
import android.app.AlertDialog;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.*;
import android.content.*;
import android.database.sqlite.*;
import android.database.*;
import kabashima.materiaisdeconstrucaoconcept.bancodedados.BancoDeDados;
import kabashima.materiaisdeconstrucaoconcept.bancodedados.dominio.RepositorioEstoque;
public class EstoqueProdutos extends ActionBarActivity implements View.OnClickListener{
private ImageButton btnAdicionar;
private EditText edtPesquisa;
private ListView lstProdutos;
private ArrayAdapter<String> adpEstoque;
private BancoDeDados bancodedados;
private SQLiteDatabase conn;
private RepositorioEstoque repositorioEstoque;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.estoqueprodutos);
btnAdicionar = (ImageButton)findViewById(R.id.btnAdicionar);
edtPesquisa = (EditText)findViewById(R.id.edtPesquisa);
lstProdutos = (ListView)findViewById(R.id.lstProdutos);
btnAdicionar.setOnClickListener(this);
try{
bancodedados = new BancoDeDados(this);
conn = bancodedados.getWritableDatabase();
repositorioEstoque = new RepositorioEstoque(conn);
repositorioEstoque.TesteInserirProdutos();
adpEstoque = repositorioEstoque.buscaEstoque(this);
lstProdutos.setAdapter(adpEstoque);
AlertDialog.Builder dlg = new AlertDialog.Builder(this);
dlg.setMessage("Conexao criada com sucesso!");
dlg.setNeutralButton("ok", null);
}
catch(SQLException ex)
{
AlertDialog.Builder dlg = new AlertDialog.Builder(this);
dlg.setMessage("Erro ao criar o banco"+ ex.getMessage());
dlg.setNeutralButton("ok", null);
//MessageBox.show(this, "Erro", "Erro ao criar o banco: " + ex.getMessage() );
}
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_estoque_produtos, menu);
return true;
}
#Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
#Override
public void onClick(View view) {
Intent in = new Intent(this, CadastrarProdutos.class);
startActivity(in);
}
}
//ScripSQL class
package kabashima.materiaisdeconstrucaoconcept.bancodedados;
public class ScriptSQL {
public static String getCreateEstoqueProdutos()
{
StringBuilder sqlBuilder = new StringBuilder();
sqlBuilder.append(" CREATE TABLE IF NOT EXISTS ESTOQUEPRODUTOS ( ");
sqlBuilder.append("_id INTEGER NOT NULL ");
sqlBuilder.append("PRIMARY KEY AUTOINCREMENT, ");
sqlBuilder.append("NOMEPRODUTOS VARCHAR (200), ");
sqlBuilder.append("MARCA VARCHAR (200), ");
sqlBuilder.append("LOJA VARCHAR (200), ");
sqlBuilder.append("ESTOQUE VARCHAR (10), ");
sqlBuilder.append("VALOR VARCHAR (30) ");
sqlBuilder.append(");");
return sqlBuilder.toString();
}
}
//There are the codes, cold somebody see it for me? it will help me a lot. I don't know really whats the problem =/ thanks, i will be helpful!
You are adding all your results to the adpEstoque ArrayAdapter, which throws an OutOfMemory error.
Instead of using an ArrayAdapter use a CursorAdapter
For more information on how to use the CursorAdapter you can read the answer here: Cursor adapter and sqlite example
Okay, so i finally got my button to start my new activity from the main activity. now, the problem i have is that when the new activity starts, the avd gives me an error saying "unfortunately, yourApp has stopped working". I tried for hours to detect the problem untill i began to comment some part of the new activity's code and then finally, i found it. keep in mind, that almost all the variables i used in the new activity also had common names and ids to those in the mainActivity, but this should not be the problem since i am not passing anything through both activities...at least not now. The problem was from the spinners. their declaration worked fine...i guess, the findViewByid method gave no problem, the arrayAdapter also gave no problems but i noticed that the app only shuts down when i remove the comments from the onItemSelectedListener and the setAdapters methods. i don't know why this happens. i used the same code for the mainActivity and it works perfectly. Dunno if i overloaded the onCreate method but as i said earlier, it works fine in the mainActivity. the new activity code for th onCreate method is given below...the other parts of the code works fine.
public class firstYearSecondSemester2 extends Activity implements AdapterView.OnItemSelectedListener {
private String[] grades;
public Spinner spinner0, spinner1, spinner2, spinner3, spinner4, spinner5, spinner6, spinner7, spinner8;
private double[] grade_values = {0.0, 5.0, 4.0, 3.0, 2.0, 1.0, 0.0};
//private Spinner gpa_grade0, gpa_grade1, gpa_grade2, gpa_grade3, gpa_grade4, gpa_grade5;
private double gpa_grade_0, gpa_grade_1, gpa_grade_2, gpa_grade_3, gpa_grade_4, gpa_grade_5, gpa_grade_6, gpa_grade_7, gpa_grade_8;
private TextView gpa, gpa_credits0, gpa_credits1, gpa_credits2, gpa_credits3, gpa_credits4,gpa_credits5, gpa_credits6, gpa_credits7,gpa_credits8;
private int gpa_credits_0, gpa_credits_1, gpa_credits_2, gpa_credits_3, gpa_credits_4, gpa_credits_5, gpa_credits_6, gpa_credits_7, gpa_credits_8;
public int[] spinner_ids;
public int spinner_check;
public int spinner_index;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_first_year_second_semester2);
spinner_ids = new int[9];
spinner_check = 0;
spinner_index = 0;
gpa = (TextView) findViewById(R.id.gpa_results_text);
grades = getResources().getStringArray(R.array.grades);
gpa_credits0 = (TextView) findViewById(R.id.gpa_credits_0);
gpa_credits1 = (TextView) findViewById(R.id.gpa_credits_1);
gpa_credits2 = (TextView) findViewById(R.id.gpa_credits_2);
gpa_credits3 = (TextView) findViewById(R.id.gpa_credits_3);
gpa_credits4 = (TextView) findViewById(R.id.gpa_credits_4);
gpa_credits5 = (TextView) findViewById(R.id.gpa_credits_5);
gpa_credits6 = (TextView) findViewById(R.id.gpa_credits_6);
gpa_credits7 = (TextView) findViewById(R.id.gpa_credits_7);
gpa_credits8 = (TextView) findViewById(R.id.gpa_credits_8);
spinner0 = (Spinner) findViewById(R.id.gradeSpinner0);
spinner1 = (Spinner) findViewById(R.id.gradeSpinner1);
spinner2 = (Spinner) findViewById(R.id.gradeSpinner2);
spinner3 = (Spinner) findViewById(R.id.gradeSpinner3);
spinner4 = (Spinner) findViewById(R.id.gradeSpinner4);
spinner5 = (Spinner) findViewById(R.id.gradeSpinner5);
spinner6 = (Spinner) findViewById(R.id.gradeSpinner6);
spinner7 = (Spinner) findViewById(R.id.gradeSpinner7);
spinner8 = (Spinner) findViewById(R.id.gradeSpinner8);
ArrayAdapter<String> each_grade = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, grades);
each_grade.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinner0.setAdapter(new NothingSelectedSpinnerAdapter(each_grade, R.layout.contact_spinner_row_nothing_selected,/* R.layout.contact_spinner_nothing_selected_dropdown, // Optional*/this));
spinner1.setAdapter(new NothingSelectedSpinnerAdapter(each_grade, R.layout.contact_spinner_row_nothing_selected,/* R.layout.contact_spinner_nothing_selected_dropdown, // Optional*/this));
spinner2.setAdapter(new NothingSelectedSpinnerAdapter(each_grade, R.layout.contact_spinner_row_nothing_selected,/* R.layout.contact_spinner_nothing_selected_dropdown, // Optional*/this));
spinner3.setAdapter(new NothingSelectedSpinnerAdapter(each_grade, R.layout.contact_spinner_row_nothing_selected,/* R.layout.contact_spinner_nothing_selected_dropdown, // Optional*/this));
spinner4.setAdapter(new NothingSelectedSpinnerAdapter(each_grade, R.layout.contact_spinner_row_nothing_selected,/* R.layout.contact_spinner_nothing_selected_dropdown, // Optional*/this));
spinner5.setAdapter(new NothingSelectedSpinnerAdapter(each_grade, R.layout.contact_spinner_row_nothing_selected,/* R.layout.contact_spinner_nothing_selected_dropdown, // Optional*/this));
spinner6.setAdapter(new NothingSelectedSpinnerAdapter(each_grade, R.layout.contact_spinner_row_nothing_selected,/* R.layout.contact_spinner_nothing_selected_dropdown, // Optional*/this));
spinner7.setAdapter(new NothingSelectedSpinnerAdapter(each_grade, R.layout.contact_spinner_row_nothing_selected,/* R.layout.contact_spinner_nothing_selected_dropdown, // Optional*/this));
spinner8.setAdapter(new NothingSelectedSpinnerAdapter(each_grade, R.layout.contact_spinner_row_nothing_selected,/* R.layout.contact_spinner_nothing_selected_dropdown, // Optional*/this));
spinner0.setOnItemSelectedListener(firstYearSecondSemester2.this);
spinner1.setOnItemSelectedListener(firstYearSecondSemester2.this);
spinner2.setOnItemSelectedListener(firstYearSecondSemester2.this);
spinner3.setOnItemSelectedListener(firstYearSecondSemester2.this);
spinner4.setOnItemSelectedListener(firstYearSecondSemester2.this);
spinner5.setOnItemSelectedListener(firstYearSecondSemester2.this);
spinner6.setOnItemSelectedListener(firstYearSecondSemester2.this);
spinner7.setOnItemSelectedListener(firstYearSecondSemester2.this);
spinner8.setOnItemSelectedListener(firstYearSecondSemester2.this);
}
Logcat Messages
04-14 02:21:16.260 1772-1772/com.daftnerds.juliusugochukwu.cgpa4 D/dalvikvm﹕ Not late-enabling CheckJNI (already on)
04-14 02:21:16.830 1772-1772/com.daftnerds.juliusugochukwu.cgpa4 I/dalvikvm﹕ Could not find method android.view.ViewGroup.onNestedScrollAccepted, referenced from method android.support.v7.internal.widget.ActionBarOverlayLayout.onNestedScrollAccepted
04-14 02:21:16.830 1772-1772/com.daftnerds.juliusugochukwu.cgpa4 W/dalvikvm﹕ VFY: unable to resolve virtual method 11350: Landroid/view/ViewGroup;.onNestedScrollAccepted (Landroid/view/View;Landroid/view/View;I)V
04-14 02:21:16.830 1772-1772/com.daftnerds.juliusugochukwu.cgpa4 D/dalvikvm﹕ VFY: replacing opcode 0x6f at 0x0000
04-14 02:21:16.830 1772-1772/com.daftnerds.juliusugochukwu.cgpa4 I/dalvikvm﹕ Could not find method android.view.ViewGroup.onStopNestedScroll, referenced from method android.support.v7.internal.widget.ActionBarOverlayLayout.onStopNestedScroll
04-14 02:21:16.830 1772-1772/com.daftnerds.juliusugochukwu.cgpa4 W/dalvikvm﹕ VFY: unable to resolve virtual method 11356: Landroid/view/ViewGroup;.onStopNestedScroll (Landroid/view/View;)V
04-14 02:21:16.830 1772-1772/com.daftnerds.juliusugochukwu.cgpa4 D/dalvikvm﹕ VFY: replacing opcode 0x6f at 0x0000
04-14 02:21:16.830 1772-1772/com.daftnerds.juliusugochukwu.cgpa4 I/dalvikvm﹕ Could not find method android.support.v7.internal.widget.ActionBarOverlayLayout.stopNestedScroll, referenced from method android.support.v7.internal.widget.ActionBarOverlayLayout.setHideOnContentScrollEnabled
04-14 02:21:16.830 1772-1772/com.daftnerds.juliusugochukwu.cgpa4 W/dalvikvm﹕ VFY: unable to resolve virtual method 9044: Landroid/support/v7/internal/widget/ActionBarOverlayLayout;.stopNestedScroll ()V
04-14 02:21:16.830 1772-1772/com.daftnerds.juliusugochukwu.cgpa4 D/dalvikvm﹕ VFY: replacing opcode 0x6e at 0x000e
04-14 02:21:16.910 1772-1772/com.daftnerds.juliusugochukwu.cgpa4 I/dalvikvm﹕ Could not find method android.content.res.TypedArray.getChangingConfigurations, referenced from method android.support.v7.internal.widget.TintTypedArray.getChangingConfigurations
04-14 02:21:16.910 1772-1772/com.daftnerds.juliusugochukwu.cgpa4 W/dalvikvm﹕ VFY: unable to resolve virtual method 368: Landroid/content/res/TypedArray;.getChangingConfigurations ()I
04-14 02:21:16.910 1772-1772/com.daftnerds.juliusugochukwu.cgpa4 D/dalvikvm﹕ VFY: replacing opcode 0x6e at 0x0002
04-14 02:21:16.910 1772-1772/com.daftnerds.juliusugochukwu.cgpa4 I/dalvikvm﹕ Could not find method android.content.res.TypedArray.getType, referenced from method android.support.v7.internal.widget.TintTypedArray.getType
04-14 02:21:16.910 1772-1772/com.daftnerds.juliusugochukwu.cgpa4 W/dalvikvm﹕ VFY: unable to resolve virtual method 390: Landroid/content/res/TypedArray;.getType (I)I
04-14 02:21:16.910 1772-1772/com.daftnerds.juliusugochukwu.cgpa4 D/dalvikvm﹕ VFY: replacing opcode 0x6e at 0x0002
04-14 02:21:17.150 1772-1772/com.daftnerds.juliusugochukwu.cgpa4 D/dalvikvm﹕ GC_FOR_ALLOC freed 140K, 8% free 3075K/3340K, paused 0ms, total 5ms
04-14 02:21:17.150 1772-1772/com.daftnerds.juliusugochukwu.cgpa4 I/dalvikvm-heap﹕ Grow heap (frag case) to 4.195MB for 1127532-byte allocation
04-14 02:21:17.210 1772-1781/com.daftnerds.juliusugochukwu.cgpa4 D/dalvikvm﹕ GC_FOR_ALLOC freed 13K, 7% free 4163K/4444K, paused 3ms, total 4ms
04-14 02:21:18.930 1772-1772/com.daftnerds.juliusugochukwu.cgpa4 I/Choreographer﹕ Skipped 103 frames! The application may be doing too much work on its main thread.
04-14 02:21:18.930 1772-1772/com.daftnerds.juliusugochukwu.cgpa4 D/gralloc_goldfish﹕ Emulator without GPU emulation detected.
04-14 02:27:17.189 1772-1772/com.daftnerds.juliusugochukwu.cgpa4 I/Choreographer﹕ Skipped 60 frames! The application may be doing too much work on its main thread.
04-14 02:27:17.309 1772-1772/com.daftnerds.juliusugochukwu.cgpa4 D/dalvikvm﹕ GC_FOR_ALLOC freed 168K, 7% free 4507K/4796K, paused 2ms, total 2ms
04-14 02:29:34.831 2264-2264/com.daftnerds.juliusugochukwu.cgpa4 D/gralloc_goldfish﹕ Emulator without GPU emulation detected.
Now, once i click the button to start the new activity, this happens
04-14 02:30:40.562 2264-2264/com.daftnerds.juliusugochukwu.cgpa4 D/AndroidRuntime﹕ Shutting down VM
04-14 02:30:40.562 2264-2264/com.daftnerds.juliusugochukwu.cgpa4 W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0xb0d3cb20)
04-14 02:30:40.602 2264-2264/com.daftnerds.juliusugochukwu.cgpa4 E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.daftnerds.juliusugochukwu.cgpa4, PID: 2264
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.daftnerds.juliusugochukwu.cgpa4/com.daftnerds.juliusugochukwu.cgpa4.firstYearSecondSemester2}: java.lang.NullPointerException
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
at android.app.ActivityThread.access$800(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5017)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at com.daftnerds.juliusugochukwu.cgpa4.firstYearSecondSemester2.onCreate(firstYearSecondSemester2.java:76)
at android.app.Activity.performCreate(Activity.java:5231)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
at android.app.ActivityThread.access$800(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5017)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method)
change line with
spinner0.setAdapter(new NothingSelectedSpinnerAdapter(each_grade,R.layout.contact_spinner_row_nothing_selected,this));
and clean your project once.
Omg...found the problem. Truly it was line 76. Please don't be annoyed. I initially had 9 spinners in the main activity and 7 in the new activity. I copied the main activity spinner codes and pasted in the new activity. So when it gets to the 8th spinner (line 76), it gives an error since that spinner is not available in the layout. Thanks for all the help suggested guys...really appreciate them.
I am trying to make a slideshow app for a school project, and I have it working when the view flipper contains 3 images. However, when I add a 4th layout and another picture the program crashes.
Any idea why? Thanks!
public class MainActivity extends Activity {
private static final int SWIPE_MIN_DISTANCE = 120;
private static final int SWIPE_THRESHOLD_VELOCITY = 200;
private ViewFlipper myViewFlipper;
private AnimationListener mAnimationListener;
private Context mContext;
MediaPlayer soundOne, soundTwo, soundThree;
#SuppressWarnings("deprecation")
private final GestureDetector detector = new GestureDetector(new SwipeGestureDetector());
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mContext = this;
myViewFlipper = (ViewFlipper) this.findViewById(R.id.view_flipper);
myViewFlipper.setOnTouchListener(new OnTouchListener() {
#Override
public boolean onTouch(final View view, final MotionEvent event) {
detector.onTouchEvent(event);
return true;
}
});
findViewById(R.id.play).setOnClickListener(new OnClickListener() {
#Override
public void onClick(View view) {
//sets auto flipping
myViewFlipper.setAutoStart(true);
myViewFlipper.setFlipInterval(4000);
myViewFlipper.startFlipping();
soundOne = MediaPlayer.create(MainActivity.this, R.raw.one );
soundTwo = MediaPlayer.create(MainActivity.this, R.raw.two );
soundThree = MediaPlayer.create(MainActivity.this, R.raw.three );
//generate random number
Random randomGenerator = new Random();
int randomInt = randomGenerator.nextInt(3) + 1;
//picking the right sound to play
switch (randomInt){
case 1: soundOne.start();
break;
case 2: soundTwo.start();
break;
case 3: soundThree.start();
break;
}
}
});
findViewById(R.id.stop).setOnClickListener(new OnClickListener() {
#Override
public void onClick(View view) {
//stop auto flipping
myViewFlipper.stopFlipping();
soundOne.stop();
soundTwo.stop();
soundThree.stop();
}
});
//animation listener
mAnimationListener = new Animation.AnimationListener() {
public void onAnimationStart(Animation animation) {
//animation started event
}
public void onAnimationRepeat(Animation animation) {
}
public void onAnimationEnd(Animation animation) {
//TODO animation stopped event
}
};
}
class SwipeGestureDetector extends SimpleOnGestureListener {
#Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
try {
// right to left swipe
if (e1.getX() - e2.getX() > SWIPE_MIN_DISTANCE && Math.abs(velocityX) > SWIPE_THRESHOLD_VELOCITY) {
myViewFlipper.setInAnimation(loadAnimation(mContext, R.anim.abc_fade_in));
myViewFlipper.setOutAnimation(loadAnimation(mContext, R.anim.abc_fade_out));
// controlling animation
myViewFlipper.getInAnimation().setAnimationListener(mAnimationListener);
myViewFlipper.showNext();
return true;
} else
if (e2.getX() - e1.getX() > SWIPE_MIN_DISTANCE && Math.abs(velocityX) > SWIPE_THRESHOLD_VELOCITY) {
myViewFlipper.setInAnimation(loadAnimation(mContext, R.anim.abc_slide_in_top));
myViewFlipper.setOutAnimation(loadAnimation(mContext, R.anim.abc_slide_out_bottom));
// controlling animation
myViewFlipper.getInAnimation().setAnimationListener(mAnimationListener);
myViewFlipper.showPrevious();
return true;
}
} catch (Exception e) {
e.printStackTrace();
}
return false;
}
}
}
I don't know why but when I've looked at the logcat it's referring to the layout file 'activity_main'. I've look at it and can't see why it's not working as previously I had 3 relative layouts and changed it to 4.
here is logcat
03-06 17:29:08.973 32420-32420/firstapp.imageslide.imageslide E/Trace﹕ error opening trace file: No such file or directory (2)
03-06 17:29:08.973 32420-32420/firstapp.imageslide.imageslide D/ActivityThread﹕ setTargetHeapUtilization:0.25
03-06 17:29:08.973 32420-32420/firstapp.imageslide.imageslide D/ActivityThread﹕ setTargetHeapIdealFree:8388608
03-06 17:29:08.973 32420-32420/firstapp.imageslide.imageslide D/ActivityThread﹕ setTargetHeapConcurrentStart:2097152
03-06 17:29:09.583 32420-32420/firstapp.imageslide.imageslide D/dalvikvm﹕ GC_FOR_ALLOC freed 87K, 10% free 17905K/19779K, paused 60ms, total 60ms
03-06 17:29:09.653 32420-32420/firstapp.imageslide.imageslide I/dalvikvm-heap﹕ Grow heap (frag case) to 38.204MB for 12544016-byte allocation
03-06 17:29:09.673 32420-32424/firstapp.imageslide.imageslide D/dalvikvm﹕ GC_CONCURRENT freed 1K, 6% free 30153K/32071K, paused 8ms+2ms, total 25ms
03-06 17:29:09.793 32420-32424/firstapp.imageslide.imageslide D/dalvikvm﹕ GC_CONCURRENT freed 6890K, 23% free 30155K/38983K, paused 12ms+3ms, total 30ms
03-06 17:29:09.903 32420-32420/firstapp.imageslide.imageslide D/dalvikvm﹕ GC_FOR_ALLOC freed <1K, 23% free 30155K/38983K, paused 16ms, total 16ms
03-06 17:29:09.963 32420-32420/firstapp.imageslide.imageslide I/dalvikvm-heap﹕ Grow heap (frag case) to 50.166MB for 12544016-byte allocation
03-06 17:29:10.003 32420-32424/firstapp.imageslide.imageslide D/dalvikvm﹕ GC_CONCURRENT freed <1K, 18% free 42405K/51271K, paused 11ms+3ms, total 32ms
03-06 17:29:10.093 32420-32424/firstapp.imageslide.imageslide D/dalvikvm﹕ GC_CONCURRENT freed 6890K, 18% free 42407K/51271K, paused 2ms+5ms, total 41ms
03-06 17:29:10.163 32420-32420/firstapp.imageslide.imageslide D/dalvikvm﹕ GC_FOR_ALLOC freed <1K, 18% free 42407K/51271K, paused 18ms, total 18ms
03-06 17:29:10.243 32420-32420/firstapp.imageslide.imageslide I/dalvikvm-heap﹕ Grow heap (frag case) to 62.131MB for 12544016-byte allocation
03-06 17:29:10.313 32420-32424/firstapp.imageslide.imageslide D/dalvikvm﹕ GC_CONCURRENT freed <1K, 15% free 54657K/63559K, paused 12ms+6ms, total 66ms
03-06 17:29:10.573 32420-32424/firstapp.imageslide.imageslide D/dalvikvm﹕ GC_CONCURRENT freed 6890K, 15% free 54659K/63559K, paused 12ms+4ms, total 46ms
03-06 17:29:10.653 32420-32420/firstapp.imageslide.imageslide D/dalvikvm﹕ GC_FOR_ALLOC freed <1K, 15% free 54659K/63559K, paused 16ms, total 16ms
03-06 17:29:10.653 32420-32420/firstapp.imageslide.imageslide I/dalvikvm-heap﹕ Forcing collection of SoftReferences for 12544016-byte allocation
03-06 17:29:10.673 32420-32420/firstapp.imageslide.imageslide D/dalvikvm﹕ GC_BEFORE_OOM freed 8K, 15% free 54650K/63559K, paused 25ms, total 25ms
03-06 17:29:10.673 32420-32420/firstapp.imageslide.imageslide E/dalvikvm-heap﹕ Out of memory on a 12544016-byte allocation.
03-06 17:29:10.673 32420-32420/firstapp.imageslide.imageslide I/dalvikvm﹕ "main" prio=5 tid=1 RUNNABLE
03-06 17:29:10.673 32420-32420/firstapp.imageslide.imageslide I/dalvikvm﹕ | group="main" sCount=0 dsCount=0 obj=0x40c585e0 self=0x400c70d8
03-06 17:29:10.673 32420-32420/firstapp.imageslide.imageslide I/dalvikvm﹕ | sysTid=32420 nice=0 sched=0/0 cgrp=apps handle=1075144752
03-06 17:29:10.673 32420-32420/firstapp.imageslide.imageslide I/dalvikvm﹕ | schedstat=( 0 0 0 ) utm=64 stm=33 core=1
03-06 17:29:10.673 32420-32420/firstapp.imageslide.imageslide I/dalvikvm﹕ at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
03-06 17:29:10.693 32420-32420/firstapp.imageslide.imageslide I/dalvikvm﹕ at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:500)
03-06 17:29:10.693 32420-32420/firstapp.imageslide.imageslide I/dalvikvm﹕ at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:353)
03-06 17:29:10.713 32420-32420/firstapp.imageslide.imageslide I/dalvikvm﹕ at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:785)
03-06 17:29:10.713 32420-32420/firstapp.imageslide.imageslide I/dalvikvm﹕ at android.content.res.Resources.loadDrawable(Resources.java:1935)
03-06 17:29:10.713 32420-32420/firstapp.imageslide.imageslide I/dalvikvm﹕ at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
03-06 17:29:10.723 32420-32420/firstapp.imageslide.imageslide I/dalvikvm﹕ at android.widget.ImageView.<init>(ImageView.java:120)
03-06 17:29:10.723 32420-32420/firstapp.imageslide.imageslide I/dalvikvm﹕ at android.widget.ImageView.<init>(ImageView.java:110)
03-06 17:29:10.723 32420-32420/firstapp.imageslide.imageslide I/dalvikvm﹕ at java.lang.reflect.Constructor.constructNative(Native Method)
03-06 17:29:10.743 32420-32420/firstapp.imageslide.imageslide I/dalvikvm﹕ at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
03-06 17:29:10.783 32420-32420/firstapp.imageslide.imageslide I/dalvikvm﹕ at android.view.LayoutInflater.createView(LayoutInflater.java:587)
03-06 17:29:10.813 32420-32420/firstapp.imageslide.imageslide I/dalvikvm﹕ at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
03-06 17:29:10.813 32420-32420/firstapp.imageslide.imageslide I/dalvikvm﹕ at android.view.LayoutInflater.onCreateView(LayoutInflater.java:660)
03-06 17:29:10.813 32420-32420/firstapp.imageslide.imageslide I/dalvikvm﹕ at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:685)
03-06 17:29:10.813 32420-32420/firstapp.imageslide.imageslide I/dalvikvm﹕ at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
03-06 17:29:10.813 32420-32420/firstapp.imageslide.imageslide I/dalvikvm﹕ at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
03-06 17:29:10.813 32420-32420/firstapp.imageslide.imageslide I/dalvikvm﹕ at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
03-06 17:29:10.813 32420-32420/firstapp.imageslide.imageslide I/dalvikvm﹕ at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
03-06 17:29:10.813 32420-32420/firstapp.imageslide.imageslide I/dalvikvm﹕ at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
03-06 17:29:10.813 32420-32420/firstapp.imageslide.imageslide I/dalvikvm﹕ at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
03-06 17:29:10.813 32420-32420/firstapp.imageslide.imageslide I/dalvikvm﹕ at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
03-06 17:29:10.813 32420-32420/firstapp.imageslide.imageslide I/dalvikvm﹕ at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
03-06 17:29:10.813 32420-32420/firstapp.imageslide.imageslide I/dalvikvm﹕ at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:262)
03-06 17:29:10.813 32420-32420/firstapp.imageslide.imageslide I/dalvikvm﹕ at android.app.Activity.setContentView(Activity.java:1867)
03-06 17:29:10.813 32420-32420/firstapp.imageslide.imageslide I/dalvikvm﹕ at firstapp.imageslide.imageslide.MainActivity.onCreate(MainActivity.java:38)
03-06 17:29:10.813 32420-32420/firstapp.imageslide.imageslide I/dalvikvm﹕ at android.app.Activity.performCreate(Activity.java:5008)
03-06 17:29:10.813 32420-32420/firstapp.imageslide.imageslide I/dalvikvm﹕ at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
03-06 17:29:10.813 32420-32420/firstapp.imageslide.imageslide I/dalvikvm﹕ at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2035)
03-06 17:29:10.813 32420-32420/firstapp.imageslide.imageslide I/dalvikvm﹕ at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2096)
03-06 17:29:10.813 32420-32420/firstapp.imageslide.imageslide I/dalvikvm﹕ at android.app.ActivityThread.access$600(ActivityThread.java:138)
03-06 17:29:10.813 32420-32420/firstapp.imageslide.imageslide I/dalvikvm﹕ at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1207)
03-06 17:29:10.813 32420-32420/firstapp.imageslide.imageslide I/dalvikvm﹕ at android.os.Handler.dispatchMessage(Handler.java:99)
03-06 17:29:10.843 32420-32420/firstapp.imageslide.imageslide I/dalvikvm﹕ at android.os.Looper.loop(Looper.java:213)
03-06 17:29:10.843 32420-32420/firstapp.imageslide.imageslide I/dalvikvm﹕ at android.app.ActivityThread.main(ActivityThread.java:4787)
03-06 17:29:10.843 32420-32420/firstapp.imageslide.imageslide I/dalvikvm﹕ at java.lang.reflect.Method.invokeNative(Native Method)
03-06 17:29:10.843 32420-32420/firstapp.imageslide.imageslide I/dalvikvm﹕ at java.lang.reflect.Method.invoke(Method.java:511)
03-06 17:29:10.843 32420-32420/firstapp.imageslide.imageslide I/dalvikvm﹕ at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
03-06 17:29:10.843 32420-32420/firstapp.imageslide.imageslide I/dalvikvm﹕ at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:556)
03-06 17:29:10.843 32420-32420/firstapp.imageslide.imageslide I/dalvikvm﹕ at dalvik.system.NativeStart.main(Native Method)
03-06 17:29:10.843 32420-32420/firstapp.imageslide.imageslide I/dalvikvm﹕ [ 03-06 17:29:10.843 32420:32420 D/skia ]
--- bitmap->allocPixels failed
03-06 17:29:10.893 32420-32420/firstapp.imageslide.imageslide D/AndroidRuntime﹕ Shutting down VM
03-06 17:29:10.893 32420-32420/firstapp.imageslide.imageslide W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0x40c57378)
03-06 17:29:10.893 32420-32420/firstapp.imageslide.imageslide E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to start activity ComponentInfo{firstapp.imageslide.imageslide/firstapp.imageslide.imageslide.MainActivity}: android.view.InflateException: Binary XML file line #74: Error inflating class <unknown>
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2071)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2096)
at android.app.ActivityThread.access$600(ActivityThread.java:138)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1207)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:213)
at android.app.ActivityThread.main(ActivityThread.java:4787)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:556)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.view.InflateException: Binary XML file line #74: Error inflating class <unknown>
at android.view.LayoutInflater.createView(LayoutInflater.java:613)
at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:660)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:685)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:262)
at android.app.Activity.setContentView(Activity.java:1867)
at firstapp.imageslide.imageslide.MainActivity.onCreate(MainActivity.java:38)
at android.app.Activity.performCreate(Activity.java:5008)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2035)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2096)
at android.app.ActivityThread.access$600(ActivityThread.java:138)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1207)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:213)
at android.app.ActivityThread.main(ActivityThread.java:4787)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:556)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
at android.view.LayoutInflater.createView(LayoutInflater.java:587)
at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:660)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:685)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:262)
at android.app.Activity.setContentView(Activity.java:1867)
at firstapp.imageslide.imageslide.MainActivity.onCreate(MainActivity.java:38)
at android.app.Activity.performCreate(Activity.java:5008)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2035)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2096)
at android.app.ActivityThread.access$600(ActivityThread.java:138)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1207)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:213)
at android.app.ActivityThread.main(ActivityThread.java:4787)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:556)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.OutOfMemoryError
at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:500)
at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:353)
at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:785)
at android.content.res.Resources.loadDrawable(Resources.java:1935)
at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
at android.widget.ImageView.<init>(ImageView.java:120)
at android.widget.ImageView.<init>(ImageView.java:110)
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
at android.view.LayoutInflater.createView(LayoutInflater.java:587)
at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:660)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:685)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:262)
at android.app.Activity.setContentView(Activity.java:1867)
at firstapp.imageslide.imageslide.MainActivity.onCreate(MainActivity.java:38)
at android.app.Activity.performCreate(Activity.java:5008)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2035)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2096)
at android.app.ActivityThread.access$600(ActivityThread.java:138)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1207)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:213)
at android.app.ActivityThread.main(ActivityThread.java:4787)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:556)
at dalvik.system.NativeStart.main(Native Method)
03-06 17:29:13.893 32420-32420/firstapp.imageslide.imageslide I/Process﹕ Sending signal. PID: 32420 SIG: 9