Showing fragment inside popup window - android

I'm working on showing fragment inside popup window. But I'm getting error in showing in that. I googled it for solution. But still not solving this one. Please help me. I'm new to android. My code is
MainActivity.java
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
View popUp = getLayoutInflater().inflate(R.layout.popup_item, null);
window = new PopupWindow(getApplicationContext());
window = new PopupWindow(popUp,LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT,true);
window.setAnimationStyle(android.R.style.Animation_Activity);
window.showAtLocation(popUp, Gravity.BOTTOM, 0, 0);
window.setFocusable(true);
window.setOutsideTouchable(true);
}
popupitem.xml //for showing fragment in MainActivity
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<fragment
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:id="#+id/popup_fragment"
android:name="com.example.popupemoji.PopupFragment"
android:tag=""/>
</LinearLayout>
I have a class extending Fragment with only two line of code on onCreateView
View view = inflater.inflate(R.layout.popup_item, container);
return view;
Am I wrong anywhere. Logcat error is
01-23 14:25:24.005: E/AndroidRuntime(2868): FATAL EXCEPTION: main
01-23 14:25:24.005: E/AndroidRuntime(2868): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.popupemoji/com.example.popupemoji.MainActivity}: android.view.InflateException: Binary XML file line #6: Error inflating class fragment
01-23 14:25:24.005: E/AndroidRuntime(2868): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
01-23 14:25:24.005: E/AndroidRuntime(2868): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
01-23 14:25:24.005: E/AndroidRuntime(2868): at android.app.ActivityThread.access$600(ActivityThread.java:141)
01-23 14:25:24.005: E/AndroidRuntime(2868): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
01-23 14:25:24.005: E/AndroidRuntime(2868): at android.os.Handler.dispatchMessage(Handler.java:99)
01-23 14:25:24.005: E/AndroidRuntime(2868): at android.os.Looper.loop(Looper.java:137)
01-23 14:25:24.005: E/AndroidRuntime(2868): at android.app.ActivityThread.main(ActivityThread.java:5041)
01-23 14:25:24.005: E/AndroidRuntime(2868): at java.lang.reflect.Method.invokeNative(Native Method)
01-23 14:25:24.005: E/AndroidRuntime(2868): at java.lang.reflect.Method.invoke(Method.java:511)
01-23 14:25:24.005: E/AndroidRuntime(2868): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
01-23 14:25:24.005: E/AndroidRuntime(2868): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
01-23 14:25:24.005: E/AndroidRuntime(2868): at dalvik.system.NativeStart.main(Native Method)
01-23 14:25:24.005: E/AndroidRuntime(2868): Caused by: android.view.InflateException: Binary XML file line #6: Error inflating class fragment
01-23 14:25:24.005: E/AndroidRuntime(2868): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
01-23 14:25:24.005: E/AndroidRuntime(2868): at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
01-23 14:25:24.005: E/AndroidRuntime(2868): at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
01-23 14:25:24.005: E/AndroidRuntime(2868): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
01-23 14:25:24.005: E/AndroidRuntime(2868): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
01-23 14:25:24.005: E/AndroidRuntime(2868): at com.example.popupemoji.PopupFragment.onCreateView(PopupFragment.java:15)
01-23 14:25:24.005: E/AndroidRuntime(2868): at android.support.v4.app.Fragment.performCreateView(Fragment.java:1500)
01-23 14:25:24.005: E/AndroidRuntime(2868): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:900)
01-23 14:25:24.005: E/AndroidRuntime(2868): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1082)
01-23 14:25:24.005: E/AndroidRuntime(2868): at android.support.v4.app.FragmentManagerImpl.addFragment(FragmentManager.java:1184)
01-23 14:25:24.005: E/AndroidRuntime(2868): at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:291)
01-23 14:25:24.005: E/AndroidRuntime(2868): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:676)
01-23 14:25:24.005: E/AndroidRuntime(2868): at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
01-23 14:25:24.005: E/AndroidRuntime(2868): at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
01-23 14:25:24.005: E/AndroidRuntime(2868): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
01-23 14:25:24.005: E/AndroidRuntime(2868): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
01-23 14:25:24.005: E/AndroidRuntime(2868): at com.example.popupemoji.MainActivity.onCreate(MainActivity.java:18)
01-23 14:25:24.005: E/AndroidRuntime(2868): at android.app.Activity.performCreate(Activity.java:5104)
01-23 14:25:24.005: E/AndroidRuntime(2868): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
01-23 14:25:24.005: E/AndroidRuntime(2868): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
01-23 14:25:24.005: E/AndroidRuntime(2868): ... 11 more
01-23 14:25:24.005: E/AndroidRuntime(2868): Caused by: java.lang.IllegalArgumentException: Binary XML file line #6: Duplicate id 0x7f080002, tag , or parent id 0x0 with another fragment for com.example.popupemoji.PopupFragment
01-23 14:25:24.005: E/AndroidRuntime(2868): at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:296)
01-23 14:25:24.005: E/AndroidRuntime(2868): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:676)

