android-how to put the text below the image in grid view - android-gridview

in my application i want to display the text below the image in grid view.
The following is the code but it is not working. it shows an exception like this
05-31 17:19:29.297: ERROR/AndroidRuntime(1262): FATAL EXCEPTION: main
05-31 17:19:29.297: ERROR/AndroidRuntime(1262): android.view.InflateException: Binary XML file line #1: Error inflating class linearlayout
05-31 17:19:29.297: ERROR/AndroidRuntime(1262): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:576)
05-31 17:19:29.297: ERROR/AndroidRuntime(1262): at android.view.LayoutInflater.inflate(LayoutInflater.java:385)
05-31 17:19:29.297: ERROR/AndroidRuntime(1262): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
05-31 17:19:29.297: ERROR/AndroidRuntime(1262): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
05-31 17:19:29.297: ERROR/AndroidRuntime(1262): at sra.gri.vie.Main$ImageAdapter.getView(Main.java:63)
05-31 17:19:29.297: ERROR/AndroidRuntime(1262): at android.widget.AbsListView.obtainView(AbsListView.java:1315)
05-31 17:19:29.297: ERROR/AndroidRuntime(1262): at android.widget.GridView.onMeasure(GridView.java:932)
05-31 17:19:29.297: ERROR/AndroidRuntime(1262): at android.view.View.measure(View.java:8171)
05-31 17:19:29.297: ERROR/AndroidRuntime(1262): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3132)
05-31 17:19:29.297: ERROR/AndroidRuntime(1262): at android.widget.FrameLayout.onMeasure(FrameLayout.java:245)
05-31 17:19:29.297: ERROR/AndroidRuntime(1262): at android.view.View.measure(View.java:8171)
05-31 17:19:29.297: ERROR/AndroidRuntime(1262): at android.widget.LinearLayout.measureVertical(LinearLayout.java:526)
05-31 17:19:29.297: ERROR/AndroidRuntime(1262): at android.widget.LinearLayout.onMeasure(LinearLayout.java:304)
05-31 17:19:29.297: ERROR/AndroidRuntime(1262): at android.view.View.measure(View.java:8171)
05-31 17:19:29.297: ERROR/AndroidRuntime(1262): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3132)
05-31 17:19:29.297: ERROR/AndroidRuntime(1262): at android.widget.FrameLayout.onMeasure(FrameLayout.java:245)
05-31 17:19:29.297: ERROR/AndroidRuntime(1262): at android.view.View.measure(View.java:8171)
05-31 17:19:29.297: ERROR/AndroidRuntime(1262): at android.view.ViewRoot.performTraversals(ViewRoot.java:801)
05-31 17:19:29.297: ERROR/AndroidRuntime(1262): at android.view.ViewRoot.handleMessage(ViewRoot.java:1727)
05-31 17:19:29.297: ERROR/AndroidRuntime(1262): at android.os.Handler.dispatchMessage(Handler.java:99)
05-31 17:19:29.297: ERROR/AndroidRuntime(1262): at android.os.Looper.loop(Looper.java:123)
05-31 17:19:29.297: ERROR/AndroidRuntime(1262): at android.app.ActivityThread.main(ActivityThread.java:4627)
05-31 17:19:29.297: ERROR/AndroidRuntime(1262): at java.lang.reflect.Method.invokeNative(Native Method)
05-31 17:19:29.297: ERROR/AndroidRuntime(1262): at java.lang.reflect.Method.invoke(Method.java:521)
05-31 17:19:29.297: ERROR/AndroidRuntime(1262): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
05-31 17:19:29.297: ERROR/AndroidRuntime(1262): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
05-31 17:19:29.297: ERROR/AndroidRuntime(1262): at dalvik.system.NativeStart.main(Native Method)
05-31 17:19:29.297: ERROR/AndroidRuntime(1262): Caused by: java.lang.ClassNotFoundException: android.view.linearlayout in loader dalvik.system.PathClassLoader[/data/app/sra.gri.vie-1.apk]
05-31 17:19:29.297: ERROR/AndroidRuntime(1262): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
05-31 17:19:29.297: ERROR/AndroidRuntime(1262): at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
05-31 17:19:29.297: ERROR/AndroidRuntime(1262): at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
05-31 17:19:29.297: ERROR/AndroidRuntime(1262): at android.view.LayoutInflater.createView(LayoutInflater.java:466)
05-31 17:19:29.297: ERROR/AndroidRuntime(1262): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:544)
05-31 17:19:29.297: ERROR/AndroidRuntime(1262): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:66)
05-31 17:19:29.297: ERROR/AndroidRuntime(1262): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563)
05-31 17:19:29.297: ERROR/AndroidRuntime(1262): ... 26 more
05-31 17:23:32.017: INFO/ActivityManager(60): Process sra.gri.vie (pid 1262) has died.
grid_item.xml
<linearlayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/GridItem"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="center_horizontal"
android:background="#000080">
<imageview android:id="#+id/grid_item_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</imageview>
<textview android:id="#+id/grid_item_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView"
android:gravity="center_horizontal"
android:textColor="#000000">
</textview>
</linearlayout>
main.xml
<?xml version="1.0" encoding="utf-8"?>
<GridView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/gridview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:columnWidth="90dp"
android:numColumns="auto_fit"
android:verticalSpacing="10dp"
android:horizontalSpacing="10dp"
android:stretchMode="columnWidth"
android:gravity="center"
/>
Main.java
package sra.gri.vie;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.BaseAdapter;
import android.widget.GridView;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import android.widget.AdapterView.OnItemClickListener;
public class Main extends Activity {
/** Called when the activity is first created. */
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
GridView gridview = (GridView) findViewById(R.id.gridview);
gridview.setAdapter(new ImageAdapter(this));
gridview.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
Toast.makeText(Main.this, "" + position, Toast.LENGTH_SHORT).show();
}
});
}
public class ImageAdapter extends BaseAdapter {
private Context mContext;
public ImageAdapter(Context c) {
mContext = c;
}
public int getCount() {
return mThumbIds.length;
}
public Object getItem(int position) {
return null;
}
public long getItemId(int position) {
return 0;
}
// create a new ImageView for each item referenced by the Adapter
public View getView(int position, View convertView, ViewGroup parent) {
View MyView = convertView;
if (convertView == null) { // if it's not recycled, initialize some attributes
//Inflate the layout
LayoutInflater li = getLayoutInflater();
MyView = li.inflate(R.layout.grid_item, null);
// Add The Image!!!
ImageView iv = (ImageView)MyView.findViewById(R.id.grid_item_image);
iv.setImageResource(mThumbIds[position]);
// Add The Text!!!
TextView tv = (TextView)MyView.findViewById(R.id.grid_item_text);
tv.setText(names[position] );
}
return MyView;
}
// references to our images
private Integer[] mThumbIds = {
R.drawable.sample_2, R.drawable.sample_3,
R.drawable.sample_4, R.drawable.sample_5,
R.drawable.sample_6, R.drawable.sample_7,
R.drawable.sample_0, R.drawable.sample_1,
};
private String[] names={"Dog1","Dog2","Dog3","Dog4","Dog5","Dog6","Dog7","Dog8",};
}
}
thanks

