android app unfortunately has stopped - java

I had tired to build an android application and I face a problem.
I post my java code, xml and error.
Can someone teach me why it happened and how to solve it? Thanks!
This is what the problem that I face...
10-27 16:35:22.488 21798-21798/com.onemap.activities E/AndroidRuntime: FATAL EXCEPTION: main
10-27 16:35:22.488 21798-21798/com.onemap.activities E/AndroidRuntime: Process: com.onemap.activities, PID: 21798
10-27 16:35:22.488 21798-21798/com.onemap.activities E/AndroidRuntime: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.onemap.activities/com.onemap.activities.OneMap}: android.view.InflateException: Binary XML file line #7: Error inflating class android.widget.TextView
10-27 16:35:22.488 21798-21798/com.onemap.activities E/AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2596)
10-27 16:35:22.488 21798-21798/com.onemap.activities E/AndroidRuntime: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2653)
10-27 16:35:22.488 21798-21798/com.onemap.activities E/AndroidRuntime: at android.app.ActivityThread.access$800(ActivityThread.java:156)
10-27 16:35:22.488 21798-21798/com.onemap.activities E/AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1355)
10-27 16:35:22.488 21798-21798/com.onemap.activities E/AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:102)
10-27 16:35:22.488 21798-21798/com.onemap.activities E/AndroidRuntime: at android.os.Looper.loop(Looper.java:157)
10-27 16:35:22.488 21798-21798/com.onemap.activities E/AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:5872)
10-27 16:35:22.488 21798-21798/com.onemap.activities E/AndroidRuntime: at java.lang.reflect.Method.invokeNative(Native Method)
10-27 16:35:22.488 21798-21798/com.onemap.activities E/AndroidRuntime: at java.lang.reflect.Method.invoke(Method.java:515)
10-27 16:35:22.488 21798-21798/com.onemap.activities E/AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
10-27 16:35:22.488 21798-21798/com.onemap.activities E/AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:674)
10-27 16:35:22.488 21798-21798/com.onemap.activities E/AndroidRuntime: at dalvik.system.NativeStart.main(Native Method)
10-27 16:35:22.488 21798-21798/com.onemap.activities E/AndroidRuntime: Caused by: android.view.InflateException: Binary XML file line #7: Error inflating class android.widget.TextView
10-27 16:35:22.488 21798-21798/com.onemap.activities E/AndroidRuntime: at android.view.LayoutInflater.createView(LayoutInflater.java:620)
10-27 16:35:22.488 21798-21798/com.onemap.activities E/AndroidRuntime: at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
10-27 16:35:22.488 21798-21798/com.onemap.activities E/AndroidRuntime: at android.view.LayoutInflater.onCreateView(LayoutInflater.java:669)
10-27 16:35:22.488 21798-21798/com.onemap.activities E/AndroidRuntime: at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:694)
10-27 16:35:22.488 21798-21798/com.onemap.activities E/AndroidRuntime: at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
10-27 16:35:22.488 21798-21798/com.onemap.activities E/AndroidRuntime: at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
10-27 16:35:22.488 21798-21798/com.onemap.activities E/AndroidRuntime: at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
10-27 16:35:22.488 21798-21798/com.onemap.activities E/AndroidRuntime: at com.onemap.fragments.MainMenu.onCreateView(MainMenu.java:88)
10-27 16:35:22.488 21798-21798/com.onemap.activities E/AndroidRuntime: at android.support.v4.app.Fragment.performCreateView(Fragment.java:1965)
10-27 16:35:22.488 21798-21798/com.onemap.activities E/AndroidRuntime: at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1047)
10-27 16:35:22.488 21798-21798/com.onemap.activities E/AndroidRuntime: at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1237)
10-27 16:35:22.488 21798-21798/com.onemap.activities E/AndroidRuntime: at android.support.v4.app.FragmentManagerImpl.addFragment(FragmentManager.java:1339)
10-27 16:35:22.488 21798-21798/com.onemap.activities E/AndroidRuntime: at android.support.v4.app.FragmentManagerImpl.onCreateView(FragmentManager.java:2295)
10-27 16:35:22.488 21798-21798/com.onemap.activities E/AndroidRuntime: at android.support.v4.app.FragmentController.onCreateView(FragmentController.java:111)
10-27 16:35:22.488 21798-21798/com.onemap.activities E/AndroidRuntime: at android.support.v4.app.FragmentActivity.dispatchFragmentsOnCreateView(FragmentActivity.java:314)
10-27 16:35:22.488 21798-21798/com.onemap.activities E/AndroidRuntime: at android.support.v4.app.BaseFragmentActivityHoneycomb.onCreateView(BaseFragmentActivityHoneycomb.java:31)
10-27 16:35:22.488 21798-21798/com.onemap.activities E/AndroidRuntime: at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:79)
10-27 16:35:22.488 21798-21798/com.onemap.activities E/AndroidRuntime: at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:689)
10-27 16:35:22.488 21798-21798/com.onemap.activities E/AndroidRuntime: at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
10-27 16:35:22.488 21798-21798/com.onemap.activities E/AndroidRuntime: at android.view.LayoutInflater.rInflate(LayoutInflater.java:758)
10-27 16:35:22.488 21798-21798/com.onemap.activities E/AndroidRuntime: at android.view.LayoutInflater.rInflate(LayoutInflater.java:758)
10-27 16:35:22.488 21798-21798/com.onemap.activities E/AndroidRuntime: at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
10-27 16:35:22.488 21798-21798/com.onemap.activities E/AndroidRuntime: at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
10-27 16:35:22.488 21798-21798/com.onemap.activities E/AndroidRuntime: at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
10-27 16:35:22.488 21798-21798/com.onemap.activities E/AndroidRuntime: at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:375)
10-27 16:35:22.488 21798-21798/com.onemap.activities E/AndroidRuntime: at android.app.Activity.setContentView(Activity.java:1997)
10-27 16:35:22.488 21798-21798/com.onemap.activities E/AndroidRuntime: at com.onemap.activities.OneMap.onCreate(OneMap.java:58)
10-27 16:35:22.488 21798-21798/com.onemap.activities E/AndroidRuntime: at android.app.Activity.performCreate(Activity.java:5312)
10-27 16:35:22.488 21798-21798/com.onemap.activities E/AndroidRuntime: at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1111)
Here is my java code and xml
OneMap.java
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.onemap);
AppUtilities.init(this);
pomPref = getSharedPreferences(POM_PREF, MODE_PRIVATE);
pomEditor = pomPref.edit();
favDB = new FavouritesDBHandler(AppUtilities.getContext());
this.mMapView = (MapView) findViewById(R.id.mMapView);
this.mMapView.setOnStatusChangedListener(OneMapStatusListener.getInstance());
this.scrollView = (SlidingMenu) findViewById(R.id.mScrollView);
View mainContent = this.scrollView.getMainContent();
OnClickListener clickListener = getClickListener();
OnLongClickListener longClickListener = getLongClickListener();
mainContent.findViewById(R.id.mScreenToggle).setOnClickListener(clickListener);
JewelContainer jewelContainer = (JewelContainer) mainContent.findViewById(R.id.jewel_container);
jewelContainer.setOnClickListener(clickListener);
jewelContainer.setOnLongClickListener(longClickListener);
this.mMapView.setOnSingleTapListener(getSingleTapListener());
this.mMapView.setOnLongPressListener(getLongPressListener());
this.mMapView.setCalloutClickListener(getClickListener());
this.mMapView.getCallout().setMaxWidth(550);
}
MainMenu.java
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
//super.onCreateView(inflater, container, savedInstanceState);
View view = inflater.inflate(R.layout.menu_main, container, false);
ViewHolder viewHolder = new ViewHolder();
viewHolder.arrowUp = (ImageView) view.findViewById(R.id.iv_arrow_up);
viewHolder.arrowDown = (ImageView) view.findViewById(R.id.iv_arrow_down);
ListView menuList = (ListView) view.findViewById(R.id.menu_list);
menuList.setOnItemClickListener(this);
menuList.setOnScrollListener(this);
menuList.setTag(viewHolder);
MenuItem[] arrayMenuItem = new MenuItem[5];
arrayMenuItem[0] = new MenuItem(0, "Services", R.mipmap.ic_menu_title_service);
arrayMenuItem[1] = new MenuItem(1, getString(R.string.get_directions), R.mipmap.ic_directions);
arrayMenuItem[2] = new MenuItem(2, getString(R.string.amenities), R.mipmap.ic_amenities);
arrayMenuItem[3] = new MenuItem(3, "Others", R.mipmap.ic_menu_title_other);
arrayMenuItem[4] = new MenuItem(4, getString(R.string.about), R.mipmap.ic_about);
menuList.setAdapter(new MenuAdapter(getActivity(), arrayMenuItem));
return view;
}
onemap.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<com.onemap.widgets.MapView
xmlns:callout="http://schemas.android.com/apk/res/com.onemap.activities"
android:id="#id/mMapView"
calloutStyle="#xml/callout_style"
initExtent="29454.233386372267 39831.55546813806 30038.01821247406 40758.313879574656"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
callout:layout="#layout/callout" />
<ProgressBar
android:id="#id/progressBar"
style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:visibility="gone" />
<com.onemap.widgets.SlidingMenu
xmlns:menu="http://schemas.android.com/apk/res/com.onemap.activities"
android:id="#id/mScrollView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scrollbars="none"
menu:main_content="#id/mainContainer"
menu:menu_content="#id/menuContainer"
menu:menu_handle="#id/handle"
menu:menu_marginRight="#dimen/menu_margin_r">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal">
<fragment
android:id="#id/menuContainer"
class="com.onemap.fragments.MainMenu"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:tag="MainMenu"
tools:layout="#layout/menu_main" />
<include
android:id="#id/mainContainer"
layout="#layout/widgets" />
</LinearLayout>
</com.onemap.widgets.SlidingMenu>
</RelativeLayout>
menu_main.xml
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<TextView
android:id="#id/btnSearch"
style="#android:style/TextAppearance.Widget.EditText"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="#dimen/menu_item_margin"
android:background="#drawable/selector_edittext_search"
android:clickable="true"
android:drawableLeft="#mipmap/ic_search"
android:drawablePadding="#dimen/menu_item_icon_padding"
android:gravity="center_vertical"
android:text="#string/search"
android:textColor="#color/selector_edittext_search_text" />
<LinearLayout
android:id="#id/listFooter"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_margin="#dimen/menu_item_margin"
android:gravity="right">
<ImageView
android:id="#id/iv_arrow_up"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="#string/app_name"
android:paddingRight="#dimen/menu_item_icon_padding"
android:src="#mipmap/ic_arrow_up_disabled" />
<ImageView
android:id="#id/iv_arrow_down"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="#string/app_name"
android:paddingLeft="#dimen/menu_item_icon_padding"
android:paddingRight="#dimen/menu_item_icon_padding"
android:src="#mipmap/ic_arrow_down_enabled" />
</LinearLayout>
<ListView
android:id="#id/menu_list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_above="#id/listFooter"
android:layout_below="#id/btnSearch"
android:divider="#null"
android:dividerHeight="0.0dip"
android:fadingEdgeLength="0.0dip" />
</RelativeLayout>