If I am reading your code correctly, you are creating a View by inflating your popup_item.xml layout. This layout contains a Fragment, which also inflates the popup_item.xml.
Thus that Fragment will also have another Fragment inside of it with the popup_item.xml layout, and this will keep going on indefinitely.
Your error shows that the application is crashing because of this:
Caused by: java.lang.IllegalArgumentException: Binary XML file line #6:
Duplicate id 0x7f080002, tag , or parent id 0x0 with another fragment
for com.example.popupemoji.PopupFragment
Because of this popup_item.xml nesting, multiple Views have the same ID, which is a problem. Even if multiple Views could have the same ID, you would have an infinitely nesting Fragment, which would also be a problem.

Related

Sound board with ImageButtons

I'm trying to make a sound board but I'm getting this error.
I might be reading the log wrong but it appears something is wrong with the image buttons.
Any ideas??
01-23 15:59:03.667: E/AndroidRuntime(19712): FATAL EXCEPTION: main
01-23 15:59:03.667: E/AndroidRuntime(19712): java.lang.RuntimeException:
Unable to start activity ComponentInfo{com.example.bluffball/com.example.bluffball.Content}: java.lang.ClassCastException: android.widget.ImageButton cannot be cast to android.widget.Button
01-23 15:59:03.667: E/AndroidRuntime(19712): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2071)
01-23 15:59:03.667: E/AndroidRuntime(19712): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2096)
01-23 15:59:03.667: E/AndroidRuntime(19712): at android.app.ActivityThread.access$600(ActivityThread.java:138)
01-23 15:59:03.667: E/AndroidRuntime(19712): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1207)
01-23 15:59:03.667: E/AndroidRuntime(19712): at android.os.Handler.dispatchMessage(Handler.java:99)
01-23 15:59:03.667: E/AndroidRuntime(19712): at android.os.Looper.loop(Looper.java:213)
01-23 15:59:03.667: E/AndroidRuntime(19712): at android.app.ActivityThread.main(ActivityThread.java:4787)
01-23 15:59:03.667: E/AndroidRuntime(19712): at java.lang.reflect.Method.invokeNative(Native Method)
01-23 15:59:03.667: E/AndroidRuntime(19712): at java.lang.reflect.Method.invoke(Method.java:511)
01-23 15:59:03.667: E/AndroidRuntime(19712): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:809)
01-23 15:59:03.667: E/AndroidRuntime(19712): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:576)
01-23 15:59:03.667: E/AndroidRuntime(19712): at dalvik.system.NativeStart.main(Native Method)
01-23 15:59:03.667: E/AndroidRuntime(19712): Caused by: java.lang.ClassCastException: android.widget.ImageButton cannot be cast to android.widget.Button
01-23 15:59:03.667: E/AndroidRuntime(19712): at com.example.bluffball.Content.onCreate(Content.java:106)
01-23 15:59:03.667: E/AndroidRuntime(19712): at android.app.Activity.performCreate(Activity.java:5008)
01-23 15:59:03.667: E/AndroidRuntime(19712): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
01-23 15:59:03.667: E/AndroidRuntime(19712): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2035)
01-23 15:59:03.667: E/AndroidRuntime(19712): ... 11 more
01-23 15:59:05.789: I/Process(19712): Sending signal. PID: 19712 SIG: 9
It tells you quite plainly, android.widget.ImageButton cannot be cast to android.widget.Button in your `Content.java' at line 106.
You probably have a statement there which reads something like
Button someButton = (Button) findViewById( R.id. ... )
when it should be
ImageButton someButton = (ImageButton) findViewById( R.id. ... )

Opening Second Aapp's Specific Activity

I have two applications App1 and App2 I want to open App2's Third activity from App1 and I want to pass some values between applications too. How can I do this.?
I have tried this:
Intent LaunchIntent = getPackageManager().getLaunchIntentForPackage("com.example.aap2.MainActivity3");
startActivity(LaunchIntent);
But I am getting exception.
01-23 00:18:04.150: E/AndroidRuntime(5323): java.lang.IllegalStateException: Could not execute method of the activity
01-23 00:18:04.150: E/AndroidRuntime(5323): at android.view.View$1.onClick(View.java:2144)
01-23 00:18:04.150: E/AndroidRuntime(5323): at android.view.View.performClick(View.java:2485)
01-23 00:18:04.150: E/AndroidRuntime(5323): at android.view.View$PerformClick.run(View.java:9080)
01-23 00:18:04.150: E/AndroidRuntime(5323): at android.os.Handler.handleCallback(Handler.java:587)
01-23 00:18:04.150: E/AndroidRuntime(5323): at android.os.Handler.dispatchMessage(Handler.java:92)
01-23 00:18:04.150: E/AndroidRuntime(5323): at android.os.Looper.loop(Looper.java:130)
01-23 00:18:04.150: E/AndroidRuntime(5323): at android.app.ActivityThread.main(ActivityThread.java:3714)
01-23 00:18:04.150: E/AndroidRuntime(5323): at java.lang.reflect.Method.invokeNative(Native Method)
01-23 00:18:04.150: E/AndroidRuntime(5323): at java.lang.reflect.Method.invoke(Method.java:507)
01-23 00:18:04.150: E/AndroidRuntime(5323): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
01-23 00:18:04.150: E/AndroidRuntime(5323): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:624)
01-23 00:18:04.150: E/AndroidRuntime(5323): at dalvik.system.NativeStart.main(Native Method)
01-23 00:18:04.150: E/AndroidRuntime(5323): Caused by: java.lang.reflect.InvocationTargetException
01-23 00:18:04.150: E/AndroidRuntime(5323): at java.lang.reflect.Method.invokeNative(Native Method)
01-23 00:18:04.150: E/AndroidRuntime(5323): at java.lang.reflect.Method.invoke(Method.java:507)
01-23 00:18:04.150: E/AndroidRuntime(5323): at android.view.View$1.onClick(View.java:2139)
01-23 00:18:04.150: E/AndroidRuntime(5323): ... 11 more
01-23 00:18:04.150: E/AndroidRuntime(5323): Caused by: java.lang.NullPointerException
01-23 00:18:04.150: E/AndroidRuntime(5323): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1374)
01-23 00:18:04.150: E/AndroidRuntime(5323): at android.app.Activity.startActivityForResult(Activity.java:2827)
01-23 00:18:04.150: E/AndroidRuntime(5323): at android.app.Activity.startActivity(Activity.java:2933)
01-23 00:18:04.150: E/AndroidRuntime(5323): at com.example.aap1.MainActivity1.one(MainActivity1.java:27)
The problem is here
Intent LaunchIntent = getPackageManager().getLaunchIntentForPackage("com.example.aap2.MainActivity3");
here you have to pass the packagename but you are passing Activity name..that too the above will return the launcher Activity you have set in the manifest file..
For this you need to change your code like this..
Intent i = new Intent();
i.setClassName("com.example.aap2", "com.example.aap2.MainActivity3");
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(i);
And set android:export="true" for MainActivity3 in Manifest.
Use
Intent intent = new Intent();
intent.setComponent(new ComponentName("com.example.app2", "com.example.aap2.MainActivity3"));
//intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); // Make sure this falg is really need.
startActivity(intent);
Useful resources
Allowing Other Apps to Start Your Activity
Interacting with Other Apps
You need to write Activity declaration into manifest as (for second app)
<activity android:name=".MainActivity3"
android:label="#string/app_name"
android:exported="true" >
// Add intent filter if any.
</activity>
Use this only if you don't know the Activity Name and don't pass activity name in it like you did
Intent LaunchIntent = getPackageManager().getLaunchIntentForPackage("com.example.aap2");
Otherwise just simply try following method, the usual method to open another activity is
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.setComponent(new ComponentName("com.package.address","com.package.address.MainActivity"));
startActivity(intent);

Android EditText setText not working [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
I am trying to setText of edittext using java but it is not working and force closing my application, though i am not sure why
Java Code
EditText UserProfileFirstName;
UserProfileFirstName = (EditText) findViewById(R.id.userFirstName);
UserProfileFirstName.setText("John");
Xml
<EditText
android:id="#+id/userFirstName"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:inputType="text"
android:textSize="22sp"
android:layout_marginTop="40dp"
android:layout_marginBottom="15dp"
android:hint="First Name"
android:ems="10"
/>
LogCat Error
01-23 09:32:15.564: E/AndroidRuntime(4101): FATAL EXCEPTION: main
01-23 09:32:15.564: E/AndroidRuntime(4101): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.unext.unextlibrary/com.unext.unextlibrary.ProfileActivity}: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.unext.unextlibrary/com.unext.unextlibrary.UserProfile}: java.lang.NullPointerException
01-23 09:32:15.564: E/AndroidRuntime(4101): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
01-23 09:32:15.564: E/AndroidRuntime(4101): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
01-23 09:32:15.564: E/AndroidRuntime(4101): at android.app.ActivityThread.access$600(ActivityThread.java:141)
01-23 09:32:15.564: E/AndroidRuntime(4101): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
01-23 09:32:15.564: E/AndroidRuntime(4101): at android.os.Handler.dispatchMessage(Handler.java:99)
01-23 09:32:15.564: E/AndroidRuntime(4101): at android.os.Looper.loop(Looper.java:137)
01-23 09:32:15.564: E/AndroidRuntime(4101): at android.app.ActivityThread.main(ActivityThread.java:5039)
01-23 09:32:15.564: E/AndroidRuntime(4101): at java.lang.reflect.Method.invokeNative(Native Method)
01-23 09:32:15.564: E/AndroidRuntime(4101): at java.lang.reflect.Method.invoke(Method.java:511)
01-23 09:32:15.564: E/AndroidRuntime(4101): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
01-23 09:32:15.564: E/AndroidRuntime(4101): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
01-23 09:32:15.564: E/AndroidRuntime(4101): at dalvik.system.NativeStart.main(Native Method)
01-23 09:32:15.564: E/AndroidRuntime(4101): Caused by: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.unext.unextlibrary/com.unext.unextlibrary.UserProfile}: java.lang.NullPointerException
01-23 09:32:15.564: E/AndroidRuntime(4101): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
01-23 09:32:15.564: E/AndroidRuntime(4101): at android.app.ActivityThread.startActivityNow(ActivityThread.java:2023)
01-23 09:32:15.564: E/AndroidRuntime(4101): at android.app.LocalActivityManager.moveToState(LocalActivityManager.java:135)
01-23 09:32:15.564: E/AndroidRuntime(4101): at android.app.LocalActivityManager.startActivity(LocalActivityManager.java:347)
01-23 09:32:15.564: E/AndroidRuntime(4101): at android.widget.TabHost$IntentContentStrategy.getContentView(TabHost.java:749)
01-23 09:32:15.564: E/AndroidRuntime(4101): at android.widget.TabHost.setCurrentTab(TabHost.java:413)
01-23 09:32:15.564: E/AndroidRuntime(4101): at android.widget.TabHost.addTab(TabHost.java:240)
01-23 09:32:15.564: E/AndroidRuntime(4101): at com.unext.unextlibrary.ProfileActivity.onCreate(ProfileActivity.java:105)
01-23 09:32:15.564: E/AndroidRuntime(4101): at android.app.Activity.performCreate(Activity.java:5104)
01-23 09:32:15.564: E/AndroidRuntime(4101): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
01-23 09:32:15.564: E/AndroidRuntime(4101): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
01-23 09:32:15.564: E/AndroidRuntime(4101): ... 11 more
01-23 09:32:15.564: E/AndroidRuntime(4101): Caused by: java.lang.NullPointerException
01-23 09:32:15.564: E/AndroidRuntime(4101): at com.unext.unextlibrary.UserProfile.onCreate(UserProfile.java:57)
01-23 09:32:15.564: E/AndroidRuntime(4101): at android.app.Activity.performCreate(Activity.java:5104)
01-23 09:32:15.564: E/AndroidRuntime(4101): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
01-23 09:32:15.564: E/AndroidRuntime(4101): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
01-23 09:32:15.564: E/AndroidRuntime(4101): ... 21 more
I searched on google and also saw SO answers but nothing seems to be working for me
Add
setContentView(R.layout.LAYOUTNAME); in oncreate, before you try to get view by
UserProfileFirstName = (EditText) findViewById(R.id.userFirstName);
// here LAYOUTNAME is your layout's name where you define this edittext

How implement the mediation ad in android

I implement the mediation ad in android but it is not showing i use currently AdMob House Ads and Hunt Mobile Ads in Ad Network Mediation.
i implement both the xml and java coding way but neither work for me.
my xml code
<com.google.ads.AdView
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:id="#+id/ad"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
ads:adSize="SMART_BANNER"
ads:adUnitId="6cd435789dcc43c0"
ads:loadAdOnCreate="true" />
and the log cat error is
01-23 19:13:10.079: E/Ads(1771): Cannot find adapter class 'com.huntmads.admobadaptor.HuntMadsAdapter'. Did you link the ad network's mediation adapter? Skipping ad network.
01-23 19:13:10.079: E/Ads(1771): java.lang.ClassNotFoundException: com.huntmads.admobadaptor.HuntMadsAdapter
01-23 19:13:10.079: E/Ads(1771): at java.lang.Class.classForName(Native Method)
01-23 19:13:10.079: E/Ads(1771): at java.lang.Class.forName(Class.java:217)
01-23 19:13:10.079: E/Ads(1771): at java.lang.Class.forName(Class.java:172)
01-23 19:13:10.079: E/Ads(1771): at com.google.ads.g.a(SourceFile:133)
01-23 19:13:10.079: E/Ads(1771): at com.google.ads.i.run(SourceFile:116)
01-23 19:13:10.079: E/Ads(1771): at android.os.Handler.handleCallback(Handler.java:605)
01-23 19:13:10.079: E/Ads(1771): at android.os.Handler.dispatchMessage(Handler.java:92)
01-23 19:13:10.079: E/Ads(1771): at android.os.Looper.loop(Looper.java:137)
01-23 19:13:10.079: E/Ads(1771): at android.app.ActivityThread.main(ActivityThread.java:4424)
01-23 19:13:10.079: E/Ads(1771): at java.lang.reflect.Method.invokeNative(Native Method)
01-23 19:13:10.079: E/Ads(1771): at java.lang.reflect.Method.invoke(Method.java:511)
01-23 19:13:10.079: E/Ads(1771): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
01-23 19:13:10.079: E/Ads(1771): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
01-23 19:13:10.079: E/Ads(1771): at dalvik.system.NativeStart.main(Native Method)
01-23 19:13:10.079: E/Ads(1771): Caused by: java.lang.NoClassDefFoundError: com/huntmads/admobadaptor/HuntMadsAdapter
01-23 19:13:10.079: E/Ads(1771): ... 14 more
01-23 19:13:10.079: E/Ads(1771): Caused by: java.lang.ClassNotFoundException: com.huntmads.admobadaptor.HuntMadsAdapter
01-23 19:13:10.079: E/Ads(1771): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
01-23 19:13:10.079: E/Ads(1771): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
01-23 19:13:10.079: E/Ads(1771): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
01-23 19:13:10.079: E/Ads(1771): ... 14 more
It sounds like you have the Admob package downloaded, but you need to also download the .jar file for the other types of ads. Google provides instructions for all mediated ads, and the specific download link for the Huntmads jar.

Android java.lang.NumberFormatException: Invalid int: "res/drawable-hdpi/ic_menu_share.png"

We released an App in the market yesterday and i see that it doesn't install on HTC/Sony Ericsson phones. i could finally get my hands on a HTC phone and got the following logcat but am not able to debug and retify the issue
Device Info
build.board: montblanc
build.bootloader: s1
build.brand: SEMC
build.cpu_abi: armeabi-v7a
build.cpu_abi2: armeabi
build.device: LT22i
build.display: 6.1.1.B.1.54
build.fingerprint: SEMC/LT22i_1261-6006/LT22i:4.0.4/6.1.1.B.1.54/ybt3zw:user/release-keys
build.hardware: st-ericsson
build.host: BuildHost
build.id: 6.1.1.B.1.54
build.manufacturer: Sony
build.model: LT22i
build.product: LT22i_1261-6006
build.radio: unknown
build.serial: CB5121XDB7
build.tags: release-keys
build.time: 1350305827000
build.type: user
build.user: BuildUser
version.codename: REL
version.incremental: ybt3zw
version.release: 4.0.4
version.sdk_int: 15
Log Cat
01-23 00:09:35.735 E/AndroidRuntime(29152): FATAL EXCEPTION: main
01-23 00:09:35.735 E/AndroidRuntime(29152): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.m7.nomad/com.m7.nomad.SplashActivity}: android.view.InflateException: Binary XML file line #24: Error inflating class android.widget.LinearLayout
01-23 00:09:35.735 E/AndroidRuntime(29152): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1967)
01-23 00:09:35.735 E/AndroidRuntime(29152): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1992)
01-23 00:09:35.735 E/AndroidRuntime(29152): at android.app.ActivityThread.access$600(ActivityThread.java:127)
01-23 00:09:35.735 E/AndroidRuntime(29152): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1158)
01-23 00:09:35.735 E/AndroidRuntime(29152): at android.os.Handler.dispatchMessage(Handler.java:99)
01-23 00:09:35.735 E/AndroidRuntime(29152): at android.os.Looper.loop(Looper.java:137)
01-23 00:09:35.735 E/AndroidRuntime(29152): at android.app.ActivityThread.main(ActivityThread.java:4448)
01-23 00:09:35.735 E/AndroidRuntime(29152): at java.lang.reflect.Method.invokeNative(Native Method)
01-23 00:09:35.735 E/AndroidRuntime(29152): at java.lang.reflect.Method.invoke(Method.java:511)
01-23 00:09:35.735 E/AndroidRuntime(29152): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:823)
01-23 00:09:35.735 E/AndroidRuntime(29152): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:590)
01-23 00:09:35.735 E/AndroidRuntime(29152): at dalvik.system.NativeStart.main(Native Method)
01-23 00:09:35.735 E/AndroidRuntime(29152): Caused by: android.view.InflateException: Binary XML file line #24: Error inflating class android.widget.LinearLayout
01-23 00:09:35.735 E/AndroidRuntime(29152): at android.view.LayoutInflater.createView(LayoutInflater.java:606)
01-23 00:09:35.735 E/AndroidRuntime(29152): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
01-23 00:09:35.735 E/AndroidRuntime(29152): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:653)
01-23 00:09:35.735 E/AndroidRuntime(29152): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:678)
01-23 00:09:35.735 E/AndroidRuntime(29152): at android.view.LayoutInflater.inflate(LayoutInflater.java:466)
01-23 00:09:35.735 E/AndroidRuntime(29152): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
01-23 00:09:35.735 E/AndroidRuntime(29152): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
01-23 00:09:35.735 E/AndroidRuntime(29152): at com.android.internal.policy.impl.PhoneWindow.generateLayout(PhoneWindow.java:2712)
01-23 00:09:35.735 E/AndroidRuntime(29152): at com.android.internal.policy.impl.PhoneWindow.installDecor(PhoneWindow.java:2772)
01-23 00:09:35.735 E/AndroidRuntime(29152): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:251)
01-23 00:09:35.735 E/AndroidRuntime(29152): at android.app.Activity.setContentView(Activity.java:1835)
01-23 00:09:35.735 E/AndroidRuntime(29152): at com.m7.nomad.SplashActivity.onCreate(SplashActivity.java:46)
01-23 00:09:35.735 E/AndroidRuntime(29152): at android.app.Activity.performCreate(Activity.java:4465)
01-23 00:09:35.735 E/AndroidRuntime(29152): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
01-23 00:09:35.735 E/AndroidRuntime(29152): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1931)
01-23 00:09:35.735 E/AndroidRuntime(29152): ... 11 more
01-23 00:09:35.735 E/AndroidRuntime(29152): Caused by: java.lang.reflect.InvocationTargetException
01-23 00:09:35.735 E/AndroidRuntime(29152): at java.lang.reflect.Constructor.constructNative(Native Method)
01-23 00:09:35.735 E/AndroidRuntime(29152): at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
01-23 00:09:35.735 E/AndroidRuntime(29152): at android.view.LayoutInflater.createView(LayoutInflater.java:586)
01-23 00:09:35.735 E/AndroidRuntime(29152): ... 25 more
01-23 00:09:35.735 E/AndroidRuntime(29152): Caused by: java.lang.NumberFormatException: Invalid int: "res/drawable-hdpi/ic_menu_share.png"
01-23 00:09:35.735 E/AndroidRuntime(29152): at java.lang.Integer.invalidInt(Integer.java:138)
01-23 00:09:35.735 E/AndroidRuntime(29152): at java.lang.Integer.parse(Integer.java:375)
01-23 00:09:35.735 E/AndroidRuntime(29152): at java.lang.Integer.parseInt(Integer.java:366)
01-23 00:09:35.735 E/AndroidRuntime(29152): at com.android.internal.util.XmlUtils.convertValueToInt(XmlUtils.java:123)
01-23 00:09:35.735 E/AndroidRuntime(29152): at android.content.res.TypedArray.getInt(TypedArray.java:254)
01-23 00:09:35.735 E/AndroidRuntime(29152): at android.view.View.<init>(View.java:2969)
01-23 00:09:35.735 E/AndroidRuntime(29152): at android.view.ViewGroup.<init>(ViewGroup.java:418)
01-23 00:09:35.735 E/AndroidRuntime(29152): at android.widget.LinearLayout.<init>(LinearLayout.java:178)
01-23 00:09:35.735 E/AndroidRuntime(29152): at android.widget.LinearLayout.<init>(LinearLayout.java:174)
01-23 00:09:35.735 E/AndroidRuntime(29152): ... 28 more
01-23 00:09:36.246 E/wpa_supplicant(11724): RX ctrl_iface - hexdump_ascii(len=11):
01-23 00:09:36.246 E/wpa_supplicant(11724): 53 49 47 4e 41 4c 5f 50 4f 4c 4c SIGNAL_POLL
01-23 00:09:39.239 E/wpa_supplicant(11724): RX ctrl_iface - hexdump_ascii(len=11):
01-23 00:09:39.239 E/wpa_supplicant(11724): 53 49 47 4e 41 4c 5f 50 4f 4c 4c SIGNAL_POLL
01-23 00:09:41.161 E/AndroidRuntime(29212): FATAL EXCEPTION: main
01-23 00:09:41.161 E/AndroidRuntime(29212): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.m7.nomad/com.m7.nomad.SplashActivity}: android.view.InflateException: Binary XML file line #24: Error inflating class android.widget.LinearLayout
01-23 00:09:41.161 E/AndroidRuntime(29212): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1967)
01-23 00:09:41.161 E/AndroidRuntime(29212): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1992)
01-23 00:09:41.161 E/AndroidRuntime(29212): at android.app.ActivityThread.access$600(ActivityThread.java:127)
01-23 00:09:41.161 E/AndroidRuntime(29212): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1158)
01-23 00:09:41.161 E/AndroidRuntime(29212): at android.os.Handler.dispatchMessage(Handler.java:99)
01-23 00:09:41.161 E/AndroidRuntime(29212): at android.os.Looper.loop(Looper.java:137)
01-23 00:09:41.161 E/AndroidRuntime(29212): at android.app.ActivityThread.main(ActivityThread.java:4448)
01-23 00:09:41.161 E/AndroidRuntime(29212): at java.lang.reflect.Method.invokeNative(Native Method)
01-23 00:09:41.161 E/AndroidRuntime(29212): at java.lang.reflect.Method.invoke(Method.java:511)
01-23 00:09:41.161 E/AndroidRuntime(29212): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:823)
01-23 00:09:41.161 E/AndroidRuntime(29212): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:590)
01-23 00:09:41.161 E/AndroidRuntime(29212): at dalvik.system.NativeStart.main(Native Method)
01-23 00:09:41.161 E/AndroidRuntime(29212): Caused by: android.view.InflateException: Binary XML file line #24: Error inflating class android.widget.LinearLayout
01-23 00:09:41.161 E/AndroidRuntime(29212): at android.view.LayoutInflater.createView(LayoutInflater.java:606)
01-23 00:09:41.161 E/AndroidRuntime(29212): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
01-23 00:09:41.161 E/AndroidRuntime(29212): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:653)
01-23 00:09:41.161 E/AndroidRuntime(29212): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:678)
01-23 00:09:41.161 E/AndroidRuntime(29212): at android.view.LayoutInflater.inflate(LayoutInflater.java:466)
01-23 00:09:41.161 E/AndroidRuntime(29212): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
01-23 00:09:41.161 E/AndroidRuntime(29212): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
01-23 00:09:41.161 E/AndroidRuntime(29212): at com.android.internal.policy.impl.PhoneWindow.generateLayout(PhoneWindow.java:2712)
01-23 00:09:41.161 E/AndroidRuntime(29212): at com.android.internal.policy.impl.PhoneWindow.installDecor(PhoneWindow.java:2772)
01-23 00:09:41.161 E/AndroidRuntime(29212): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:251)
01-23 00:09:41.161 E/AndroidRuntime(29212): at android.app.Activity.setContentView(Activity.java:1835)
01-23 00:09:41.161 E/AndroidRuntime(29212): at com.m7.nomad.SplashActivity.onCreate(SplashActivity.java:46)
01-23 00:09:41.161 E/AndroidRuntime(29212): at android.app.Activity.performCreate(Activity.java:4465)
01-23 00:09:41.161 E/AndroidRuntime(29212): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
01-23 00:09:41.161 E/AndroidRuntime(29212): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1931)
01-23 00:09:41.161 E/AndroidRuntime(29212): ... 11 more
01-23 00:09:41.161 E/AndroidRuntime(29212): Caused by: java.lang.reflect.InvocationTargetException
01-23 00:09:41.161 E/AndroidRuntime(29212): at java.lang.reflect.Constructor.constructNative(Native Method)
01-23 00:09:41.161 E/AndroidRuntime(29212): at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
01-23 00:09:41.161 E/AndroidRuntime(29212): at android.view.LayoutInflater.createView(LayoutInflater.java:586)
01-23 00:09:41.161 E/AndroidRuntime(29212): ... 25 more
01-23 00:09:41.161 E/AndroidRuntime(29212): Caused by: java.lang.NumberFormatException: Invalid int: "res/drawable-hdpi/ic_menu_share.png"
01-23 00:09:41.161 E/AndroidRuntime(29212): at java.lang.Integer.invalidInt(Integer.java:138)
01-23 00:09:41.161 E/AndroidRuntime(29212): at java.lang.Integer.parse(Integer.java:375)
01-23 00:09:41.161 E/AndroidRuntime(29212): at java.lang.Integer.parseInt(Integer.java:366)
01-23 00:09:41.161 E/AndroidRuntime(29212): at com.android.internal.util.XmlUtils.convertValueToInt(XmlUtils.java:123)
01-23 00:09:41.161 E/AndroidRuntime(29212): at android.content.res.TypedArray.getInt(TypedArray.java:254)
01-23 00:09:41.161 E/AndroidRuntime(29212): at android.view.View.<init>(View.java:2969)
01-23 00:09:41.161 E/AndroidRuntime(29212): at android.view.ViewGroup.<init>(ViewGroup.java:418)
01-23 00:09:41.161 E/AndroidRuntime(29212): at android.widget.LinearLayout.<init>(LinearLayout.java:178)
01-23 00:09:41.161 E/AndroidRuntime(29212): at android.widget.LinearLayout.<init>(LinearLayout.java:174)
01-23 00:09:41.161 E/AndroidRuntime(29212): ... 28 more
01-23 00:09:42.252 E/wpa_supplicant(11724): RX ctrl_iface - hexdump_ascii(len=11):
01-23 00:09:42.252 E/wpa_supplicant(11724): 53 49 47 4e 41 4c 5f 50 4f 4c 4c SIGNAL_POLL
01-23 00:09:45.255 E/wpa_supplicant(11724): RX ctrl_iface - hexdump_ascii(len=11):
01-23 00:09:45.255 E/wpa_supplicant(11724): 53 49 47 4e 41 4c 5f 50 4f 4c 4c SIGNAL_POLL
01-23 00:09:48.268 E/wpa_supplicant(11724): RX ctrl_iface - hexdump_ascii(len=11):
01-23 00:09:48.268 E/wpa_supplicant(11724): 53 49 47 4e 41 4c 5f 50 4f 4c 4c SIGNAL_POLL
01-23 00:09:51.261 E/wpa_supplicant(11724): RX ctrl_iface - hexdump_ascii(len=11):
01-23 00:09:51.261 E/wpa_supplicant(11724): 53 49 47 4e 41 4c 5f 50 4f 4c 4c SIGNAL_POLL
01-23 00:09:52.061 E/AndroidRuntime(29272): FATAL EXCEPTION: main
01-23 00:09:52.061 E/AndroidRuntime(29272): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.m7.nomad/com.m7.nomad.SplashActivity}: android.view.InflateException: Binary XML file line #24: Error inflating class android.widget.LinearLayout
01-23 00:09:52.061 E/AndroidRuntime(29272): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1967)
01-23 00:09:52.061 E/AndroidRuntime(29272): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1992)
01-23 00:09:52.061 E/AndroidRuntime(29272): at android.app.ActivityThread.access$600(ActivityThread.java:127)
01-23 00:09:52.061 E/AndroidRuntime(29272): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1158)
01-23 00:09:52.061 E/AndroidRuntime(29272): at android.os.Handler.dispatchMessage(Handler.java:99)
01-23 00:09:52.061 E/AndroidRuntime(29272): at android.os.Looper.loop(Looper.java:137)
01-23 00:09:52.061 E/AndroidRuntime(29272): at android.app.ActivityThread.main(ActivityThread.java:4448)
01-23 00:09:52.061 E/AndroidRuntime(29272): at java.lang.reflect.Method.invokeNative(Native Method)
01-23 00:09:52.061 E/AndroidRuntime(29272): at java.lang.reflect.Method.invoke(Method.java:511)
01-23 00:09:52.061 E/AndroidRuntime(29272): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:823)
01-23 00:09:52.061 E/AndroidRuntime(29272): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:590)
01-23 00:09:52.061 E/AndroidRuntime(29272): at dalvik.system.NativeStart.main(Native Method)
01-23 00:09:52.061 E/AndroidRuntime(29272): Caused by: android.view.InflateException: Binary XML file line #24: Error inflating class android.widget.LinearLayout
01-23 00:09:52.061 E/AndroidRuntime(29272): at android.view.LayoutInflater.createView(LayoutInflater.java:606)
01-23 00:09:52.061 E/AndroidRuntime(29272): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
01-23 00:09:52.061 E/AndroidRuntime(29272): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:653)
01-23 00:09:52.061 E/AndroidRuntime(29272): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:678)
01-23 00:09:52.061 E/AndroidRuntime(29272): at android.view.LayoutInflater.inflate(LayoutInflater.java:466)
01-23 00:09:52.061 E/AndroidRuntime(29272): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
01-23 00:09:52.061 E/AndroidRuntime(29272): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
01-23 00:09:52.061 E/AndroidRuntime(29272): at com.android.internal.policy.impl.PhoneWindow.generateLayout(PhoneWindow.java:2712)
01-23 00:09:52.061 E/AndroidRuntime(29272): at com.android.internal.policy.impl.PhoneWindow.installDecor(PhoneWindow.java:2772)
01-23 00:09:52.061 E/AndroidRuntime(29272): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:251)
01-23 00:09:52.061 E/AndroidRuntime(29272): at android.app.Activity.setContentView(Activity.java:1835)
01-23 00:09:52.061 E/AndroidRuntime(29272): at com.m7.nomad.SplashActivity.onCreate(SplashActivity.java:46)
01-23 00:09:52.061 E/AndroidRuntime(29272): at android.app.Activity.performCreate(Activity.java:4465)
01-23 00:09:52.061 E/AndroidRuntime(29272): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
01-23 00:09:52.061 E/AndroidRuntime(29272): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1931)
01-23 00:09:52.061 E/AndroidRuntime(29272): ... 11 more
01-23 00:09:52.061 E/AndroidRuntime(29272): Caused by: java.lang.reflect.InvocationTargetException
01-23 00:09:52.061 E/AndroidRuntime(29272): at java.lang.reflect.Constructor.constructNative(Native Method)
01-23 00:09:52.061 E/AndroidRuntime(29272): at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
01-23 00:09:52.061 E/AndroidRuntime(29272): at android.view.LayoutInflater.createView(LayoutInflater.java:586)
01-23 00:09:52.061 E/AndroidRuntime(29272): ... 25 more
01-23 00:09:52.061 E/AndroidRuntime(29272): Caused by: java.lang.NumberFormatException: Invalid int: "res/drawable-hdpi/ic_menu_share.png"
01-23 00:09:52.061 E/AndroidRuntime(29272): at java.lang.Integer.invalidInt(Integer.java:138)
01-23 00:09:52.061 E/AndroidRuntime(29272): at java.lang.Integer.parse(Integer.java:375)
01-23 00:09:52.061 E/AndroidRuntime(29272): at java.lang.Integer.parseInt(Integer.java:366)
01-23 00:09:52.061 E/AndroidRuntime(29272): at com.android.internal.util.XmlUtils.convertValueToInt(XmlUtils.java:123)
01-23 00:09:52.061 E/AndroidRuntime(29272): at android.content.res.TypedArray.getInt(TypedArray.java:254)
01-23 00:09:52.061 E/AndroidRuntime(29272): at android.view.View.<init>(View.java:2969)
01-23 00:09:52.061 E/AndroidRuntime(29272): at android.view.ViewGroup.<init>(ViewGroup.java:418)
01-23 00:09:52.061 E/AndroidRuntime(29272): at android.widget.LinearLayout.<init>(LinearLayout.java:178)
01-23 00:09:52.061 E/AndroidRuntime(29272): at android.widget.LinearLayout.<init>(LinearLayout.java:174)
01-23 00:09:52.061 E/AndroidRuntime(29272): ... 28 more
XML File (after making Changes)
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:contentDescription="Splash Screen"
android:gravity="center"
android:src="#drawable/splash_logo" />
XML before making changes
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#color/primary_color"
android:gravity="center"
android:orientation="vertical"
android:textAlignment="center" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:contentDescription="Splash Screen"
android:gravity="center"
android:src="#drawable/splash_logo" />
</RelativeLayout>
Please post your xml code here.
"Caused by: android.view.InflateException: Binary XML file line #24: Error inflating class android.widget. LinearLayout". This line says there is something wrong at line 24.

Categories

Resources