Rename element linearlayout to LinearLayout.
I had the same issue and fixed it that way.

The error complains about the wrong package for linearlayout (android.view.linearlayout). The correct one is android.widget.LinearLayout. But I couldn't find any reference to linear layout in your code. It might help if you can paste the full exception stack trace.

Related

Nullpointer when initializing controller in javafxml application

I am not experienced with fxml and lack knowledge at coding in general. So i try to make an fxml application with several labels and textfields. I want a controller to add listeners for all textfields in the initialization so the model will get updated when text is edited in the view. I fail to get the controller to load.
I have tried to initialize the controller, and I've tried to let the fxml loader initialize the controller. Both gives nullpointer exception on the TextField properties. Also when i call loader.getController it returns null.
First time i put code here, sorry if the format is bad
Application class
import javafx.application.Application;
import javafx.collections.ObservableList;
import javafx.fxml.FXMLLoader;
import javafx.scene.Node;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.TextField;
import javafx.stage.Stage;
public class Main extends Application {
#Override
public void start(Stage primaryStage) throws Exception{
Parent root = FXMLLoader.load(getClass().getResource("sample.fxml"));
primaryStage.setTitle("Hello World");
primaryStage.setScene(new Scene(root, 300, 275));
primaryStage.show();
FXMLLoader loader = new FXMLLoader(getClass().getResource("sample.fxml"));
Controller c = loader.getController();
System.out.println(c==null);
}
public static void main(String[] args) {
launch(args);
}
}
Parts of FXML class:
<VBox maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity"
minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0"
xmlns="http://javafx.com/javafx/8.0.172-ea"
xmlns:fx="http://javafx.com/fxml/1" fx:controller="sample.Controller">
<children>
<HBox prefHeight="30.0" prefWidth="600.0">
<children>
<Label prefHeight="30.0" prefWidth="200.0" text="Name" />
<TextField fx:id="name" prefHeight="31.0" prefWidth="198.0" />
<Button fx:id="button" mnemonicParsing="false" prefHeight="31.0" prefWidth="130.0" text="Button">
<HBox.margin>
<Insets left="10.0" />
</HBox.margin>
</Button>
</children>
</HBox>
(...)More Hboxes(...)
Controller class
public class Controller {
Model model;
#FXML private Button button;
#FXML private TextField name;
#FXML private TextField kcal;
public Controller(){
initialize();
}
#FXML
public void initialize(){
model = new Model();
name.textProperty().addListener(((observable, oldValue, newValue)
-> {
model.setName(newValue);
}));
}
Exception in Application start method
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:389)
at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:328)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:767)
Caused by: java.lang.RuntimeException: Exception in Application start method
at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:917)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$155(LauncherImpl.java:182)
at java.lang.Thread.run(Thread.java:745)
Caused by: javafx.fxml.LoadException:
"path"/FoodFirebaseWriter/sample/sample.fxml:10
at javafx.fxml.FXMLLoader.constructLoadException(FXMLLoader.java:2601)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2579)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2441)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3214)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3175)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3148)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3124)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3104)
at javafx.fxml.FXMLLoader.load(FXMLLoader.java:3097)
at sample.Main.start(Main.java:16)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$162(LauncherImpl.java:863)
at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$175(PlatformImpl.java:326)
at com.sun.javafx.application.PlatformImpl.lambda$null$173(PlatformImpl.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$174(PlatformImpl.java:294)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$148(WinApplication.java:191)
... 1 more
Caused by: java.lang.NullPointerException
at sample.Controller.initialize(Controller.java:38)
at sample.Controller.<init>(Controller.java:33)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at java.lang.Class.newInstance(Class.java:442)
at sun.reflect.misc.ReflectUtil.newInstance(ReflectUtil.java:51)
at javafx.fxml.FXMLLoader$ValueElement.processAttribute(FXMLLoader.java:927)
at javafx.fxml.FXMLLoader$InstanceDeclarationElement.processAttribute(FXMLLoader.java:971)
at javafx.fxml.FXMLLoader$Element.processStartElement(FXMLLoader.java:220)
at javafx.fxml.FXMLLoader$ValueElement.processStartElement(FXMLLoader.java:744)
at javafx.fxml.FXMLLoader.processStartElement(FXMLLoader.java:2707)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2527)
... 17 more
Exception running application sample.Main
I figured what I did wrong. First the constructor is called, then the #fxml properties are initialized and then the initialize method is called. I called the initialize method in the constructor. Then the #fxml properties are null and the initialize method is called twice. So I just removed the constructor to fix the problem.