set #+id instead of #id.
android:id="#+id/btnSearch"
for more take it as a reference

Related

How to access a button from in a another layout in a Fragment

i am trying to get a button from another layout in fragment.this fragment have another inflate another layout.i get a java.lang.NullPointerException. how to solve this problem?
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
final View view = inflater.inflate(R.layout.add_to_cart_display, container, false);
myAdapter=new MyAdapter(getActivity());
Button remove=(Button) view.findViewById(R.id.remove_cart_items);
RecyclerView recyclerView=(RecyclerView)view.findViewById(R.id.recyclerView);
recyclerView.setHasFixedSize(true);
ch=new CartHelper(getActivity());
recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
rc=new RCadapter(getDataset());
recyclerView.setAdapter(rc);
return view;
}
from above pgm the remove button not in the add_cart_display xml file. it locate in another layout file. here i am accessing this button.it give the following error.
10-31 12:38:20.484 13886-13886/com.infizoom.infishopping
E/AndroidRuntime: FATAL EXCEPTION: main 10-31 12:38:20.484
13886-13886/com.infizoom.infishopping E/AndroidRuntime: Process:
com.infizoom.infishopping, PID: 13886 10-31 12:38:20.484
13886-13886/com.infizoom.infishopping E/AndroidRuntime:
java.lang.NullPointerException 10-31 12:38:20.484
13886-13886/com.infizoom.infishopping E/AndroidRuntime: at
com.infizoom.infishopping.add_cart_class.onStart(add_cart_class.java:75)
10-31 12:38:20.484 13886-13886/com.infizoom.infishopping
E/AndroidRuntime: at
android.app.Fragment.performStart(Fragment.java:1724) 10-31
12:38:20.484 13886-13886/com.infizoom.infishopping E/AndroidRuntime:
at
android.app.FragmentManagerImpl.moveToState(FragmentManager.java:918)
10-31 12:38:20.484 13886-13886/com.infizoom.infishopping
E/AndroidRuntime: at
android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1062)
10-31 12:38:20.484 13886-13886/com.infizoom.infishopping
E/AndroidRuntime: at
android.app.BackStackRecord.run(BackStackRecord.java:698) 10-31
12:38:20.484 13886-13886/com.infizoom.infishopping E/AndroidRuntime:
at
android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1447)
10-31 12:38:20.484 13886-13886/com.infizoom.infishopping
E/AndroidRuntime: at
android.app.FragmentManagerImpl$1.run(FragmentManager.java:443) 10-31
12:38:20.484 13886-13886/com.infizoom.infishopping E/AndroidRuntime:
at android.os.Handler.handleCallback(Handler.java:808) 10-31
12:38:20.484 13886-13886/com.infizoom.infishopping E/AndroidRuntime:
at android.os.Handler.dispatchMessage(Handler.java:103) 10-31
12:38:20.484 13886-13886/com.infizoom.infishopping E/AndroidRuntime:
at android.os.Looper.loop(Looper.java:193) 10-31 12:38:20.484
13886-13886/com.infizoom.infishopping E/AndroidRuntime: at
android.app.ActivityThread.main(ActivityThread.java:5341) 10-31
12:38:20.484 13886-13886/com.infizoom.infishopping E/AndroidRuntime:
at java.lang.reflect.Method.invokeNative(Native Method) 10-31
12:38:20.484 13886-13886/com.infizoom.infishopping E/AndroidRuntime:
at java.lang.reflect.Method.invoke(Method.java:515) 10-31 12:38:20.484
13886-13886/com.infizoom.infishopping E/AndroidRuntime: at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:825)
10-31 12:38:20.484 13886-13886/com.infizoom.infishopping
E/AndroidRuntime: at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:641) 10-31
12:38:20.484 13886-13886/com.infizoom.infishopping E/AndroidRuntime:
at dalvik.system.NativeStart.main(Native Method)
add_to_cart_display.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_marginTop="#dimen/abc_action_bar_default_height_material"
android:layout_height="match_parent">
<android.support.v7.widget.RecyclerView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/recyclerView"
android:layout_width="fill_parent"
android:layout_height="match_parent"
tools:context=".MainActivity"
/>
Remove Button inside the CardView
final View view = inflater.inflate(R.layout.add_to_cart_display, container, false);
Button remove=(Button) view.findViewById(R.id.remove_cart_items);
you are looking for a Button with id remove_cart_items inside add_to_cart_display. But in layout may be there is no Button with id remove_cart_items. That`s way you get null
I got an answer. i can access the button inside the cardview by recyclerAdapter onBindViewHolder(). but i dnot know how to call toast in side this function.
public static class ViewHolder extends RecyclerView.ViewHolder{
public TextView product_name_at_cart;
public Button remove;
public ViewHolder(View layoutview) {
super(layoutview);
remove =(Button) layoutview.findViewById(R.id.remove_cart_items);
product_name_at_cart=(TextView)layoutview.findViewById(R.id.add_cart_item_name);
}
}
OnBindViewHolder
public void onBindViewHolder(ViewHolder viewholder, int position) {
viewholder.product_name_at_cart.setText(mDataset.get(position).getProduct_name());
viewholder.remove.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
Log.w("gopal", "Gopal btn click");
Cursor m=ch.getcurrent_id();
if(m.moveToFirst()){
do{
int id=m.getInt(5);
Toast.makeText(???????, "Gopal id " + id, Toast.LENGTH_SHORT).show();
}while (m.moveToNext());
}
}
});
}
What function will came in the Toast Msg.????
In RecyclerAdapter, I have defined a private Activity context.
Then, you can call the Toast.makeText(context, "your message", ...),

InflateException Binary XML file at line #7: Error inflating class fragment

I've been doing some research of this problem but no solution has yet to work for me. I've added empty constructors in the fragment classes and tried with different imports of fragments, but nothing seems to work. I hope you guys can help me!
My Activity:
package com.example.com.example.android.rssfeed;
import android.app.Activity;
import android.os.Bundle;
public class RssfeedActivity extends Activity implements MyListFragment.OnItemSelectedListener {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_rssfeed);
}
public void onRssItemSelected(String link) {
DetailFragment fragment = (DetailFragment) getFragmentManager().findFragmentById(R.id.detailFragment);
if (fragment != null && fragment.isInLayout()) {
fragment.setText(link);
}//end if
}//end method onRssItemSelected
}//end class
My fragment:
package com.example.com.example.android.rssfeed;
import android.app.Activity;
import android.os.Bundle;
import android.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
public class MyListFragment extends Fragment {
public MyListFragment() {
}
private OnItemSelectedListener listener;
#Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_rsslist_overview, container, false);
Button button = (Button) view.findViewById(R.id.btn1);
button.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
updateDetail();
}//end onClick
});
return view;
}//end onCreateView
public interface OnItemSelectedListener {
public void onRssItemSelected(String link);
}//end onItemSelectedListener
#Override
public void onAttach(Activity activity) {
super.onAttach(activity);
if (activity instanceof OnItemSelectedListener) {
listener = (OnItemSelectedListener) activity;
} else {
throw new ClassCastException(activity.toString()
+ "Must implement MyListFragment.OnItemSelectedListener");
}//end else
}//end onAttach
//May also be triggered from the activity
public void updateDetail() {
//Create fake data
String newTime = String.valueOf(System.currentTimeMillis());
// Send data to Activity
listener.onRssItemSelected(newTime);
}//end method updateDetail
}//end class
My fragment XML:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:baselineAligned="false"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal" >
<fragment
android:id="#+id/listFragment"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="match_parent"
class="com.example.android.rssfeed.MyListFragment"
android:layout_marginTop="?android:attr/actionBarSize"></fragment>
<fragment
android:id="#+id/detailFragment"
android:layout_width="0dp"
android:layout_weight="2"
android:layout_height="match_parent"
class="com.example.android.rssfeed.DetailFragment"></fragment>
</LinearLayout>
Manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.com.example.android.rssfeed"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="12"
android:targetSdkVersion="19" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.com.example.android.rssfeed.RssfeedActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
Button XML:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<button
android:id="#+id/btn1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Press to Update">
</button>
</LinearLayout>
LogCat error:
05-17 10:35:01.864: E/AndroidRuntime(6384): FATAL EXCEPTION: main
05-17 10:35:01.864: E/AndroidRuntime(6384): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.com.example.android.rssfeed/com.example.com.example.android.rssfeed.RssfeedActivity}: android.view.InflateException: Binary XML file line #7: Error inflating class fragment
05-17 10:35:01.864: E/AndroidRuntime(6384): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2245)
05-17 10:35:01.864: E/AndroidRuntime(6384): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2295)
05-17 10:35:01.864: E/AndroidRuntime(6384): at android.app.ActivityThread.access$700(ActivityThread.java:150)
05-17 10:35:01.864: E/AndroidRuntime(6384): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1280)
05-17 10:35:01.864: E/AndroidRuntime(6384): at android.os.Handler.dispatchMessage(Handler.java:99)
05-17 10:35:01.864: E/AndroidRuntime(6384): at android.os.Looper.loop(Looper.java:137)
05-17 10:35:01.864: E/AndroidRuntime(6384): at android.app.ActivityThread.main(ActivityThread.java:5279)
05-17 10:35:01.864: E/AndroidRuntime(6384): at java.lang.reflect.Method.invokeNative(Native Method)
05-17 10:35:01.864: E/AndroidRuntime(6384): at java.lang.reflect.Method.invoke(Method.java:511)
05-17 10:35:01.864: E/AndroidRuntime(6384): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
05-17 10:35:01.864: E/AndroidRuntime(6384): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
05-17 10:35:01.864: E/AndroidRuntime(6384): at dalvik.system.NativeStart.main(Native Method)
05-17 10:35:01.864: E/AndroidRuntime(6384): Caused by: android.view.InflateException: Binary XML file line #7: Error inflating class fragment
05-17 10:35:01.864: E/AndroidRuntime(6384): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:710)
05-17 10:35:01.864: E/AndroidRuntime(6384): at android.view.LayoutInflater.rInflate(LayoutInflater.java:752)
05-17 10:35:01.864: E/AndroidRuntime(6384): at android.view.LayoutInflater.inflate(LayoutInflater.java:495)
05-17 10:35:01.864: E/AndroidRuntime(6384): at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
05-17 10:35:01.864: E/AndroidRuntime(6384): at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
05-17 10:35:01.864: E/AndroidRuntime(6384): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:342)
05-17 10:35:01.864: E/AndroidRuntime(6384): at android.app.Activity.setContentView(Activity.java:1928)
05-17 10:35:01.864: E/AndroidRuntime(6384): at com.example.com.example.android.rssfeed.RssfeedActivity.onCreate(RssfeedActivity.java:11)
05-17 10:35:01.864: E/AndroidRuntime(6384): at android.app.Activity.performCreate(Activity.java:5267)
05-17 10:35:01.864: E/AndroidRuntime(6384): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1097)
05-17 10:35:01.864: E/AndroidRuntime(6384): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2209)
05-17 10:35:01.864: E/AndroidRuntime(6384): ... 11 more
05-17 10:35:01.864: E/AndroidRuntime(6384): Caused by: android.app.Fragment$InstantiationException: Unable to instantiate fragment com.example.android.rssfeed.MyListFragment: make sure class name exists, is public, and has an empty constructor that is public
05-17 10:35:01.864: E/AndroidRuntime(6384): at android.app.Fragment.instantiate(Fragment.java:592)
05-17 10:35:01.864: E/AndroidRuntime(6384): at android.app.Fragment.instantiate(Fragment.java:560)
05-17 10:35:01.864: E/AndroidRuntime(6384): at android.app.Activity.onCreateView(Activity.java:4862)
05-17 10:35:01.864: E/AndroidRuntime(6384): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:686)
05-17 10:35:01.864: E/AndroidRuntime(6384): ... 21 more
05-17 10:35:01.864: E/AndroidRuntime(6384): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.example.android.rssfeed.MyListFragment" on path: /data/app/com.example.com.example.android.rssfeed-1.apk
05-17 10:35:01.864: E/AndroidRuntime(6384): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65)
05-17 10:35:01.864: E/AndroidRuntime(6384): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
05-17 10:35:01.864: E/AndroidRuntime(6384): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
05-17 10:35:01.864: E/AndroidRuntime(6384): at android.app.Fragment.instantiate(Fragment.java:582)
05-17 10:35:01.864: E/AndroidRuntime(6384): ... 24 more
Caused by: java.lang.ClassNotFoundException: Didn't find class
"com.example.android.rssfeed.MyListFragment" on path:
/data/app/com.example.com.example.android.rssfeed-1.apk
Change this
class="com.example.android.rssfeed.MyListFragment"
to
class="com.example.com.example.android.rssfeed.MyListFragment"
cause the packagename is package com.example.com.example.android.rssfeed.
Similarly
class="com.example.com.example.android.rssfeed.DetailFragment"
if the package name is the same
Change this
<button
android:id="#+id/btn1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Press to Update">
To
<Button
android:id="#+id/btn1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Press to Update" />
Change
"class= com.example.android.rssfeed.MyListFragment"
to
"com.example.com.example.android.rssfeed.MyListFragment"
And your problem will be solved out
Add this line in fragment
class="com.google.android.gms.maps.SupportMapFragment"

Android application keep crashing

in the last few days I tried to develop android applications with no success, for some reason my application keep crashing.
the application keeps throwing few exceptions that I didn't succeeded to handle with.
MainActivity.java :
package com.mobIce.digicoin.digitalcoin;
import android.support.v7.app.ActionBarActivity;
import android.support.v7.app.ActionBar;
import android.support.v4.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.os.Build;
import android.widget.ArrayAdapter;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.TextView;
import java.util.ArrayList;
import java.util.List;
public class MainActivity extends ActionBarActivity {
private List<Coin> coins;
public MainActivity(){
coins = new ArrayList<Coin>();
}
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
if (savedInstanceState == null) {
getSupportFragmentManager().beginTransaction()
.add(R.id.container, new PlaceholderFragment())
.commit();
populateCoins();
populateListView();
}
}
private void populateCoins() {
coins.add(new Coin("Bitcoin", "650", "4", "http://coinmarketcap.com/img/Bitcoin.png"));
coins.add(new Coin("Dogecoin", "100", "400", "http://coinmarketcap.com/img/Bitcoin.png"));
coins.add(new Coin("fafaf", "8065", "400", "http://coinmarketcap.com/img/Bitcoin.png"));
}
private void populateListView() {
ArrayAdapter<Coin> adapter = new MyListAdapter();
ListView list = (ListView) findViewById(R.id.coinsListView);
list.setAdapter(adapter);
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, 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();
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
/**
* A placeholder fragment containing a simple view.
*/
public static class PlaceholderFragment extends Fragment {
public PlaceholderFragment() {
}
#Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_main, container, false);
return rootView;
}
}
private class MyListAdapter extends ArrayAdapter<Coin> {
public MyListAdapter()
{
super(MainActivity.this, R.layout.coin_layout, coins);
}
#Override
public View getView(int position, View convertView, ViewGroup parent){
View itemView = convertView;
if(itemView == null)
itemView = getLayoutInflater().inflate(R.layout.coin_layout, parent, false);
//find the coin to work with.
Coin currentCoin = coins.get(position);
//fill the view
try{
TextView coinName = (TextView) itemView.findViewById(R.id.coinName);
coinName.setText(currentCoin.getName());
TextView coinPrice = (TextView) itemView.findViewById(R.id.coinPrice);
coinPrice.setText(currentCoin.getPrice());
TextView coinPercentage = (TextView) itemView.findViewById(R.id.coinPercentage);
coinPercentage.setText(currentCoin.getPercentage());
}
catch (NullPointerException e){ }
return itemView;
}
}
}
activity_main.xml:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.mobIce.digicoin.digitalcoin.MainActivity"
tools:ignore="MergeRootFrame" />
fragment_main.xml:
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android">
<ListView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/coinsListView"
android:paddingLeft="30dp" />
</LinearLayout>
coin_layout.xml:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_height="match_parent"
android:padding="8dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="coinName"
android:id="#+id/coinName"
android:layout_alignParentTop="true"
android:layout_toRightOf="#+id/coinIcon"
android:layout_marginTop="35dp"
android:layout_marginLeft="20dp" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/coinIcon"
android:maxHeight="80dp"
android:maxWidth="80dp"
android:minHeight="80dp"
android:minWidth="80dp"
android:src="#drawable/dogecoin"
android:longClickable="false"
android:focusable="false"
android:focusableInTouchMode="false"
android:baselineAlignBottom="false"
android:clickable="false"
android:adjustViewBounds="true"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Large Text"
android:id="#+id/coinPrice"
android:layout_marginLeft="35dp"
android:layout_alignTop="#+id/coinIcon"
android:layout_toRightOf="#+id/coinName"
android:layout_marginTop="25dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Medium Text"
android:id="#+id/coinPercentage"
android:layout_below="#+id/coinPrice"
android:layout_alignLeft="#+id/coinPrice"
android:layout_alignStart="#+id/coinPrice" />
</RelativeLayout>
logcat trace:
03-17 08:59:33.977 1107-1107/com.mobIce.digicoin.digitalcoin D/AndroidRuntime﹕ Shutting down VM
03-17 08:59:33.977 1107-1107/com.mobIce.digicoin.digitalcoin W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0xb1a38ba8)
03-17 08:59:33.987 1107-1107/com.mobIce.digicoin.digitalcoin E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.mobIce.digicoin.digitalcoin, PID: 1107
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mobIce.digicoin.digitalcoin/com.mobIce.digicoin.digitalcoin.MainActivity}: 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.mobIce.digicoin.digitalcoin.MainActivity.populateListView(MainActivity.java:47)
at com.mobIce.digicoin.digitalcoin.MainActivity.onCreate(MainActivity.java:36)
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)
03-17 09:04:09.857 1149-1149/com.mobIce.digicoin.digitalcoin D/AndroidRuntime﹕ Shutting down VM
03-17 09:04:09.857 1149-1149/com.mobIce.digicoin.digitalcoin W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0xb1a38ba8)
03-17 09:04:09.867 1149-1149/com.mobIce.digicoin.digitalcoin E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.mobIce.digicoin.digitalcoin, PID: 1149
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mobIce.digicoin.digitalcoin/com.mobIce.digicoin.digitalcoin.MainActivity}: 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.mobIce.digicoin.digitalcoin.MainActivity.populateListView(MainActivity.java:50)
at com.mobIce.digicoin.digitalcoin.MainActivity.onCreate(MainActivity.java:39)
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)
03-17 09:06:36.697 1192-1192/com.mobIce.digicoin.digitalcoin D/AndroidRuntime﹕ Shutting down VM
03-17 09:06:36.697 1192-1192/com.mobIce.digicoin.digitalcoin W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0xb1a38ba8)
03-17 09:06:36.717 1192-1192/com.mobIce.digicoin.digitalcoin E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.mobIce.digicoin.digitalcoin, PID: 1192
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mobIce.digicoin.digitalcoin/com.mobIce.digicoin.digitalcoin.MainActivity}: 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.mobIce.digicoin.digitalcoin.MainActivity.populateListView(MainActivity.java:50)
at com.mobIce.digicoin.digitalcoin.MainActivity.onCreate(MainActivity.java:39)
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)
03-17 09:13:38.647 1239-1239/com.mobIce.digicoin.digitalcoin D/AndroidRuntime﹕ Shutting down VM
03-17 09:13:38.647 1239-1239/com.mobIce.digicoin.digitalcoin W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0xb1a38ba8)
03-17 09:13:38.747 1239-1239/com.mobIce.digicoin.digitalcoin E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.mobIce.digicoin.digitalcoin, PID: 1239
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mobIce.digicoin.digitalcoin/com.mobIce.digicoin.digitalcoin.MainActivity}: 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.mobIce.digicoin.digitalcoin.MainActivity.populateListView(MainActivity.java:50)
at com.mobIce.digicoin.digitalcoin.MainActivity.onCreate(MainActivity.java:37)
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)
03-17 09:13:45.127 1239-1239/com.mobIce.digicoin.digitalcoin I/Process﹕ Sending signal. PID: 1239 SIG: 9
03-17 09:19:34.847 1285-1285/com.mobIce.digicoin.digitalcoin D/AndroidRuntime﹕ Shutting down VM
03-17 09:19:34.847 1285-1285/com.mobIce.digicoin.digitalcoin W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0xb1a38ba8)
03-17 09:19:34.857 1285-1285/com.mobIce.digicoin.digitalcoin E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.mobIce.digicoin.digitalcoin, PID: 1285
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mobIce.digicoin.digitalcoin/com.mobIce.digicoin.digitalcoin.MainActivity}: 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.mobIce.digicoin.digitalcoin.MainActivity.populateListView(MainActivity.java:50)
at com.mobIce.digicoin.digitalcoin.MainActivity.onCreate(MainActivity.java:37)
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)
03-17 09:20:11.987 1285-1285/com.mobIce.digicoin.digitalcoin I/Process﹕ Sending signal. PID: 1285 SIG: 9
Your coinsListView is in the fragment layout and not in activity layout. You cannot access it with findViewById() in populateListView() called from activity onCreate(). Instead, move the list view population to the fragment's onCreateView() after the inflation, calling findViewById() on the rootView layout you just inflated.

Twitter search method using Twitter4J

I am doing an application where u write a word, a new activity opens up then all the tweets SHOULD show up, but i'm getting an error.
I am calling the method printTweets inside the main of the new activity:
And don't worry all my credentials work, i have tried the code on a java application ( not android) and it worked fine and I was getting results.
This is my code:
public void printTweets(String q) {
LinearLayout layout = new LinearLayout(this);
setContentView(layout);
layout.setOrientation(LinearLayout.VERTICAL);
ConfigurationBuilder cb = new ConfigurationBuilder();
cb.setDebugEnabled(true)
.setOAuthConsumerKey("xxxxx")
.setOAuthConsumerSecret("xxxxxx")
.setOAuthAccessToken("xxxxxx")
.setOAuthAccessTokenSecret("xxxxx");
TwitterFactory tf = new TwitterFactory(cb.build());
Twitter twitter = tf.getInstance();
Query query = new Query(q);
QueryResult result = null;
do{
try {
result = twitter.search(query);
} catch (TwitterException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
List<Status> tweets = result.getTweets();
for (Status tweet : tweets) {
TextView tv=new TextView(getApplicationContext());
tv.setText("#" + tweet.getUser().getScreenName() + ":" + tweet.getText());
layout.addView(tv);
}
} while ((query = result.nextQuery()) != null);
}
This is my error:
11-15 01:07:30.890: E/AndroidRuntime(12926): FATAL EXCEPTION: main
11-15 01:07:30.890: E/AndroidRuntime(12926): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.sentimentmining/com.example.sentimentmining.DisplayResults}: android.os.NetworkOnMainThreadException
11-15 01:07:30.890: E/AndroidRuntime(12926): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1970)
11-15 01:07:30.890: E/AndroidRuntime(12926): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1995)
11-15 01:07:30.890: E/AndroidRuntime(12926): at android.app.ActivityThread.access$600(ActivityThread.java:128)
11-15 01:07:30.890: E/AndroidRuntime(12926): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1161)
11-15 01:07:30.890: E/AndroidRuntime(12926): at android.os.Handler.dispatchMessage(Handler.java:99)
11-15 01:07:30.890: E/AndroidRuntime(12926): at android.os.Looper.loop(Looper.java:137)
11-15 01:07:30.890: E/AndroidRuntime(12926): at android.app.ActivityThread.main(ActivityThread.java:4514)
11-15 01:07:30.890: E/AndroidRuntime(12926): at java.lang.reflect.Method.invokeNative(Native Method)
11-15 01:07:30.890: E/AndroidRuntime(12926): at java.lang.reflect.Method.invoke(Method.java:511)
11-15 01:07:30.890: E/AndroidRuntime(12926): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790)
11-15 01:07:30.890: E/AndroidRuntime(12926): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
11-15 01:07:30.890: E/AndroidRuntime(12926): at dalvik.system.NativeStart.main(Native Method)
11-15 01:07:30.890: E/AndroidRuntime(12926): Caused by: android.os.NetworkOnMainThreadException
11-15 01:07:30.890: E/AndroidRuntime(12926): at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1099)
11-15 01:07:30.890: E/AndroidRuntime(12926): at java.net.InetAddress.lookupHostByName(InetAddress.java:391)
11-15 01:07:30.890: E/AndroidRuntime(12926): at java.net.InetAddress.getAllByNameImpl(InetAddress.java:242)
11-15 01:07:30.890: E/AndroidRuntime(12926): at java.net.InetAddress.getAllByName(InetAddress.java:220)
11-15 01:07:30.890: E/AndroidRuntime(12926): at libcore.net.http.HttpConnection.(HttpConnection.java:71)
11-15 01:07:30.890: E/AndroidRuntime(12926): at libcore.net.http.HttpConnection.(HttpConnection.java:50)
11-15 01:07:30.890: E/AndroidRuntime(12926): at libcore.net.http.HttpConnection$Address.connect(HttpConnection.java:351)
11-15 01:07:30.890: E/AndroidRuntime(12926): at libcore.net.http.HttpConnectionPool.get(HttpConnectionPool.java:86)
11-15 01:07:30.890: E/AndroidRuntime(12926): at libcore.net.http.HttpConnection.connect(HttpConnection.java:128)
11-15 01:07:30.890: E/AndroidRuntime(12926): at libcore.net.http.HttpEngine.openSocketConnection(HttpEngine.java:308)
11-15 01:07:30.890: E/AndroidRuntime(12926): at libcore.net.http.HttpsURLConnectionImpl$HttpsEngine.makeSslConnection(HttpsURLConnectionImpl.java:460)
11-15 01:07:30.890: E/AndroidRuntime(12926): at libcore.net.http.HttpsURLConnectionImpl$HttpsEngine.connect(HttpsURLConnectionImpl.java:432)
11-15 01:07:30.890: E/AndroidRuntime(12926): at libcore.net.http.HttpEngine.sendSocketRequest(HttpEngine.java:282)
11-15 01:07:30.890: E/AndroidRuntime(12926): at libcore.net.http.HttpEngine.sendRequest(HttpEngine.java:232)
11-15 01:07:30.890: E/AndroidRuntime(12926): at libcore.net.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:273)
11-15 01:07:30.890: E/AndroidRuntime(12926): at libcore.net.http.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:479)
11-15 01:07:30.890: E/AndroidRuntime(12926): at libcore.net.http.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:133)
11-15 01:07:30.890: E/AndroidRuntime(12926): at twitter4j.internal.http.HttpResponseImpl.(HttpResponseImpl.java:34)
11-15 01:07:30.890: E/AndroidRuntime(12926): at twitter4j.internal.http.HttpClientImpl.request(HttpClientImpl.java:141)
11-15 01:07:30.890: E/AndroidRuntime(12926): at twitter4j.internal.http.HttpClientWrapper.request(HttpClientWrapper.java:61)
11-15 01:07:30.890: E/AndroidRuntime(12926): at twitter4j.internal.http.HttpClientWrapper.get(HttpClientWrapper.java:81)
11-15 01:07:30.890: E/AndroidRuntime(12926): at twitter4j.TwitterImpl.get(TwitterImpl.java:1929)
11-15 01:07:30.890: E/AndroidRuntime(12926): at twitter4j.TwitterImpl.search(TwitterImpl.java:306)
11-15 01:07:30.890: E/AndroidRuntime(12926): at com.example.sentimentmining.DisplayResults.printTweets(DisplayResults.java:83)
11-15 01:07:30.890: E/AndroidRuntime(12926): at com.example.sentimentmining.DisplayResults.onCreate(DisplayResults.java:34)
11-15 01:07:30.890: E/AndroidRuntime(12926): at android.app.Activity.performCreate(Activity.java:4465)
11-15 01:07:30.890: E/AndroidRuntime(12926): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1053)
11-15 01:07:30.890: E/AndroidRuntime(12926): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1934)
11-15 01:07:30.890: E/AndroidRuntime(12926): ... 11 more
If you need anything more please tell me and I will give it to you
NetworkOnMainThreadException
set this permission in manifest
<uses-permission android:name="android.permission.INTERNET" />
Use asyntask
The reason why you are getting this exception is because you are attempting to perform an expensive operation on the UI thread, which can significantly slow your app down and cause it to force close. You should wrap your code in an AsyncTask (or Thread) instead.
or
use this before doing network operations
if (android.os.Build.VERSION.SDK_INT > 9) {
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder()
.permitAll().build();
StrictMode.setThreadPolicy(policy);
}

Java app crashes (NullPointerException)

i'm just programming a password manager but every time I run it, it crashed in cause of NullPointerException. I checked the code but i'm a new developer. Someone here who knows why? :(
Code of MainActivity.java:
package de.lennartschoch.passwordmanager;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
public class MainActivity extends Activity {
Button login;
EditText masterpassfield;
static String masterpass;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
login = (Button) findViewById(R.id.login);
masterpass = "";
masterpassfield = (EditText) findViewById(R.id.masterpass);
if(masterpass.equals("")) {
Intent intent = new Intent(this,NewMasterpass.class);
startActivity(intent);
return;
}
login.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View view) {
if(masterpassfield.getText().toString().equals(masterpass)) {
Intent success = new Intent(view.getContext(), Passwords.class);
startActivityForResult(success, 0);
}
}});
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.activity_main, menu);
return true;
}
}
Code of NewMasterpass.java:
package de.lennartschoch.passwordmanager;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
public class NewMasterpass extends Activity {
EditText masterpasscreate;
EditText repeat;
Button finish;
TextView mistake;
/** Called when the activity is first created. */
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_new_masterpass);
masterpasscreate = (EditText) findViewById(R.id.masterpasscreate);
repeat = (EditText) findViewById(R.id.repeatcreate);
finish = (Button) findViewById(R.id.finish);
mistake = (TextView) findViewById(R.id.mistake);
finish.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View view) {
if(!masterpasscreate.getText().toString().equals(repeat.getText().toString())) {
mistake.setText("The passwords are different.");
mistake.setTextColor(Color.RED);
}
else if(masterpasscreate.getText().toString().equals("") || repeat.getText().toString().equals("")) {
mistake.setText("Both textfields must be filled in");
mistake.setTextColor(Color.RED);
}
else {
MainActivity.masterpass = masterpasscreate.getText().toString();
Intent myIntent = new Intent(view.getContext(), MainActivity.class);
startActivityForResult(myIntent, 0);
}
}});
}
}
LogCat error:
01-20 17:17:52.629: D/AndroidRuntime(561): Shutting down VM
01-20 17:17:52.629: W/dalvikvm(561): threadid=1: thread exiting with uncaught exception (group=0x409961f8)
01-20 17:17:52.639: E/AndroidRuntime(561): FATAL EXCEPTION: main
01-20 17:17:52.639: E/AndroidRuntime(561): java.lang.RuntimeException: Unable to start activity ComponentInfo{de.lennartschoch.passwordmanager/de.lennartschoch.passwordmanager.MainActivit y}: java.lang.NullPointerException
01-20 17:17:52.639: E/AndroidRuntime(561): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1955)
01-20 17:17:52.639: E/AndroidRuntime(561): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1980)
01-20 17:17:52.639: E/AndroidRuntime(561): at android.app.ActivityThread.access$600(ActivityThread.java:122)
01-20 17:17:52.639: E/AndroidRuntime(561): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1146)
01-20 17:17:52.639: E/AndroidRuntime(561): at android.os.Handler.dispatchMessage(Handler.java:99)
01-20 17:17:52.639: E/AndroidRuntime(561): at android.os.Looper.loop(Looper.java:137)
01-20 17:17:52.639: E/AndroidRuntime(561): at android.app.ActivityThread.main(ActivityThread.java:4340)
01-20 17:17:52.639: E/AndroidRuntime(561): at java.lang.reflect.Method.invokeNative(Native Method)
01-20 17:17:52.639: E/AndroidRuntime(561): at java.lang.reflect.Method.invoke(Method.java:511)
01-20 17:17:52.639: E/AndroidRuntime(561): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
01-20 17:17:52.639: E/AndroidRuntime(561): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
01-20 17:17:52.639: E/AndroidRuntime(561): at dalvik.system.NativeStart.main(Native Method)
01-20 17:17:52.639: E/AndroidRuntime(561): Caused by: java.lang.NullPointerException
01-20 17:17:52.639: E/AndroidRuntime(561): at de.lennartschoch.passwordmanager.MainActivity.onCreate(MainActivity.java:26)
01-20 17:17:52.639: E/AndroidRuntime(561): at android.app.Activity.performCreate(Activity.java:4465)
01-20 17:17:52.639: E/AndroidRuntime(561): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
01-20 17:17:52.639: E/AndroidRuntime(561): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1919)
01-20 17:17:52.639: E/AndroidRuntime(561): ... 11 more
01-20 17:17:57.129: I/Process(561): Sending signal. PID: 561 SIG: 9
01-20 17:21:37.499: D/AndroidRuntime(608): Shutting down VM
01-20 17:21:37.499: W/dalvikvm(608): threadid=1: thread exiting with uncaught exception (group=0x409961f8)
01-20 17:21:37.511: E/AndroidRuntime(608): FATAL EXCEPTION: main
01-20 17:21:37.511: E/AndroidRuntime(608): java.lang.RuntimeException: Unable to start activity ComponentInfo{de.lennartschoch.passwordmanager/de.lennartschoch.passwordmanager.MainActivity}: android.content.ActivityNotFoundException: Unable to find explicit activity class {de.lennartschoch.passwordmanager/de.lennartschoch.passwordmanager.NewMasterpass}; have you declared this activity in your AndroidManifest.xml?
01-20 17:21:37.511: E/AndroidRuntime(608): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1955)
01-20 17:21:37.511: E/AndroidRuntime(608): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1980)
01-20 17:21:37.511: E/AndroidRuntime(608): at android.app.ActivityThread.access$600(ActivityThread.java:122)
01-20 17:21:37.511: E/AndroidRuntime(608): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1146)
01-20 17:21:37.511: E/AndroidRuntime(608): at android.os.Handler.dispatchMessage(Handler.java:99)
01-20 17:21:37.511: E/AndroidRuntime(608): at android.os.Looper.loop(Looper.java:137)
01-20 17:21:37.511: E/AndroidRuntime(608): at android.app.ActivityThread.main(ActivityThread.java:4340)
01-20 17:21:37.511: E/AndroidRuntime(608): at java.lang.reflect.Method.invokeNative(Native Method)
01-20 17:21:37.511: E/AndroidRuntime(608): at java.lang.reflect.Method.invoke(Method.java:511)
01-20 17:21:37.511: E/AndroidRuntime(608): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
01-20 17:21:37.511: E/AndroidRuntime(608): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
01-20 17:21:37.511: E/AndroidRuntime(608): at dalvik.system.NativeStart.main(Native Method)
01-20 17:21:37.511: E/AndroidRuntime(608): Caused by: android.content.ActivityNotFoundException: Unable to find explicit activity class {de.lennartschoch.passwordmanager/de.lennartschoch.passwordmanager.NewMasterpass}; have you declared this activity in your AndroidManifest.xml?
01-20 17:21:37.511: E/AndroidRuntime(608): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1508)
01-20 17:21:37.511: E/AndroidRuntime(608): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1384)
01-20 17:21:37.511: E/AndroidRuntime(608): at android.app.Activity.startActivityForResult(Activity.java:3190)
01-20 17:21:37.511: E/AndroidRuntime(608): at android.app.Activity.startActivity(Activity.java:3297)
01-20 17:21:37.511: E/AndroidRuntime(608): at de.lennartschoch.passwordmanager.MainActivity.onCreate(MainActivity.java:30)
01-20 17:21:37.511: E/AndroidRuntime(608): at android.app.Activity.performCreate(Activity.java:4465)
01-20 17:21:37.511: E/AndroidRuntime(608): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
01-20 17:21:37.511: E/AndroidRuntime(608): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1919)
01-20 17:21:37.511: E/AndroidRuntime(608): ... 11 more
01-20 17:22:30.769: D/AndroidRuntime(655): Shutting down VM
01-20 17:22:30.769: W/dalvikvm(655): threadid=1: thread exiting with uncaught exception (group=0x409961f8)
01-20 17:22:30.779: E/AndroidRuntime(655): FATAL EXCEPTION: main
01-20 17:22:30.779: E/AndroidRuntime(655): java.lang.RuntimeException: Unable to start activity ComponentInfo{de.lennartschoch.passwordmanager/de.lennartschoch.passwordmanager.MainActivity}: android.content.ActivityNotFoundException: Unable to find explicit activity class {de.lennartschoch.passwordmanager/de.lennartschoch.passwordmanager.NewMasterpass}; have you declared this activity in your AndroidManifest.xml?
01-20 17:22:30.779: E/AndroidRuntime(655): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1955)
01-20 17:22:30.779: E/AndroidRuntime(655): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1980)
01-20 17:22:30.779: E/AndroidRuntime(655): at android.app.ActivityThread.access$600(ActivityThread.java:122)
01-20 17:22:30.779: E/AndroidRuntime(655): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1146)
01-20 17:22:30.779: E/AndroidRuntime(655): at android.os.Handler.dispatchMessage(Handler.java:99)
01-20 17:22:30.779: E/AndroidRuntime(655): at android.os.Looper.loop(Looper.java:137)
01-20 17:22:30.779: E/AndroidRuntime(655): at android.app.ActivityThread.main(ActivityThread.java:4340)
01-20 17:22:30.779: E/AndroidRuntime(655): at java.lang.reflect.Method.invokeNative(Native Method)
01-20 17:22:30.779: E/AndroidRuntime(655): at java.lang.reflect.Method.invoke(Method.java:511)
01-20 17:22:30.779: E/AndroidRuntime(655): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
01-20 17:22:30.779: E/AndroidRuntime(655): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
01-20 17:22:30.779: E/AndroidRuntime(655): at dalvik.system.NativeStart.main(Native Method)
01-20 17:22:30.779: E/AndroidRuntime(655): Caused by: android.content.ActivityNotFoundException: Unable to find explicit activity class {de.lennartschoch.passwordmanager/de.lennartschoch.passwordmanager.NewMasterpass}; have you declared this activity in your AndroidManifest.xml?
01-20 17:22:30.779: E/AndroidRuntime(655): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1508)
01-20 17:22:30.779: E/AndroidRuntime(655): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1384)
01-20 17:22:30.779: E/AndroidRuntime(655): at android.app.Activity.startActivityForResult(Activity.java:3190)
01-20 17:22:30.779: E/AndroidRuntime(655): at android.app.Activity.startActivity(Activity.java:3297)
01-20 17:22:30.779: E/AndroidRuntime(655): at de.lennartschoch.passwordmanager.MainActivity.onCreate(MainActivity.java:30)
01-20 17:22:30.779: E/AndroidRuntime(655): at android.app.Activity.performCreate(Activity.java:4465)
01-20 17:22:30.779: E/AndroidRuntime(655): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
01-20 17:22:30.779: E/AndroidRuntime(655): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1919)
01-20 17:22:30.779: E/AndroidRuntime(655): ... 11 more
01-20 17:22:33.180: I/Process(655): Sending signal. PID: 655 SIG: 9
It asks:
01-20 17:22:30.779: E/AndroidRuntime(655): java.lang.RuntimeException: Unable to start activity ComponentInfo{de.lennartschoch.passwordmanager/de.lennartschoch.passwordmanager.MainActivity}: android.content.ActivityNotFoundException: Unable to find explicit activity class {de.lennartschoch.passwordmanager/de.lennartschoch.passwordmanager.NewMasterpass};
have you declared this activity in your AndroidManifest.xml?
Have you?
Declare the NewMasterPass activity in your manifest xml as clearly mentioned in the logcat!
Try to add this to your AndroidManifest.xml
<activity android:name="de.lennartschoch.passwordmanager.NewMasterpass" />

Categories