Xamarin - phone call events / state

I'm very new to Xamarin and mobile development, but have an experience with C#.
Following is my attempt to take some code from the web and adjusting it to Xamarin.
The code fails on exception, while placing a call.
I, actually, can't reach breakpoints in my CallReceiver / PhonecallReceiver classes.
I'm running VS2017 community, API23, arm phone.
What I'm missing?
MainActivity:
using System;
using Android.App;
using Android.Content;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.OS;
using Android.Telephony;
using Java.Lang;
using String = System.String;
using System.Collections.Generic;
using Java.Util;
using Javax.Security.Auth;
namespace CallManipulation
{
public abstract class PhonecallReceiver : BroadcastReceiver
{
private static CallState lastState = CallState.Idle;
private static DateTime callStartTime;
private static bool isIncoming;
private static String savedNumber;
public override void OnReceive(Context context, Intent intent)
{
if (intent.Action.Equals("android.intent.action.NEW_OUTGOING_CALL"))
{
savedNumber = intent.Extras.GetString("android.intent.extra.PHONE_NUMBER");
}
else
{
String stateStr = intent.Extras.GetString(TelephonyManager.ExtraState);
String number = intent.Extras.GetString(TelephonyManager.ExtraIncomingNumber);
CallState state = CallState.Idle;
if (stateStr.Equals(TelephonyManager.ExtraStateIdle))
{
state = CallState.Idle;
}
else if (stateStr.Equals(TelephonyManager.ExtraStateOffhook))
{
state = CallState.Offhook;
}
else if (stateStr.Equals(TelephonyManager.ExtraStateRinging))
{
state = CallState.Ringing;
}
OnCallStateChanged(context, state, number);
}
}
protected virtual void onIncomingCallStarted(Context ctx, String number, DateTime start) { }
protected virtual void onOutgoingCallStarted(Context ctx, String number, DateTime start) { }
protected virtual void onIncomingCallEnded(Context ctx, String number, DateTime start, DateTime end) { }
protected virtual void onOutgoingCallEnded(Context ctx, String number, DateTime start, DateTime end) { }
protected virtual void onMissedCall(Context ctx, String number, DateTime start) { }
public void OnCallStateChanged(Context context, CallState state, string number)
{
if (lastState == state)
return;
switch (state)
{
case CallState.Ringing:
isIncoming = true;
callStartTime = new DateTime().Date;
savedNumber = number;
onIncomingCallStarted(context, number, callStartTime);
break;
case CallState.Offhook:
if (lastState != CallState.Ringing)
{
isIncoming = false;
callStartTime = new DateTime().Date;
onOutgoingCallStarted(context, savedNumber, callStartTime);
}
break;
case CallState.Idle:
if (lastState == CallState.Ringing)
onMissedCall(context, savedNumber, callStartTime);
else if (isIncoming)
onIncomingCallEnded(context, savedNumber, callStartTime, new DateTime().Date);
else
onOutgoingCallEnded(context, savedNumber, callStartTime, new DateTime().Date);
break;
}
lastState = state;
}
}
public class CallReceiver : PhonecallReceiver
{
protected override void onIncomingCallStarted(Context ctx, string number, DateTime start)
{
}
protected override void onOutgoingCallStarted(Context ctx, string number, DateTime start)
{
}
protected override void onIncomingCallEnded(Context ctx, string number, DateTime start, DateTime end)
{
}
protected override void onOutgoingCallEnded(Context ctx, string number, DateTime start, DateTime end)
{
}
protected override void onMissedCall(Context ctx, string number, DateTime start)
{
}
}
[Activity(Label = "CallManipulation", MainLauncher = true, Icon = "#drawable/icon")]
public class MainActivity : Activity
{
int count = 1;
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
}
}
}
Manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="CallManipulation.CallManipulation" android:versionCode="1" android:versionName="1.0">
<uses-sdk android:minSdkVersion="16" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.PROCESS_OUTGOING_CALLS"/>
<application android:label="CallManipulation">
<!--This part is inside the application-->
<receiver android:name=".CallReceiver" >
<intent-filter>
<action android:name="android.intent.action.PHONE_STATE" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.NEW_OUTGOING_CALL" />
</intent-filter>
</receiver>
</application>
</manifest>
Output window:
08-01 15:53:29.279 D/Mono ( 2601): [0x9f7fd930] worker starting
08-01 15:53:29.308 D/Mono ( 2601): DllImport searching in: '__Internal' ('(null)').
08-01 15:53:29.308 D/Mono ( 2601): Searching for 'java_interop_jnienv_call_void_method_a'.
08-01 15:53:29.308 D/Mono ( 2601): Probing 'java_interop_jnienv_call_void_method_a'.
08-01 15:53:29.308 D/Mono ( 2601): Found as 'java_interop_jnienv_call_void_method_a'.
08-01 15:53:29.316 E/AndroidRuntime( 2601): FATAL EXCEPTION: main
08-01 15:53:29.316 E/AndroidRuntime( 2601): Process: CallManipulation.CallManipulation, PID: 2601
08-01 15:53:29.316 E/AndroidRuntime( 2601): java.lang.RuntimeException: Unable to instantiate receiver CallManipulation.CallManipulation.CallReceiver: java.lang.ClassNotFoundException: Didn't find class "CallManipulation.CallManipulation.CallReceiver" on path: DexPathList[[zip file "/data/app/CallManipulation.CallManipulation-1/base.apk"],nativeLibraryDirectories=[/data/app/CallManipulation.CallManipulation-1/lib/arm, /data/app/CallManipulation.CallManipulation-1/base.apk!/lib/armeabi-v7a, /vendor/lib, /system/lib]]
08-01 15:53:29.316 E/AndroidRuntime( 2601): at android.app.ActivityThread.handleReceiver(ActivityThread.java:2706)
08-01 15:53:29.316 E/AndroidRuntime( 2601): at android.app.ActivityThread.-wrap14(ActivityThread.java)
08-01 15:53:29.316 E/AndroidRuntime( 2601): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1421)
08-01 15:53:29.316 E/AndroidRuntime( 2601): at android.os.Handler.dispatchMessage(Handler.java:102)
08-01 15:53:29.316 E/AndroidRuntime( 2601): at android.os.Looper.loop(Looper.java:148)
08-01 15:53:29.316 E/AndroidRuntime( 2601): at android.app.ActivityThread.main(ActivityThread.java:5417)
08-01 15:53:29.316 E/AndroidRuntime( 2601): at java.lang.reflect.Method.invoke(Native Method)
08-01 15:53:29.316 E/AndroidRuntime( 2601): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
08-01 15:53:29.316 E/AndroidRuntime( 2601): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
08-01 15:53:29.316 E/AndroidRuntime( 2601): Caused by: java.lang.ClassNotFoundException: Didn't find class "CallManipulation.CallManipulation.CallReceiver" on path: DexPathList[[zip file "/data/app/CallManipulation.CallManipulation-1/base.apk"],nativeLibraryDirectories=[/data/app/CallManipulation.CallManipulation-1/lib/arm, /data/app/CallManipulation.CallManipulation-1/base.apk!/lib/armeabi-v7a, /vendor/lib, /system/lib]]
08-01 15:53:29.316 E/AndroidRuntime( 2601): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
08-01 15:53:29.316 E/AndroidRuntime( 2601): at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
08-01 15:53:29.316 E/AndroidRuntime( 2601): at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
08-01 15:53:29.316 E/AndroidRuntime( 2601): at android.app.ActivityThread.handleReceiver(ActivityThread.java:2701)
08-01 15:53:29.316 E/AndroidRuntime( 2601): ... 8 more
08-01 15:53:29.316 E/AndroidRuntime( 2601): Suppressed: java.lang.ClassNotFoundException: CallManipulation.CallManipulation.CallReceiver
08-01 15:53:29.316 E/AndroidRuntime( 2601): at java.lang.Class.classForName(Native Method)
08-01 15:53:29.316 E/AndroidRuntime( 2601): at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
08-01 15:53:29.316 E/AndroidRuntime( 2601): at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
08-01 15:53:29.316 E/AndroidRuntime( 2601): at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
08-01 15:53:29.316 E/AndroidRuntime( 2601): ... 10 more
08-01 15:53:29.316 E/AndroidRuntime( 2601): Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available

Failed Resolution of R$Drawable when using a bound Java Library

I am binding the java library Material CalendarView. With a set of 12 transforms in Metadata.xml I could bind the library with 0 errors and 15 warnings. I have added Support Library v4 Component ver 23.1.1 in the binding project as the jar file had a dependency on that. Also I have ensured that all the Resource assets are included in the jar file.
When I use this library in an Android Sample like below,
var materialCalendar= new MaterialCalendarView(this);
this exception gets thrown
Failed resolution of: Lcom/prolificinteractive/materialcalendarview/R$drawable;
Java.Lang.NoClassDefFoundError: Failed resolution of: Lcom/prolificinteractive/materialcalendarview/R$drawable; ---> Java.Lang.ClassNotFoundException: Didn't find class "com.prolificinteractive.materialcalendarview.R$drawable" on path: DexPathList[[zip file "/data/app/com.fingent.materialcalendarsample-1/base.apk"],nativeLibraryDirectories=[/data/app/com.fingent.materialcalendarsample-1/lib/x86, /vendor/lib, /system/lib]]
at --- End of managed exception stack trace ---
at java.lang.ClassNotFoundException: Didn't find class "com.prolificinteractive.materialcalendarview.R$drawable" on path: DexPathList[[zip file "/data/app/com.fingent.materialcalendarsample-1/base.apk"],nativeLibraryDirectories=[/data/app/com.fingent.materialcalendarsample-1/lib/x86, /vendor/lib, /system/lib]]
at at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
at at com.prolificinteractive.materialcalendarview.MaterialCalendarView.setupChildren(MaterialCalendarView.java:358)
at at com.prolificinteractive.materialcalendarview.MaterialCalendarView.<init>(MaterialCalendarView.java:237)
at at com.prolificinteractive.materialcalendarview.MaterialCalendarView.<init>(MaterialCalendarView.java:216)
at at md56fd5622393123d59c6c51d78708f2ed2.MainActivity.n_onCreate(Native Method)
at at md56fd5622393123d59c6c51d78708f2ed2.MainActivity.onCreate(MainActivity.java:28)
at at android.app.Activity.performCreate(Activity.java:5990)
at at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)
at at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278)
at at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)
at at android.app.ActivityThread.access$800(ActivityThread.java:151)
at at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
at at android.os.Handler.dispatchMessage(Handler.java:102)
at at android.os.Looper.loop(Looper.java:135)
at at android.app.ActivityThread.main(ActivityThread.java:5254)
at at java.lang.reflect.Method.invoke(Native Method)
at at java.lang.reflect.Method.invoke(Method.java:372)
at at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
at at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
at Suppressed: java.lang.ClassNotFoundException: com.prolificinteractive.materialcalendarview.R$drawable
at at java.lang.Class.classForName(Native Method)
at at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
at ... 19 more
at Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
--- End of inner exception stack trace ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Users/builder/data/lanes/3053/a94a03b5/source/mono/external/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143
at Android.Runtime.JNIEnv.CallNonvirtualVoidMethod (IntPtr jobject, IntPtr jclass, IntPtr jmethod, Android.Runtime.JValue* parms) [0x00084] in /Users/builder/data/lanes/3053/a94a03b5/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.g.cs:1029
at Android.Runtime.JNIEnv.FinishCreateInstance (IntPtr instance, IntPtr jclass, IntPtr constructorId, Android.Runtime.JValue* constructorParameters) [0x0000b] in /Users/builder/data/lanes/3053/a94a03b5/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.cs:306
at MaterialCalendarLibrary.MaterialCalendarView..ctor (Android.Content.Context p0) [0x000c5] in /Users/fingent/Projects/MaterialCalendarLibrary/MaterialCalendarLibrary/obj/Release/generated/src/MaterialCalendarLibrary.MaterialCalendarView.cs:505
at MaterialCalendarSample.MainActivity.OnCreate (Android.OS.Bundle savedInstanceState) [0x00009] in /Users/fingent/Documents/sreeraj/workspace/Xamarin.MaterialCalendarView/MaterialCalendarSample/MainActivity.cs:17
at Android.App.Activity.n_OnCreate_Landroid_os_Bundle_ (IntPtr jnienv, IntPtr native__this, IntPtr native_savedInstanceState) [0x00011] in /Users/builder/data/lanes/3053/a94a03b5/source/monodroid/src/Mono.Android/platforms/android-19/src/generated/Android.App.Activity.cs:2475
at at (wrapper dynamic-method) System.Object:0b8c341c-2f19-42d5-83e9-b3a815827e69 (intptr,intptr,intptr)
at --- End of managed exception stack trace ---
at java.lang.NoClassDefFoundError: Failed resolution of: Lcom/prolificinteractive/materialcalendarview/R$drawable;
at at com.prolificinteractive.materialcalendarview.MaterialCalendarView.setupChildren(MaterialCalendarView.java:358)
at at com.prolificinteractive.materialcalendarview.MaterialCalendarView.<init>(MaterialCalendarView.java:237)
at at com.prolificinteractive.materialcalendarview.MaterialCalendarView.<init>(MaterialCalendarView.java:216)
at at md56fd5622393123d59c6c51d78708f2ed2.MainActivity.n_onCreate(Native Method)
at at md56fd5622393123d59c6c51d78708f2ed2.MainActivity.onCreate(MainActivity.java:28)
at at android.app.Activity.performCreate(Activity.java:5990)
at at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)
at at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278)
at at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)
at at android.app.ActivityThread.access$800(ActivityThread.java:151)
at at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
at at android.os.Handler.dispatchMessage(Handler.java:102)
at at android.os.Looper.loop(Looper.java:135)
at at android.app.ActivityThread.main(ActivityThread.java:5254)
at at java.lang.reflect.Method.invoke(Native Method)
at at java.lang.reflect.Method.invoke(Method.java:372)
at at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
at at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
at Caused by: java.lang.ClassNotFoundException: Didn't find class "com.prolificinteractive.materialcalendarview.R$drawable" on path: DexPathList[[zip file "/data/app/com.fingent.materialcalendarsample-1/base.apk"],nativeLibraryDirectories=[/data/app/com.fingent.materialcalendarsample-1/lib/x86, /vendor/lib, /system/lib]]
at at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
at ... 18 more
at Suppressed: java.lang.ClassNotFoundException: com.prolificinteractive.materialcalendarview.R$drawable
at at java.lang.Class.classForName(Native Method)
at at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
at ... 19 more
at Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
Here is the link to the project in Github Xamarin Material CalendarView
It's about missing Resources that should be attached in Material CalendarView, you need an AAR file.
Just go Maven and get latest AAR file that published by Author: http://mvnrepository.com/artifact/com.prolificinteractive/material-calendarview/1.2.0
Remove the material-calendarview.jar and drag new file material-calendarview-1.2.0.aar on your binding project, done!
A Drawable is a graphic resource and the Java exception is on the following line (from the lib your binding):
buttonPast.setImageResource(R.drawable.mcv_action_previous);
So you are missing mcv_action_previous which a PNG-based arrow located in the res/drawable-xxxhdpi/mcv_action_previous.png within the project that you are binding.
Are all the resources included? Any of your binding transformations or binding warning about resources?

Class loading error on websphere when upgrading to Spring 4.2.3

When I upgrade a multi-war Spring application from Spring 4.1.8 to 4.2.3 I get a strange ClassNotFoundException in a websphere application server (version 8.5.5). The class that is not found by the classloader is on the classpath and was found with previous releases of Spring.
[11.12.15 10:04:27:536 CET] 0000004f FfdcProvider W com.ibm.ws.ffdc.impl.FfdcProvider logIncident FFDC1003I: FFDC Incident emitted on D:\devsbb\websphere\was8_5\IBM\WebSphere\AppServer\profiles\AppSrv01\logs\ffdc\server1_bc0c2481_15.12.11_10.04.27.4771875357035970693584.txt com.ibm.ws.webcontainer.webapp.WebApp.notifyServletContextCreated 1341
[11.12.15 10:04:27:536 CET] 0000004f webapp E com.ibm.ws.webcontainer.webapp.WebApp notifyServletContextCreated SRVE0283E: Exception caught while initializing context: {0}
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'showCaseViewModel' defined in BeanDefinition defined in file [D:\devsbb\websphere\was8_5\IBM\WebSphere\AppServer\profiles\AppSrv01\installedApps\localhostNode01Cell\template-ear-4.0.3-SNAPSHOT.ear\template-web-jsf.war\WEB-INF\classes\ch\sbb\myapp\presentation\ShowCaseViewModel.class]: Initialization of bean failed; nested exception is org.springframework.aop.framework.AopConfigException: Unexpected AOP exception; nested exception is java.lang.RuntimeException: java.lang.ClassNotFoundException: ch.sbb.myapp.presentation.exception.SampleTranslateableFileCopyException
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:753)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:838)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:537)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:446)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:328)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107)
at com.ibm.ws.webcontainer.webapp.WebApp.notifyServletContextCreated(WebApp.java:1689)
at com.ibm.ws.webcontainer.webapp.WebAppImpl.initialize(WebAppImpl.java:414)
at com.ibm.ws.webcontainer.webapp.WebGroupImpl.addWebApplication(WebGroupImpl.java:88)
at com.ibm.ws.webcontainer.VirtualHostImpl.addWebApplication(VirtualHostImpl.java:169)
at com.ibm.ws.webcontainer.WSWebContainer.addWebApp(WSWebContainer.java:749)
at com.ibm.ws.webcontainer.WSWebContainer.addWebApplication(WSWebContainer.java:634)
at com.ibm.ws.webcontainer.component.WebContainerImpl.install(WebContainerImpl.java:426)
at com.ibm.ws.webcontainer.component.WebContainerImpl.start(WebContainerImpl.java:718)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:1177)
at com.ibm.ws.runtime.component.DeployedApplicationImpl.fireDeployedObjectStart(DeployedApplicationImpl.java:1370)
at com.ibm.ws.runtime.component.DeployedModuleImpl.start(DeployedModuleImpl.java:639)
at com.ibm.ws.runtime.component.DeployedApplicationImpl.start(DeployedApplicationImpl.java:968)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:776)
at com.ibm.ws.runtime.component.ApplicationMgrImpl$5.run(ApplicationMgrImpl.java:2195)
at com.ibm.ws.security.auth.ContextManagerImpl.runAs(ContextManagerImpl.java:5474)
at com.ibm.ws.security.auth.ContextManagerImpl.runAsSystem(ContextManagerImpl.java:5600)
at com.ibm.ws.security.core.SecurityContext.runAsSystem(SecurityContext.java:255)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:2200)
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:389)
at com.ibm.ws.runtime.component.CompositionUnitImpl.start(CompositionUnitImpl.java:123)
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:332)
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.access$500(CompositionUnitMgrImpl.java:119)
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl$CUInitializer.run(CompositionUnitMgrImpl.java:938)
at com.ibm.wsspi.runtime.component.WsComponentImpl$_AsynchInitializer.run(WsComponentImpl.java:502)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1864)
Caused by: org.springframework.aop.framework.AopConfigException: Unexpected AOP exception; nested exception is java.lang.RuntimeException: java.lang.ClassNotFoundException: ch.sbb.myapp.presentation.exception.SampleTranslateableFileCopyException
at org.springframework.aop.framework.CglibAopProxy.getProxy(CglibAopProxy.java:218)
at org.springframework.aop.framework.ProxyFactory.getProxy(ProxyFactory.java:109)
at org.springframework.aop.scope.ScopedProxyFactoryBean.setBeanFactory(ScopedProxyFactoryBean.java:111)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeAwareMethods(AbstractAutowireCapableBeanFactory.java:1597)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1565)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545)
... 36 more
Caused by: java.lang.RuntimeException: java.lang.ClassNotFoundException: ch.sbb.myapp.presentation.exception.SampleTranslateableFileCopyException
at org.springframework.asm.ClassWriter.getCommonSuperClass(ClassWriter.java:1684)
at org.springframework.asm.ClassWriter.getMergedType(ClassWriter.java:1654)
at org.springframework.asm.Frame.merge(Frame.java:1426)
at org.springframework.asm.Frame.merge(Frame.java:1337)
at org.springframework.asm.MethodWriter.visitMaxs(MethodWriter.java:1475)
at org.springframework.cglib.core.CodeEmitter.visitMaxs(CodeEmitter.java:842)
at org.springframework.cglib.transform.impl.UndeclaredThrowableTransformer$1.visitMaxs(UndeclaredThrowableTransformer.java:56)
at org.springframework.cglib.core.CodeEmitter.visitMaxs(CodeEmitter.java:842)
at org.springframework.cglib.core.CodeEmitter.end_method(CodeEmitter.java:138)
at org.springframework.cglib.proxy.MethodInterceptorGenerator.generate(MethodInterceptorGenerator.java:131)
at org.springframework.cglib.proxy.Enhancer.emitMethods(Enhancer.java:1005)
at org.springframework.cglib.proxy.Enhancer.generateClass(Enhancer.java:509)
at org.springframework.cglib.transform.TransformingClassGenerator.generateClass(TransformingClassGenerator.java:33)
at org.springframework.cglib.core.DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:25)
at org.springframework.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:231)
at org.springframework.cglib.proxy.Enhancer.createHelper(Enhancer.java:378)
at org.springframework.cglib.proxy.Enhancer.createClass(Enhancer.java:318)
at org.springframework.aop.framework.ObjenesisCglibAopProxy.createProxyClassAndInstance(ObjenesisCglibAopProxy.java:55)
at org.springframework.aop.framework.CglibAopProxy.getProxy(CglibAopProxy.java:202)
... 41 more
Here is my class:
package ch.sbb.myapp.presentation;
import java.util.HashSet;
import java.util.Set;
import javax.validation.ConstraintViolation;
import javax.validation.ConstraintViolationException;
import javax.validation.Validation;
import javax.validation.Validator;
import javax.validation.ValidatorFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import ch.sbb.esta.core.stereotype.Scope;
import ch.sbb.esta.core.stereotype.web.EstaViewModel;
import ch.sbb.esta.core.type.Email;
import ch.sbb.myapp.exception.TemplateErrorCode;
import ch.sbb.myapp.model.Customer;
import ch.sbb.myapp.model.CustomerStatus;
import ch.sbb.myapp.model.i18n.I18nMessageKey;
import ch.sbb.myapp.presentation.exception.SampleTranslateableFileCopyException;
/**
* ViewModel für den Primefaces Showcase.
*/
#EstaViewModel(scope = Scope.REQUEST)
public class ShowCaseViewModel {
private static final Logger LOGGER = LoggerFactory.getLogger(ShowCaseViewModel.class);
public boolean isMcaIntegrationInClasspath() {
try {
this.getClass().getClassLoader().loadClass("ch.sbb.myapp.presentation.McaDemoViewModel");
return true;
} catch (ClassNotFoundException e) { // NOSONAR: is just a check whether MCA integration is on the classpath
return false;
}
}
public CustomerStatus getCustomerStatusNull() {
return null;
}
public void setCustomerStatusNull(CustomerStatus t) {
}
public CustomerStatus getCustomerStatus() {
return CustomerStatus.VIP;
}
public void throwEstaException() throws SampleTranslateableFileCopyException {
throw new SampleTranslateableFileCopyException(I18nMessageKey.ERROR_WHILE_CALLING_SERVICE,
TemplateErrorCode.FILE_COPY_ERROR_CODE, "fileA", "fileB");
}
public void logValidationException() {
Customer wrongCustomer = new Customer("fi", "la", new Email("bla#sbb.ch"));
ValidatorFactory factory = Validation.buildDefaultValidatorFactory();
Validator validator = factory.getValidator();
Set<ConstraintViolation<Customer>> violations = validator.validate(wrongCustomer);
Set<ConstraintViolation<?>> violationsWithoutType = new HashSet<>();
violationsWithoutType.addAll(violations);
LOGGER.warn("violated exception", new ConstraintViolationException("bla", violationsWithoutType));
}
}
The annotation #EstaViewModel is declared as a simple #Component:
#Inherited
#Component
#Retention(RetentionPolicy.RUNTIME)
#Target({ ElementType.TYPE })
public #interface EstaViewModel {
String value() default "";
Scope scope() default Scope.REQUEST;
}
All other classes with the #EstaViewModel annotation are initialized without any problem.
Any ideas?

"Building your first app" run time errors with Eclipse-ADT

I'm working on the "Building Your First App" under Android's app creation training. I have completed all the steps, and am running the app through my Galaxy S4. It loads the first page entirely where the user enters in whatever they like, and then takes you to the second page displaying what the user typed in. Loading the second page is where things go wrong.
02-07 16:21:06.167: W/dalvikvm(21946): threadid=1: thread exiting with uncaught exception (group=0x417a4898)
02-07 16:21:06.177: E/AndroidRuntime(21946): FATAL EXCEPTION: main
02-07 16:21:06.177: E/AndroidRuntime(21946): java.lang.IllegalStateException: Could not find a method sendmessage(View) in the activity class com.example.myfirstapp.MainActivity for onClick handler on view class android.widget.Button
02-07 16:21:06.177: E/AndroidRuntime(21946): at android.view.View$1.onClick(View.java:3825)
02-07 16:21:06.177: E/AndroidRuntime(21946): at android.view.View.performClick(View.java:4475)
02-07 16:21:06.177: E/AndroidRuntime(21946): at android.view.View$PerformClick.run(View.java:18786)
02-07 16:21:06.177: E/AndroidRuntime(21946): at android.os.Handler.handleCallback(Handler.java:730)
02-07 16:21:06.177: E/AndroidRuntime(21946): at android.os.Handler.dispatchMessage(Handler.java:92)
02-07 16:21:06.177: E/AndroidRuntime(21946): at android.os.Looper.loop(Looper.java:137)
02-07 16:21:06.177: E/AndroidRuntime(21946): at android.app.ActivityThread.main(ActivityThread.java:5419)
02-07 16:21:06.177: E/AndroidRuntime(21946): at java.lang.reflect.Method.invokeNative(Native Method)
02-07 16:21:06.177: E/AndroidRuntime(21946): at java.lang.reflect.Method.invoke(Method.java:525)
02-07 16:21:06.177: E/AndroidRuntime(21946): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1187)
02-07 16:21:06.177: E/AndroidRuntime(21946): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
02-07 16:21:06.177: E/AndroidRuntime(21946): at dalvik.system.NativeStart.main(Native Method)
02-07 16:21:06.177: E/AndroidRuntime(21946): Caused by: java.lang.NoSuchMethodException: sendmessage [class android.view.View]
02-07 16:21:06.177: E/AndroidRuntime(21946): at java.lang.Class.getConstructorOrMethod(Class.java:423)
02-07 16:21:06.177: E/AndroidRuntime(21946): at java.lang.Class.getMethod(Class.java:787)
02-07 16:21:06.177: E/AndroidRuntime(21946): at android.view.View$1.onClick(View.java:3818)
02-07 16:21:06.177: E/AndroidRuntime(21946): ... 11 more
I'm a little overwhelmed on where to even start alleviating this problem..
active_display_message.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
tools:context=".DisplayMessageActivity" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/hello_world" />
This is the onCreate() under the DisplayMessageActivity class:
#SuppressLint("NewApi")
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//Get the message from the intent
Intent intent = getIntent();
String message = intent.getStringExtra(MainActivity.EXTRA_MESSAGE);
//Create the text view
TextView textView = new TextView(this);
textView.setTextSize(40);
textView.setText(message);
//set the text view as the activity layout
setContentView(textView);
setContentView(R.layout.activity_display_message);
// Make sure we're running on Honeycomb or higher to use ActionBar APIs
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB){
// Show the Up button in the action bar.
getActionBar().setDisplayHomeAsUpEnabled(true);
}
}

Resources