Search Results

Search found 2343 results on 94 pages for 'masterchris 99'.

Page 85/94 | < Previous Page | 81 82 83 84 85 86 87 88 89 90 91 92  | Next Page >

  • Is Fast Enumeration messing with my text output?

    - by Dan Ray
    Here I am iterating through an array of NSDictionary objects (inside the parsed JSON response of the EXCELLENT MapQuest directions API). I want to build up an HTML string to put into a UIWebView. My code says: for (NSDictionary *leg in legs ) { NSString *thisLeg = [NSString stringWithFormat:@"<br>%@ - %@", [leg valueForKey:@"narrative"], [leg valueForKey:@"distance"]]; NSLog(@"This leg's string is %@", thisLeg); [directionsOutput appendString:thisLeg]; } The content of directionsOutput (which is an NSMutableString) contains ALL the values for [leg valueForKey:@"narrative"], wrapped up in parens, followed by a hyphen, followed by all the parenthesized values for [leg valueForKey:@"distance"]. So I put in that NSLog call... and I get the same thing there! It appears that the for() is somehow batching up our output values as we iterate, and putting out the output only once. How do I make it not do this but instead do what I actually want, which is an iterative output as I iterate? Here's what NSLog gets. Yes, I know I need to figure out NSNumberFormatter. ;-) This leg's string is ( "Start out going NORTH on INFINITE LOOP.", "Turn LEFT to stay on INFINITE LOOP.", "Turn RIGHT onto N DE ANZA BLVD.", "Merge onto I-280 S toward SAN JOSE.", "Merge onto CA-87 S via EXIT 3A.", "Take the exit on the LEFT.", "Merge onto CA-85 S via EXIT 1A on the LEFT toward GILROY.", "Merge onto US-101 S via EXIT 1A on the LEFT toward LOS ANGELES.", "Take the CA-152 E/10TH ST exit, EXIT 356.", "Turn LEFT onto CA-152/E 10TH ST/PACHECO PASS HWY. Continue to follow CA-152/PACHECO PASS HWY.", "Turn SLIGHT RIGHT.", "Turn SLIGHT RIGHT onto PACHECO PASS HWY/CA-152 E. Continue to follow CA-152 E.", "Merge onto I-5 S toward LOS ANGELES.", "Take the CA-46 exit, EXIT 278, toward LOST HILLS/WASCO.", "Turn LEFT onto CA-46/PASO ROBLES HWY. Continue to follow CA-46.", "Merge onto CA-99 S toward BAKERSFIELD.", "Merge onto CA-58 E via EXIT 24 toward TEHACHAPI/MOJAVE.", "Merge onto I-15 N via the exit on the LEFT toward I-40/LAS VEGAS.", "Keep RIGHT to take I-40 E via EXIT 140A toward NEEDLES (Passing through ARIZONA, NEW MEXICO, TEXAS, OKLAHOMA, and ARKANSAS, then crossing into TENNESSEE).", "Merge onto I-40 E via EXIT 12C on the LEFT toward NASHVILLE (Crossing into NORTH CAROLINA).", "Merge onto I-40 BR E/US-421 S via EXIT 188 on the LEFT toward WINSTON-SALEM.", "Take the CLOVERDALE AVE exit, EXIT 4.", "Turn LEFT onto CLOVERDALE AVE SW.", "Turn SLIGHT LEFT onto N HAWTHORNE RD.", "Turn RIGHT onto W NORTHWEST BLVD.", "1047 W NORTHWEST BLVD is on the LEFT." ) - ( 0.0020000000949949026, 0.07800000160932541, 0.14000000059604645, 7.827000141143799, 5.0329999923706055, 0.15299999713897705, 5.050000190734863, 20.871000289916992, 0.3050000071525574, 2.802999973297119, 0.10199999809265137, 37.78000259399414, 124.50700378417969, 0.3970000147819519, 25.264001846313477, 20.475000381469727, 125.8580093383789, 4.538000106811523, 1693.0350341796875, 628.8970336914062, 3.7990000247955322, 0.19099999964237213, 0.4099999964237213, 0.257999986410141, 0.5170000195503235, 0 )

    Read the article

  • NPE when drawing TabWidget in android (only on HTC Magic?)

    - by David Hedlund
    I've received report from the user of an app I've written that he gets FC whenever starting a certain activity. I have not been able to reproduce the issue on the emulator or on my HTC Hero (running 1.5), but this user running HTC Magic (with 1.6) is facing this error every time. What bothers me is that no single step in the stacktrace actually includes any code in my app (com.filmtipset) 01-07 00:10:26.773 I/ActivityManager( 141): Starting activity: Intent { cmp=com.filmtipset/.ViewMovie (has extras) } 01-07 00:10:27.023 D/AndroidRuntime( 2402): Shutting down VM 01-07 00:10:27.023 W/dalvikvm( 2402): threadid=3: thread exiting with uncaught exception (group=0x4001e170) 01-07 00:10:27.023 E/AndroidRuntime( 2402): Uncaught handler: thread main exiting due to uncaught exception 01-07 00:10:27.083 E/AndroidRuntime( 2402): java.lang.NullPointerException 01-07 00:10:27.083 E/AndroidRuntime( 2402): at android.widget.TabWidget.dispatchDraw(TabWidget.java:173) 01-07 00:10:27.083 E/AndroidRuntime( 2402): at android.view.ViewGroup.drawChild(ViewGroup.java:1529) 01-07 00:10:27.083 E/AndroidRuntime( 2402): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1258) 01-07 00:10:27.083 E/AndroidRuntime( 2402): at android.view.ViewGroup.drawChild(ViewGroup.java:1529) 01-07 00:10:27.083 E/AndroidRuntime( 2402): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1258) 01-07 00:10:27.083 E/AndroidRuntime( 2402): at android.view.ViewGroup.drawChild(ViewGroup.java:1529) 01-07 00:10:27.083 E/AndroidRuntime( 2402): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1258) 01-07 00:10:27.083 E/AndroidRuntime( 2402): at android.view.View.draw(View.java:6552) 01-07 00:10:27.083 E/AndroidRuntime( 2402): at android.widget.FrameLayout.draw(FrameLayout.java:352) 01-07 00:10:27.083 E/AndroidRuntime( 2402): at android.view.ViewGroup.drawChild(ViewGroup.java:1531) 01-07 00:10:27.083 E/AndroidRuntime( 2402): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1258) 01-07 00:10:27.083 E/AndroidRuntime( 2402): at android.view.View.draw(View.java:6552) 01-07 00:10:27.083 E/AndroidRuntime( 2402): at android.widget.FrameLayout.draw(FrameLayout.java:352) 01-07 00:10:27.083 E/AndroidRuntime( 2402): at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:1883) 01-07 00:10:27.083 E/AndroidRuntime( 2402): at android.view.ViewRoot.draw(ViewRoot.java:1332) 01-07 00:10:27.083 E/AndroidRuntime( 2402): at android.view.ViewRoot.performTraversals(ViewRoot.java:1097) 01-07 00:10:27.083 E/AndroidRuntime( 2402): at android.view.ViewRoot.handleMessage(ViewRoot.java:1613) 01-07 00:10:27.083 E/AndroidRuntime( 2402): at android.os.Handler.dispatchMessage(Handler.java:99) 01-07 00:10:27.083 E/AndroidRuntime( 2402): at android.os.Looper.loop(Looper.java:123) 01-07 00:10:27.083 E/AndroidRuntime( 2402): at android.app.ActivityThread.main(ActivityThread.java:4320) 01-07 00:10:27.083 E/AndroidRuntime( 2402): at java.lang.reflect.Method.invokeNative(Native Method) 01-07 00:10:27.083 E/AndroidRuntime( 2402): at java.lang.reflect.Method.invoke(Method.java:521) 01-07 00:10:27.083 E/AndroidRuntime( 2402): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791) 01-07 00:10:27.083 E/AndroidRuntime( 2402): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549) 01-07 00:10:27.083 E/AndroidRuntime( 2402): at dalvik.system.NativeStart.main(Native Method) Full dump here if I've missed anything of interest I'm guessing, then, that there might be something wrong with my layout. It's quite verbose, so I'm posting it here, rather than pasting the whole thing on SO. There is a tabwidget, where one tab is connected to the scrollview, svFilmInfo, and one to the linear layout llComments. The tab host is populated as such: Drawable commentSelector = getResources().getDrawable(R.drawable.tabcomment); Drawable infoSelector = getResources().getDrawable(R.drawable.tabinfo); mTabHost = getTabHost(); mTabHost.getTabWidget().setBackgroundColor(Color.BLACK); mTabHost.addTab(mTabHost.newTabSpec("tabInfo").setIndicator("Filminfo", infoSelector).setContent(R.id.svFilmInfo)); mTabHost.addTab(mTabHost.newTabSpec("tabInfo").setIndicator("Kommentarer", commentSelector).setContent(R.id.llComments)); Since I cannot reproduce the error myself, and since I cannot find any mention in the stack trace of what might be causing the error, I don't quite know where to start troubleshooting this. I'd appreciate any pointers.

    Read the article

  • JOptionPane opening another JFrame

    - by mike_hornbeck
    So I'm continuing my fight with this : http://stackoverflow.com/questions/2923545/creating-java-dialogs/2926126 task. Now my JOptionPane opens new window with envelope overfiew, but I can't change size of this window. Also I wanted to have sender's data in upper left corner, and receiver's data in bottom right. How can I achieve that ? There is also issue with OptionPane itself. After I click 'OK' it opens small window in the upper left corner of the screen. What is this and why it's appearing ? My code: import java.awt.*; import java.awt.Font; import javax.swing.*; public class Main extends JFrame { private static JTextField nameField = new JTextField(20); private static JTextField surnameField = new JTextField(); private static JTextField addr1Field = new JTextField(); private static JTextField addr2Field = new JTextField(); private static JComboBox sizes = new JComboBox(new String[] { "small", "medium", "large", "extra-large" }); public Main(){ JPanel mainPanel = new JPanel(); mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS)); getContentPane().add(mainPanel); JPanel addrPanel = new JPanel(new GridLayout(0, 1)); addrPanel.setBorder(BorderFactory.createTitledBorder("Receiver")); addrPanel.add(new JLabel("Name")); addrPanel.add(nameField); addrPanel.add(new JLabel("Surname")); addrPanel.add(surnameField); addrPanel.add(new JLabel("Address 1")); addrPanel.add(addr1Field); addrPanel.add(new JLabel("Address 2")); addrPanel.add(addr2Field); mainPanel.add(addrPanel); mainPanel.add(new JLabel(" ")); mainPanel.add(sizes); String[] buttons = { "OK", "Cancel"}; int c = JOptionPane.showOptionDialog( null, mainPanel, "My Panel", JOptionPane.DEFAULT_OPTION, JOptionPane.PLAIN_MESSAGE, null, buttons, buttons[0] ); if(c ==0){ new Envelope(nameField.getText(), surnameField.getText(), addr1Field.getText() , addr2Field.getText(), sizes.getSelectedIndex()); } setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); pack(); setVisible(true); } public static void main(String[] args) { new Main(); } } class Envelope extends JFrame { private final int SMALL=0; private final int MEDIUM=1; private final int LARGE=2; private final int XLARGE=3; public Envelope(String n, String s, String a1, String a2, int i){ Container content = getContentPane(); JPanel mainPanel = new JPanel(); mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS)); mainPanel.add(new JLabel("John Doe")); mainPanel.add(new JLabel("FooBar str 14")); mainPanel.add(new JLabel("Newark, 45-99")); JPanel dataPanel = new JPanel(); dataPanel.setFont(new Font("sansserif", Font.PLAIN, 32)); //set size from i mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS)); mainPanel.setBackground(Color.ORANGE); mainPanel.add(new JLabel("Mr "+n+" "+s)); mainPanel.add(new JLabel(a1)); mainPanel.add(new JLabel(a2)); content.setSize(450, 600); content.setBackground(Color.ORANGE); content.add(mainPanel, BorderLayout.NORTH); content.add(dataPanel, BorderLayout.SOUTH); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); pack(); setVisible(true); } }

    Read the article

  • Is this a right way to use NHibernate?

    - by Venemo
    I spent the rest of the evening reading StackOverflow questions and also some blog entries and links about the subject. All of them turned out to be very helpful, but I still feel that they don't really answer my question. So, I'm developing a simple web application. I'd like to create a reusable data access layer which I can later reuse in other solutions. 99% of these will be web applications. This seems to be a good excuse for me to learn NHibernate and some of the patterns around it. My goals are the following: I don't want the business logic layer to know ANYTHING about the inner workings of the database, nor NHibernate itself. I want the business logic layer to have the least possible number of assumptions about the data access layer. I want the data access layer as simplistic and easy-to-use as possible. This is going to be a simple project, so I don't want to overcomplicate anything. I want the data access layer to be as non-intrusive as possible. Will all this in mind, I decided to use the popular repository pattern. I read about this subject on this site and on various dev blogs, and I heard some stuff about the unit of work pattern. I also looked around and checked out various implementations. (Including FubuMVC contrib, and SharpArchitecture, and stuff on some blogs.) I found out that most of these operate with the same principle: They create a "unit of work" which is instantiated when a repository is instantiated, they start a transaction, do stuff, and commit, and then start all over again. So, only one ISession per Repository and that's it. Then the client code needs to instantiate a repository, do stuff with it, and then dispose. This usage pattern doesn't meet my need of being as simplistic as possible, so I began thinking about something else. I found out that NHibernate already has something which makes custom "unit of work" implementations unnecessary, and that is the CurrentSessionContext class. If I configure the session context correctly, and do the clean up when necessary, I'm good to go. So, I came up with this: I have a static class called NHibernateHelper. Firstly, it has a static property called CurrentSessionFactory, which upon first call, instantiates a session factory and stores it in a static field. (One ISessionFactory per one AppDomain is good enough.) Then, more importantly, it has a CurrentSession static property, which checks if there is an ISession bound to the current session context, and if not, creates one, and binds it, and it returns with the ISession bound to the current session context. Because it will be used mostly with WebSessionContext (so, one ISession per HttpRequest, although for the unit tests, I configured ThreadStaticSessionContext), it should work seamlessly. And after creating and binding an ISession, it hooks an event handler to the HttpContext.Current.ApplicationInstance.EndRequest event, which takes care of cleaning up the ISession after the request ends. (Of course, it only does this if it is really running in a web environment.) So, with all this set up, the NHibernateHelper will always be able to return a valid ISession, so there is no need to instantiate a Repository instance for the "unit of work" to operate properly. Instead, the Repository is a static class which operates with the ISession from the NHibernateHelper.CurrentSession property, and exposes some functionality through that. I'm curious, what do you think about this? Is it a valid way of thinking, or am I completely off track here?

    Read the article

  • Android Google-Shopping API force closes while parsing

    - by Sam Jackson
    I'm trying to send a request to the Google-Shopping API with the following static method which I think is working: public static String GET_TITLE(String url) throws JSONException { InputStream is = null; String result = ""; JSONObject jArray = null; // http post try { HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost(url); HttpResponse response = httpclient.execute(httppost); HttpEntity entity = response.getEntity(); is = entity.getContent(); } catch(Exception e) { Log.e("log_tag", "Error in http connection "+e.toString()); } The URL I'm passing is this BTW: https://www.googleapis.com/shopping/search/v1/public/products/country=US&q=shirts&alt=json &rankBy=relevancy&key=AIzaSyDRKgGmJrdG6pV6DIg2m-nmIbXydxvpjww Next I try to parse this response (where I think the problem comes in) in the same method: try { jArray = new JSONObject(result); } catch(JSONException e){ Log.e("log_tag", "Error parsing data "+e.toString()); } JSONObject itemObject = jArray.getJSONObject("items"); JSONObject productObject = itemObject.getJSONObject("product"); String attributeGoogleId = productObject.getString("googleId"); String attributeProviderId = productObject.getString("providerId"); String attributeTitle = productObject.getString("title");*/ String attributePrice = productObject.getString("price"); JSONObject popupObject = productObject.getJSONObject("popup"); return attributeTitle; } This has been so frustrating, I know it should be simple but everywhere I look I just can't quite get it to work, I'm not exactly sure what the error is since I'm testing it on my HTC Desire because my emulator gives an 'invalid command-line parameter' error when starting, but that's a different issue, anyway, thanks in advance! EDIT: The first one makes it look like there's a problem with the URL, should I change it and see if it makes a difference? 04-01 12:09:05.142: ERROR/log_tag(24968): Error in http connection java.net.UnknownHostException: www.googleapis.com 04-01 12:09:05.142: ERROR/log_tag(24968): Error converting result java.lang.NullPointerException 04-01 12:09:05.142: ERROR/log_tag(24968): Error parsing data org.json.JSONException: End of input at character 0 of 04-01 12:09:05.142: DEBUG/AndroidRuntime(24968): Shutting down VM 04-01 12:09:05.142: WARN/dalvikvm(24968): threadid=1: thread exiting with uncaught exception (group=0x400259f8) 04-01 12:09:05.152: ERROR/AndroidRuntime(24968): FATAL EXCEPTION: main 04-01 12:09:05.152: ERROR/AndroidRuntime(24968): java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=0, result=-1, data=Intent { act=com.google.zxing.client.android.SCAN flg=0x80000 (has extras) }} to activity {com.spectrum.stock/com.spectrum.stock.CaptureActivity}: java.lang.NullPointerException 04-01 12:09:05.152: ERROR/AndroidRuntime(24968): at android.app.ActivityThread.deliverResults(ActivityThread.java:3734) 04-01 12:09:05.152: ERROR/AndroidRuntime(24968): at android.app.ActivityThread.handleSendResult(ActivityThread.java:3776) 04-01 12:09:05.152: ERROR/AndroidRuntime(24968): at android.app.ActivityThread.access$2800(ActivityThread.java:135) 04-01 12:09:05.152: ERROR/AndroidRuntime(24968): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2166) 04-01 12:09:05.152: ERROR/AndroidRuntime(24968): at android.os.Handler.dispatchMessage(Handler.java:99) 04-01 12:09:05.152: ERROR/AndroidRuntime(24968): at android.os.Looper.loop(Looper.java:144) 04-01 12:09:05.152: ERROR/AndroidRuntime(24968): at android.app.ActivityThread.main(ActivityThread.java:4937) 04-01 12:09:05.152: ERROR/AndroidRuntime(24968): at java.lang.reflect.Method.invokeNative(Native Method) 04-01 12:09:05.152: ERROR/AndroidRuntime(24968): at java.lang.reflect.Method.invoke(Method.java:521) 04-01 12:09:05.152: ERROR/AndroidRuntime(24968): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868) 04-01 12:09:05.152: ERROR/AndroidRuntime(24968): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626) 04-01 12:09:05.152: ERROR/AndroidRuntime(24968): at dalvik.system.NativeStart.main(Native Method) 04-01 12:09:05.152: ERROR/AndroidRuntime(24968): Caused by: java.lang.NullPointerException 04-01 12:09:05.152: ERROR/AndroidRuntime(24968): at com.spectrum.stock.JSONResponse.GET_TITLE(JSONResponse.java:61) 04-01 12:09:05.152: ERROR/AndroidRuntime(24968): at com.spectrum.stock.CaptureActivity.onActivityResult(CaptureActivity.java:78) 04-01 12:09:05.152: ERROR/AndroidRuntime(24968): at android.app.Activity.dispatchActivityResult(Activity.java:3931) 04-01 12:09:05.152: ERROR/AndroidRuntime(24968): at android.app.ActivityThread.deliverResults(ActivityThread.java:3730) 04-01 12:09:05.152: ERROR/AndroidRuntime(24968): ... 11 more 04-01 12:09:05.162: WARN/ActivityManager(96): Force finishing activity com.spectrum.stock/.CaptureActivity

    Read the article

  • "Attach or Add an entity that is not new...loaded from another DataContext. This is not supported."

    - by sah302
    Similar error as other questions, but not quite the same, I am not trying to attach anything. What I am trying to do is insert a new row into a linking table, specifically UserAccomplishment. Relations are set in LINQ to User and Accomplishment Tables. I have a generic insert function: Public Function insertRow(ByVal entity As ImplementationType) As Boolean If entity IsNot Nothing Then Dim lcfdatacontext As New LCFDataContext() Try lcfdatacontext.GetTable(Of ImplementationType)().InsertOnSubmit(entity) lcfdatacontext.SubmitChanges() lcfdatacontext.Dispose() Return True Catch ex As Exception Return False End Try Else Return False End If End Function If you try and give UserAccomplishment the two appropriate objects this will naturally crap out if either the User or Accomplishment already exist. It only works when both user and accomplishment don't exist. I expected this behavior. What does work is simply giving the userAccomplishment object a user.id and accomplishment.id and populating the rest of the fields. This works but is kind of awkward to use in my app, it would be much easier to simply pass in both objects and have it work out what already exists and what doesn't. Okay so I made the following (please ignore the fact that this is horribly inefficient because I know it is): Public Class UserAccomplishmentDao Inherits EntityDao(Of UserAccomplishment) Public Function insertLinkerObjectRow(ByVal userAccomplishment As UserAccomplishment) Dim insertSuccess As Boolean = False If Not userAccomplishment Is Nothing Then Dim userDao As New UserDao() Dim accomplishmentDao As New AccomplishmentDao() Dim user As New User() Dim accomplishment As New Accomplishment() 'see if either object already exists in db' user = userDao.getOneByValueOfProperty("Id", userAccomplishment.User.Id) accomplishment = accomplishmentDao.getOneByValueOfProperty("Id", userAccomplishment.Accomplishment.Id) If user Is Nothing And accomplishment Is Nothing Then 'neither the user or the accomplishment exist, both are new so insert them both, typical insert' insertSuccess = Me.insertRow(userAccomplishment) ElseIf user Is Nothing And Not accomplishment Is Nothing Then 'user is new, accomplishment is not new, so just insert the user, and the relation in userAccomplishment' Dim userWithExistingAccomplishment As New UserAccomplishment(userAccomplishment.User, userAccomplishment.Accomplishment.Id, userAccomplishment.LastUpdatedBy) insertSuccess = Me.insertRow(userWithExistingAccomplishment) ElseIf Not user Is Nothing And accomplishment Is Nothing Then 'user is not new, accomplishment is new, so just insert the accomplishment, and the relation in userAccomplishment' Dim existingUserWithAccomplishment As New UserAccomplishment(userAccomplishment.UserId, userAccomplishment.Accomplishment, userAccomplishment.LastUpdatedBy) insertSuccess = Me.insertRow(existingUserWithAccomplishment) Else 'both are not new, just add the relation' Dim userAccomplishmentBothExist As New UserAccomplishment(userAccomplishment.User.Id, userAccomplishment.Accomplishment.Id, userAccomplishment.LastUpdatedBy) insertSuccess = Me.insertRow(userAccomplishmentBothExist) End If End If Return insertSuccess End Function End Class Alright, here I basically check if the supplied user and accomplishment already exists in the db, and if so call an appropriate constructor that will leave whatever already exists empty, but supply the rest of the information so the insert can succeed. However, upon trying an insert: Dim result As Boolean = Me.userAccomplishmentDao.insertLinkerObjectRow(userAccomplishment) In which the user already exists, but the accomplishment does not (the 99% typical scenario) I get the error: "An attempt has been made to Attach or Add an entity that is not new, perhaps having been loaded from another DataContext. This is not supported." I have debugged this multiple times now and am not sure why this is occuring, if either User or Accomplishment exist, I am not including it in the final object to try to insert. So nothing appears to be attempted to be added. Even in debug, upon insert, the object was set to empty. So the accomplishment is new and the user is empty. 1) Why is it still saying that and how can I fix it ..using my current structure 2) Pre-emptive 'use repository pattern answers' - I know this way kind of sucks in general and I should be using the repository pattern. However, I can't use that in the current project because I don't have time to refactor that due to my non existence knowledge of it and time constraints. The usage of the app is going to so small that the inefficient use of datacontext's and what have you won't matter so much. I can refactor it once it's up and running, but for now I just need to 'push through' with my current structure. Edit: I also just tested this when having both already exists, and only insert each object's IDs into the table, that works. So I guess I could manually insert whichever object doesn't exist as a single insert, then put the ids only into the linking table, but I still don't know why when one object exists, and I make it empty, it doens't work.

    Read the article

  • java.lang.OutOfMemoryError: bitmap size exceeds VM budget

    - by Angel
    Hi, I am trying to change the layout of my application from portrait to landscape and vice-versa. But if i do it frequently or more than once then at times my application crashes.. Below is the error log. Please suggest what can be done? < 01-06 09:52:27.787: ERROR/dalvikvm-heap(17473): 1550532-byte external allocation too large for this process. 01-06 09:52:27.787: ERROR/dalvikvm(17473): Out of memory: Heap Size=6471KB, Allocated=4075KB, Bitmap Size=9564KB 01-06 09:52:27.787: ERROR/(17473): VM won't let us allocate 1550532 bytes 01-06 09:52:27.798: DEBUG/skia(17473): --- decoder-decode returned false 01-06 09:52:27.798: DEBUG/AndroidRuntime(17473): Shutting down VM 01-06 09:52:27.798: WARN/dalvikvm(17473): threadid=3: thread exiting with uncaught exception (group=0x4001e390) 01-06 09:52:27.807: ERROR/AndroidRuntime(17473): Uncaught handler: thread main exiting due to uncaught exception 01-06 09:52:27.857: ERROR/AndroidRuntime(17473): java.lang.RuntimeException: Unable to start activity ComponentInfo{}: android.view.InflateException: Binary XML file line #2: Error inflating class 01-06 09:52:27.857: ERROR/AndroidRuntime(17473): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2596) 01-06 09:52:27.857: ERROR/AndroidRuntime(17473): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2621) 01-06 09:52:27.857: ERROR/AndroidRuntime(17473): at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:3812) 01-06 09:52:27.857: ERROR/AndroidRuntime(17473): at android.app.ActivityThread.access$2300(ActivityThread.java:126) 01-06 09:52:27.857: ERROR/AndroidRuntime(17473): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1936) 01-06 09:52:27.857: ERROR/AndroidRuntime(17473): at android.os.Handler.dispatchMessage(Handler.java:99) 01-06 09:52:27.857: ERROR/AndroidRuntime(17473): at android.os.Looper.loop(Looper.java:123) 01-06 09:52:27.857: ERROR/AndroidRuntime(17473): at android.app.ActivityThread.main(ActivityThread.java:4595) 01-06 09:52:27.857: ERROR/AndroidRuntime(17473): at java.lang.reflect.Method.invokeNative(Native Method) 01-06 09:52:27.857: ERROR/AndroidRuntime(17473): at java.lang.reflect.Method.invoke(Method.java:521) 01-06 09:52:27.857: ERROR/AndroidRuntime(17473): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860) 01-06 09:52:27.857: ERROR/AndroidRuntime(17473): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618) 01-06 09:52:27.857: ERROR/AndroidRuntime(17473): at dalvik.system.NativeStart.main(Native Method) 01-06 09:52:27.857: ERROR/AndroidRuntime(17473): Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class 01-06 09:52:27.857: ERROR/AndroidRuntime(17473): at android.view.LayoutInflater.createView(LayoutInflater.java:513) 01-06 09:52:27.857: ERROR/AndroidRuntime(17473): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56) 01-06 09:52:27.857: ERROR/AndroidRuntime(17473): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563) 01-06 09:52:27.857: ERROR/AndroidRuntime(17473): at android.view.LayoutInflater.inflate(LayoutInflater.java:385) 01-06 09:52:27.857: ERROR/AndroidRuntime(17473): at android.view.LayoutInflater.inflate(LayoutInflater.java:320) 01-06 09:52:27.857: ERROR/AndroidRuntime(17473): at android.view.LayoutInflater.inflate(LayoutInflater.java:276) 01-06 09:52:27.857: ERROR/AndroidRuntime(17473): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:207) 01-06 09:52:27.857: ERROR/AndroidRuntime(17473): at android.app.Activity.setContentView(Activity.java:1629) 01-06 09:52:27.857: ERROR/AndroidRuntime(17473): at onCreate(Game.java:98) 01-06 09:52:27.857: ERROR/AndroidRuntime(17473): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047) 01-06 09:52:27.857: ERROR/AndroidRuntime(17473): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2544) 01-06 09:52:27.857: ERROR/AndroidRuntime(17473): ... 12 more 01-06 09:52:27.857: ERROR/AndroidRuntime(17473): Caused by: java.lang.reflect.InvocationTargetException 01-06 09:52:27.857: ERROR/AndroidRuntime(17473): at android.widget.LinearLayout.(LinearLayout.java:92) 01-06 09:52:27.857: ERROR/AndroidRuntime(17473): at java.lang.reflect.Constructor.constructNative(Native Method) 01-06 09:52:27.857: ERROR/AndroidRuntime(17473): at java.lang.reflect.Constructor.newInstance(Constructor.java:446) 01-06 09:52:27.857: ERROR/AndroidRuntime(17473): at android.view.LayoutInflater.createView(LayoutInflater.java:500) 01-06 09:52:27.857: ERROR/AndroidRuntime(17473): ... 22 more 01-06 09:52:27.857: ERROR/AndroidRuntime(17473): Caused by: java.lang.OutOfMemoryError: bitmap size exceeds VM budget 01-06 09:52:27.857: ERROR/AndroidRuntime(17473): at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method) 01-06 09:52:27.857: ERROR/AndroidRuntime(17473): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:464) 01-06 09:52:27.857: ERROR/AndroidRuntime(17473): at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:340) 01-06 09:52:27.857: ERROR/AndroidRuntime(17473): at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:697) 01-06 09:52:27.857: ERROR/AndroidRuntime(17473): at android.content.res.Resources.loadDrawable(Resources.java:1705) 01-06 09:52:27.857: ERROR/AndroidRuntime(17473): at android.content.res.TypedArray.getDrawable(TypedArray.java:548) 01-06 09:52:27.857: ERROR/AndroidRuntime(17473): at android.view.View.(View.java:1850) 01-06 09:52:27.857: ERROR/AndroidRuntime(17473): at android.view.View.(View.java:1799) 01-06 09:52:27.857: ERROR/AndroidRuntime(17473): at android.view.ViewGroup.(ViewGroup.java:296) 01-06 09:52:27.857: ERROR/AndroidRuntime(17473): ... 26 more

    Read the article

  • Cannot decode complete cipher list in .NET SslStream handshake.

    - by karmasponge
    While attempting to move from a 'C' based SSL implementation to C# using the .NET SslStream and we have run into what look like cipher compatibility issues with the .NET SslStream and a AS400 machine we are trying to connect to (which worked previously). When we call SslStream.AuthenticateAsClient it is sending the following: 16 03 00 00 37 01 00 00 33 03 00 4d 2c 00 ee 99 4e 0c 5d 83 14 77 78 5c 0f d3 8f 8b d5 e6 b8 cd 61 0f 29 08 ab 75 03 f7 fa 7d 70 00 00 0c 00 05 00 0a 00 13 00 04 00 02 00 ff 01 00 Which decodes as (based on http://www.mozilla.org/projects/security/pki/nss/ssl/draft302.txt) [16] Record Type [03 00] SSL Version [00 37] Body length [01] SSL3_MT_CLIENT_HELLO [00 00 33] Length (51 bytes) [03 00] Version number = 768 [4d 2c 00 ee] 4 Bytes unix time [… ] 28 Bytes random number [00] Session number [00 0c] 12 bytes (2 * 6 Cyphers)? [00 05, 00 0a, 00 13, 00 04, 00 02, 00 ff] - [RC4, PBE-MD5-DES, RSA, MD5, PKCS, ???] [01 00] Null compression method The as400 server responds back with: 15 03 00 00 02 02 28 [15] SSL3_RT_ALERT [03 00] SSL Version [00 02] Body Length (2 Bytes) [02 28] 2 = SSL3_RT_FATAL, 40 = SSL3_AD_HANDSHAKE_FAILURE I'm specifically looking to decode the '00 FF' at the end of the cyphers. Have I decoded it correctly? What does, if anything, '00 FF' decode too? I am using the following code to test/reproduce: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Net.Sockets; using System.Net.Security; using System.Security.Authentication; using System.IO; using System.Diagnostics; using System.Security.Cryptography.X509Certificates; namespace TestSslStreamApp { class DebugStream : Stream { private Stream AggregatedStream { get; set; } public DebugStream(Stream stream) { AggregatedStream = stream; } public override bool CanRead { get { return AggregatedStream.CanRead; } } public override bool CanSeek { get { return AggregatedStream.CanSeek; } } public override bool CanWrite { get { return AggregatedStream.CanWrite; } } public override void Flush() { AggregatedStream.Flush(); } public override long Length { get { return AggregatedStream.Length; } } public override long Position { get { return AggregatedStream.Position; } set { AggregatedStream.Position = value; } } public override int Read(byte[] buffer, int offset, int count) { int bytesRead = AggregatedStream.Read(buffer, offset, count); return bytesRead; } public override long Seek(long offset, SeekOrigin origin) { return AggregatedStream.Seek(offset, origin); } public override void SetLength(long value) { AggregatedStream.SetLength(value); } public override void Write(byte[] buffer, int offset, int count) { AggregatedStream.Write(buffer, offset, count); } } class Program { static void Main(string[] args) { const string HostName = "as400"; TcpClient tcpClient = new TcpClient(HostName, 992); SslStream sslStream = new SslStream(new DebugStream(tcpClient.GetStream()), false, null, null, EncryptionPolicy.AllowNoEncryption); sslStream.AuthenticateAsClient(HostName, null, SslProtocols.Ssl3, false); } } }

    Read the article

  • The type '' was not mapped

    - by Mike
    I've been trying to fix this error for awhile now. I get this error any time my application tries to create an instance of my data context. Below is the code: using System; using System.Collections.Generic; using System.Linq; using System.Web; using RandomRentals.Models; using System.Data.Entity; namespace RandomRentals.Models { public class RentalContext : DbContext { public DbSet<Rental> Rentals { get; set; } public DbSet<Category> Categories { get; set; } public DbSet<Item> Items { get; set; } public DbSet<Billing> Billings { get; set; } public DbSet<User> Users { get; set; } public DbSet<Video> Videos { get; set; } public DbSet<Picture> Pictures { get; set; } public DbSet<ServiceType> ServiceTypes { get; set; } public DbSet<Rating> Ratings { get; set; } public DbSet<Business> Businesses { get; set; } public DbSet<BusinessHour> BusinessHours { get; set; } } } Here is the stack Trace: [InvalidOperationException: The type 'RandomRentals.Rental' was not mapped. Check that the type has not been explicitly excluded by using the Ignore method or NotMappedAttribute data annotation. Verify that the type was defined as a class, is not primitive, nested or generic, and does not inherit from EntityObject.] System.Data.Entity.Internal.DbSetDiscoveryService.GetSets() +706 System.Data.Entity.Internal.DbSetDiscoveryService.InitializeSets() +31 System.Data.Entity.DbContext.DiscoverAndInitializeSets() +56 System.Data.Entity.DbContext.InitializeLazyInternalContext(IInternalConnection internalConnection, DbCompiledModel model) +79 System.Data.Entity.DbContext..ctor() +99 RandomRentals.Models.RentalContext..ctor() +44 RandomRentals.Models.UserModel..ctor() in C:\Users\nikka\Desktop\RandomRentals\RandomRentals\Models\UserModel.cs:11 [TargetInvocationException: Exception has been thrown by the target of an invocation.] System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) +0 System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache) +98 System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean skipCheckThis, Boolean fillCache) +241 System.Activator.CreateInstance(Type type, Boolean nonPublic) +69 System.Web.Mvc.DefaultModelBinder.CreateModel(ControllerContext controllerContext, ModelBindingContext bindingContext, Type modelType) +199 System.Web.Mvc.DefaultModelBinder.BindComplexModel(ControllerContext controllerContext, ModelBindingContext bindingContext) +572 System.Web.Mvc.DefaultModelBinder.BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext) +449 System.Web.Mvc.ControllerActionInvoker.GetParameterValue(ControllerContext controllerContext, ParameterDescriptor parameterDescriptor) +317 System.Web.Mvc.ControllerActionInvoker.GetParameterValues(ControllerContext controllerContext, ActionDescriptor actionDescriptor) +117 System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +343 System.Web.Mvc.Controller.ExecuteCore() +116 System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +97 System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +10 System.Web.Mvc.<>c__DisplayClassb.<BeginProcessRequest>b__5() +37 System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +21 System.Web.Mvc.Async.<>c__DisplayClass8`1.<BeginSynchronous>b__7(IAsyncResult _) +12 System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62 System.Web.Mvc.<>c__DisplayClasse.<EndProcessRequest>b__d() +50 System.Web.Mvc.SecurityUtil.<GetCallInAppTrustThunk>b__0(Action f) +7 System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Action action) +22 System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +60 System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +8970061 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +184 Here is the full error text: The type 'RandomRentals.Rental' was not mapped. Check that the type has not been explicitly excluded by using the Ignore method or NotMappedAttribute data annotation. Verify that the type was defined as a class, is not primitive, nested or generic, and does not inherit from EntityObject. Any help would be greatly appreciated

    Read the article

  • Page_load event firing twice. User control not properly loading

    - by Phil
    Here is the code I am using to pull my usercontrol (content.ascx): Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load 'load module If TheModule = "content" Then Dim control As UserControl = LoadControl("~\Modules\Content.ascx") Controls.Add(control) End If End Sub Within the usercontrol is the following code (data access taken care of by DAAB and ive replaced sql statements with 'sql'): Imports System.Data.SqlClient Imports System.Data Imports System.Web.Configuration Imports Microsoft.Practices.EnterpriseLibrary.Common Imports Microsoft.Practices.EnterpriseLibrary.Data Partial Class Modules_WebUserControl Inherits System.Web.UI.UserControl Dim db As Database = DatabaseFactory.CreateDatabase() Dim command As SqlCommand 'database Dim reader As IDataReader 'general vars Dim pageid As Integer Dim did As Integer Dim contentid As Integer Dim dotpos As String Dim ext As String Dim content As String Dim folder As String Dim downloadstring As String Function getimage(ByVal strin As String) As String If strin > "" Then dotpos = InStrRev(strin, ".") ext = Right(strin, Len(strin) - dotpos) getimage = ext & ".gif" Else getimage = String.Empty End If Return getimage End Function Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load, Me.Load 'test Response.Write("(1 Test from within page_load)") 'get session vars folder = Session("folder") pageid = Session("pageid") did = Session("did") 'main content command = db.GetSqlStringCommand("sql") db.AddInParameter(command, "@pageid", DbType.Int32, pageid) reader = db.ExecuteReader(command) While reader.Read If reader("content") IsNot DBNull.Value Then content = Replace(reader("content"), Chr(38) + Chr(97) + Chr(109) + Chr(112) + Chr(59) + Chr(98) + Chr(104) + Chr(99) + Chr(112) + Chr(61) + Chr(49), "") If reader("id") IsNot DBNull.Value Then contentid = reader("id") End If Else contentid = -1 content = String.Empty End If End While Outputcontent.Text = content 'contacts info If did = 0 Then command = db.GetSqlStringCommand("sql") db.AddInParameter(command, "@contentid", DbType.Int32, contentid) reader = db.ExecuteReader(command) While reader.Read() Contactinforepeater.DataSource = reader Contactinforepeater.DataBind() End While End If If Not did = 0 Then command = (db.GetSqlStringCommand("sql") db.AddInParameter(command, "@contentid", DbType.Int32, contentid) db.AddInParameter(command, "@did", DbType.Int32, did) reader = db.ExecuteReader(command) While reader.Read Contactinforepeater.DataSource = reader Contactinforepeater.DataBind() End While End If 'downloads box command = db.GetSqlStringCommand("sql") db.AddInParameter(command, "@contentid", DbType.Int32, contentid) reader = db.ExecuteReader(command) While reader.Read If reader("filename") IsNot DBNull.Value Then downloadstring += "<a href='/documents/" & folder & "/" & reader("filename") & "'>" downloadstring += "<img src=images/" & getimage(reader("filename")) & " border=0 align=absmiddle />" End If If reader("filesize") IsNot DBNull.Value Then downloadstring += Convert.ToInt32((reader("filesize") / 1000)) & "kb - " End If If reader("filename") IsNot DBNull.Value Then downloadstring += "<a href='/documents/" & Session("folder") & "/" & reader("filename") & "'>" & reader("description") & "</a><br />" End If End While Dim downloadsarray As ArrayList downloadsarray = New ArrayList If downloadstring IsNot Nothing Then downloadsarray.Add(downloadstring) End If If downloadsarray.Count > 0 Then DownloadsRepeater.DataSource = downloadsarray DownloadsRepeater.DataBind() End If 'get links command = db.GetSqlStringCommand("sql") db.AddInParameter(command, "@contentid", DbType.Int32, contentid) reader = db.ExecuteReader(command) While reader.Read Linksrepeater.DataSource = reader Linksrepeater.DataBind() End While End Sub End Class Now instead of seeing my page content and what should be within the repeaters on the page all I get is 2 x the output of Response.Write("(1 Test from within page_load)") (1 Test from within page_load)(1 Test from within page_load) This leads me to believe the page_load is firing twice, but not properly displaying all the information. Please can one of you willing experts help me to get this working? Thanks a lot in advance

    Read the article

  • Android passing an arraylist back to parent activity

    - by Nicklas O
    Hi there. I've been searching for a simple example of this with no luck. In my android application I have two activities: 1. The main activity which is launched at startup 2. A second activity which is launched by pressing a button on the main activty. When the second activity is finished (by pressing a button) I want it to send back an ArrayList of type MyObject to the main activity and close itself, which the main activity can then do whatever with it. How would I go about achieving this? I have been trying a few things but it is crashing my application when I start the second activity. When the user presses button to launch second activity: Intent i = new Intent(MainActivity.this, secondactivity.class); startActivityForResult(i, 1); The array which is bundled back after pressing a button on the second activity: Intent intent= getIntent(); Bundle b = new Bundle(); b.putParcelableArrayList("myarraylist", mylist); intent.putExtras(b); setResult(RESULT_OK, intent); finish(); And finally a listener on the main activity (although I'm not sure of 100% when this code launches...) protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if(resultCode==RESULT_OK && requestCode==1){ Bundle extras = data.getExtras(); final ArrayList<MyObject> mylist = extras.getParcelableArrayList("myarraylist"); Toast.makeText(MainActivity.this, mylist.get(0).getName(), Toast.LENGTH_SHORT).show(); } } Any ideas where I am going wrong? The onActivityResult() seems to be crashing my application. EDIT: This is my class MyObject, its called plan and has a name and an id import android.os.Parcel; import android.os.Parcelable; public class Plan implements Parcelable{ private String name; private String id; public Plan(){ } public Plan(String name, String id){ this.name = name; this.id = id; } public String getName(){ return name; } public void setName(String name){ this.name = name; } public String getId(){ return id; } public void setId(String id){ this.id = id; } public String toString(){ return "Plan ID: " + id + " Plan Name: " + name; } @Override public int describeContents() { // TODO Auto-generated method stub return 0; } @Override public void writeToParcel(Parcel dest, int flags) { dest.writeString(id); dest.writeString(name); } public static final Parcelable.Creator<Plan> CREATOR = new Parcelable.Creator<Plan>() { public Plan createFromParcel(Parcel in) { return new Plan(); } @Override public Plan[] newArray(int size) { // TODO Auto-generated method stub return new Plan[size]; } }; } This is my logcat E/AndroidRuntime( 293): java.lang.RuntimeException: Unable to instantiate activ ity ComponentInfo{com.daniel.android.groupproject/com.me.android.projec t.secondactivity}: java.lang.NullPointerException E/AndroidRuntime( 293): at android.app.ActivityThread.performLaunchActiv ity(ActivityThread.java:2417) E/AndroidRuntime( 293): at android.app.ActivityThread.handleLaunchActivi ty(ActivityThread.java:2512) E/AndroidRuntime( 293): at android.app.ActivityThread.access$2200(Activi tyThread.java:119) E/AndroidRuntime( 293): at android.app.ActivityThread$H.handleMessage(Ac tivityThread.java:1863) E/AndroidRuntime( 293): at android.os.Handler.dispatchMessage(Handler.ja va:99) E/AndroidRuntime( 293): at android.os.Looper.loop(Looper.java:123) E/AndroidRuntime( 293): at android.app.ActivityThread.main(ActivityThrea d.java:4363) E/AndroidRuntime( 293): at java.lang.reflect.Method.invokeNative(Native Method) E/AndroidRuntime( 293): at java.lang.reflect.Method.invoke(Method.java:5 21) E/AndroidRuntime( 293): at com.android.internal.os.ZygoteInit$MethodAndA rgsCaller.run(ZygoteInit.java:860) E/AndroidRuntime( 293): at com.android.internal.os.ZygoteInit.main(Zygot eInit.java:618) E/AndroidRuntime( 293): at dalvik.system.NativeStart.main(Native Method) E/AndroidRuntime( 293): Caused by: java.lang.NullPointerException E/AndroidRuntime( 293): at com.daniel.android.groupproject.login.<init>( login.java:51) E/AndroidRuntime( 293): at java.lang.Class.newInstanceImpl(Native Method ) E/AndroidRuntime( 293): at java.lang.Class.newInstance(Class.java:1479) E/AndroidRuntime( 293): at android.app.Instrumentation.newActivity(Instr umentation.java:1021) E/AndroidRuntime( 293): at android.app.ActivityThread.performLaunchActiv ity(ActivityThread.java:2409) E/AndroidRuntime( 293): ... 11 more

    Read the article

  • null pointer exception when starting new activity

    - by acithium
    Okay, I'm getting a null pointer exception when I start my third activity. Here is the LogCat message: 12-28 04:38:00.350: ERROR/AndroidRuntime(776): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.acithium.main/com.acithium.rss.ShowDescription}: java.lang.NullPointerException 12-28 04:38:00.350: ERROR/AndroidRuntime(776): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2401) 12-28 04:38:00.350: ERROR/AndroidRuntime(776): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2417) 12-28 04:38:00.350: ERROR/AndroidRuntime(776): at android.app.ActivityThread.access$2100(ActivityThread.java:116) 12-28 04:38:00.350: ERROR/AndroidRuntime(776): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794) 12-28 04:38:00.350: ERROR/AndroidRuntime(776): at android.os.Handler.dispatchMessage(Handler.java:99) 12-28 04:38:00.350: ERROR/AndroidRuntime(776): at android.os.Looper.loop(Looper.java:123) 12-28 04:38:00.350: ERROR/AndroidRuntime(776): at android.app.ActivityThread.main(ActivityThread.java:4203) 12-28 04:38:00.350: ERROR/AndroidRuntime(776): at java.lang.reflect.Method.invokeNative(Native Method) 12-28 04:38:00.350: ERROR/AndroidRuntime(776): at java.lang.reflect.Method.invoke(Method.java:521) 12-28 04:38:00.350: ERROR/AndroidRuntime(776): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791) 12-28 04:38:00.350: ERROR/AndroidRuntime(776): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549) 12-28 04:38:00.350: ERROR/AndroidRuntime(776): at dalvik.system.NativeStart.main(Native Method) 12-28 04:38:00.350: ERROR/AndroidRuntime(776): Caused by: java.lang.NullPointerException 12-28 04:38:00.350: ERROR/AndroidRuntime(776): at com.acithium.rss.ShowDescription.onCreate(ShowDescription.java:48) 12-28 04:38:00.350: ERROR/AndroidRuntime(776): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1123) 12-28 04:38:00.350: ERROR/AndroidRuntime(776): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2364) 12-28 04:38:00.350: ERROR/AndroidRuntime(776): ... 11 more Here is the section of code where I call the activity: public void onItemClick(AdapterView parent, View v, int position, long id) { Log.i(tag,"item clicked! [" + feed.getItem(position).getTitle() + "]"); Intent itemintent = new Intent(this,com.acithium.rss.ShowDescription.class); //Intent itemintent = new Intent(); //itemintent.setClassName("com.acithium.main", "com.acithium.rss.ShowDescription"); Bundle b = new Bundle(); b.putString("title", feed.getItem(position).getTitle()); b.putString("description", feed.getItem(position).getDescription()); b.putString("link", feed.getItem(position).getLink()); itemintent.putExtra("android.intent.extra.INTENT", b); startActivityForResult(itemintent,0); } And here is new activity class that is called: public class ShowDescription extends Activity { public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.showdescription); String theStory = null; Intent startingIntent = getIntent(); if (startingIntent != null) { Bundle b = startingIntent.getBundleExtra("android.intent.extra.INTENT"); if (b == null) { theStory = "bad bundle?"; } else { theStory = b.getString("title") + "\n\n" + b.getString("description") + "\n\nMore information:\n" + b.getString("link"); } } else { theStory = "Information Not Found."; } TextView db= (TextView) findViewById(R.id.storybox); db.setText(theStory); Button backbutton = (Button) findViewById(R.id.back); backbutton.setOnClickListener(new Button.OnClickListener() { public void onClick(View v) { finish(); } }); } }

    Read the article

  • Proguard and two projects using the same android library. broadcasting. ClassNotFoundException

    - by trololo
    The problem:I have got 2 apps. The interact with each other via broadcasting. I have parcelable class in the android library (they send content of class in the library). So after using Proguard I have got ClassNotFondException. How to solve it? 07-03 02:13:51.832: E/AndroidRuntime(6801): FATAL EXCEPTION: main 07-03 02:13:51.832: E/AndroidRuntime(6801): java.lang.RuntimeException: Unable to start receiver <appname>.<name>.ar.free.BRMain: java.lang.RuntimeException: Parcelable encounteredClassNotFoundException reading a Serializable object (name = <appname>.a.a.b) 07-03 02:13:51.832: E/AndroidRuntime(6801): at android.app.ActivityThread.handleReceiver(ActivityThread.java:2277) 07-03 02:13:51.832: E/AndroidRuntime(6801): at android.app.ActivityThread.access$1500(ActivityThread.java:140) 07-03 02:13:51.832: E/AndroidRuntime(6801): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303) 07-03 02:13:51.832: E/AndroidRuntime(6801): at android.os.Handler.dispatchMessage(Handler.java:99) 07-03 02:13:51.832: E/AndroidRuntime(6801): at android.os.Looper.loop(Looper.java:137) 07-03 02:13:51.832: E/AndroidRuntime(6801): at android.app.ActivityThread.main(ActivityThread.java:4898) 07-03 02:13:51.832: E/AndroidRuntime(6801): at java.lang.reflect.Method.invokeNative(Native Method) 07-03 02:13:51.832: E/AndroidRuntime(6801): at java.lang.reflect.Method.invoke(Method.java:511) 07-03 02:13:51.832: E/AndroidRuntime(6801): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1006) 07-03 02:13:51.832: E/AndroidRuntime(6801): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773) 07-03 02:13:51.832: E/AndroidRuntime(6801): at dalvik.system.NativeStart.main(Native Method) 07-03 02:13:51.832: E/AndroidRuntime(6801): Caused by: java.lang.RuntimeException: Parcelable encounteredClassNotFoundException reading a Serializable object (name = <appname>.a.a.b) 07-03 02:13:51.832: E/AndroidRuntime(6801): at android.os.Parcel.readSerializable(Parcel.java:2148) 07-03 02:13:51.832: E/AndroidRuntime(6801): at android.os.Parcel.readValue(Parcel.java:2016) 07-03 02:13:51.832: E/AndroidRuntime(6801): at android.os.Parcel.readMapInternal(Parcel.java:2226) 07-03 02:13:51.832: E/AndroidRuntime(6801): at android.os.Bundle.unparcel(Bundle.java:223) 07-03 02:13:51.832: E/AndroidRuntime(6801): at android.os.Bundle.getInt(Bundle.java:922) 07-03 02:13:51.832: E/AndroidRuntime(6801): at <appname>.<name>.ar.free.BRMain.onReceive(BRMain.java:35) 07-03 02:13:51.832: E/AndroidRuntime(6801): at android.app.ActivityThread.handleReceiver(ActivityThread.java:2270) 07-03 02:13:51.832: E/AndroidRuntime(6801): ... 10 more 07-03 02:13:51.832: E/AndroidRuntime(6801): Caused by: java.lang.ClassNotFoundException: <appname>.a.a.b 07-03 02:13:51.832: E/AndroidRuntime(6801): at java.lang.Class.classForName(Native Method) 07-03 02:13:51.832: E/AndroidRuntime(6801): at java.lang.Class.forName(Class.java:217) 07-03 02:13:51.832: E/AndroidRuntime(6801): at java.io.ObjectInputStream.resolveClass(ObjectInputStream.java:2301) 07-03 02:13:51.832: E/AndroidRuntime(6801): at java.io.ObjectInputStream.readNewClassDesc(ObjectInputStream.java:1660) 07-03 02:13:51.832: E/AndroidRuntime(6801): at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:683) 07-03 02:13:51.832: E/AndroidRuntime(6801): at java.io.ObjectInputStream.readNewObject(ObjectInputStream.java:1803) 07-03 02:13:51.832: E/AndroidRuntime(6801): at java.io.ObjectInputStream.readNonPrimitiveContent(ObjectInputStream.java:787) 07-03 02:13:51.832: E/AndroidRuntime(6801): at java.io.ObjectInputStream.readObject(ObjectInputStream.java:2003) 07-03 02:13:51.832: E/AndroidRuntime(6801): at java.io.ObjectInputStream.readObject(ObjectInputStream.java:1960) 07-03 02:13:51.832: E/AndroidRuntime(6801): at android.os.Parcel.readSerializable(Parcel.java:2142) 07-03 02:13:51.832: E/AndroidRuntime(6801): ... 16 more 07-03 02:13:51.832: E/AndroidRuntime(6801): Caused by: java.lang.NoClassDefFoundError: <appname>/a/a/b 07-03 02:13:51.832: E/AndroidRuntime(6801): ... 26 more 07-03 02:13:51.832: E/AndroidRuntime(6801): Caused by: java.lang.ClassNotFoundException: <appname>.a.a.b 07-03 02:13:51.832: E/AndroidRuntime(6801): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61) 07-03 02:13:51.832: E/AndroidRuntime(6801): at java.lang.ClassLoader.loadClass(ClassLoader.java:501) 07-03 02:13:51.832: E/AndroidRuntime(6801): at java.lang.ClassLoader.loadClass(ClassLoader.java:461) 07-03 02:13:51.832: E/AndroidRuntime(6801): ... 26 more

    Read the article

  • After downloading an application with two Launcher components from the Marketplace, clicking "Open"

    - by user267728
    Create a sample application with two launcher icons. For example, two components such as: <application ...> <activity ... android:name="TestActivity01"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity ... android:name="TestActivity02"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> Either install the application via downloading from the Marketplace, or via AppInstaller. When the message box asks you if you would like to run the application, an exception is thrown: 02-03 16:42:44.270: ERROR/AndroidRuntime(395): android.content.ActivityNotFoundException: Unable to find explicit activity class {com.xxx.xxx/com.android.internal.app.ResolverActivity}; have you declared this activity in your AndroidManifest.xml? 02-03 16:42:44.270: ERROR/AndroidRuntime(395): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1 480) 02-03 16:42:44.270: ERROR/AndroidRuntime(395): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1454) 02-03 16:42:44.270: ERROR/AndroidRuntime(395): at android.app.Activity.startActivityForResult(Activity.java:2660) 02-03 16:42:44.270: ERROR/AndroidRuntime(395): at android.app.Activity.startActivity(Activity.java:2704) 02-03 16:42:44.270: ERROR/AndroidRuntime(395): at com.android.packageinstaller.InstallAppDone.onClick(InstallAppDone.java:105 ) 02-03 16:42:44.270: ERROR/AndroidRuntime(395): at android.view.View.performClick(View.java:2344) 02-03 16:42:44.270: ERROR/AndroidRuntime(395): at android.view.View.onTouchEvent(View.java:4133) 02-03 16:42:44.270: ERROR/AndroidRuntime(395): at android.widget.TextView.onTouchEvent(TextView.java:6504) 02-03 16:42:44.270: ERROR/AndroidRuntime(395): at android.view.View.dispatchTouchEvent(View.java:3672) 02-03 16:42:44.270: ERROR/AndroidRuntime(395): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:882) 02-03 16:42:44.270: ERROR/AndroidRuntime(395): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:882) 02-03 16:42:44.270: ERROR/AndroidRuntime(395): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:882) 02-03 16:42:44.270: ERROR/AndroidRuntime(395): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:882) 02-03 16:42:44.270: ERROR/AndroidRuntime(395): at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEv ent(PhoneWindow.java:1712) 02-03 16:42:44.270: ERROR/AndroidRuntime(395): at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneW indow.java:1202) 02-03 16:42:44.270: ERROR/AndroidRuntime(395): at android.app.Activity.dispatchTouchEvent(Activity.java:1987) 02-03 16:42:44.270: ERROR/AndroidRuntime(395): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(P honeWindow.java:1696) 02-03 16:42:44.270: ERROR/AndroidRuntime(395): at android.view.ViewRoot.handleMessage(ViewRoot.java:1658) 02-03 16:42:44.270: ERROR/AndroidRuntime(395): at android.os.Handler.dispatchMessage(Handler.java:99) 02-03 16:42:44.270: ERROR/AndroidRuntime(395): at android.os.Looper.loop(Looper.java:123) 02-03 16:42:44.270: ERROR/AndroidRuntime(395): at android.app.ActivityThread.main(ActivityThread.java:4203) 02-03 16:42:44.270: ERROR/AndroidRuntime(395): at java.lang.reflect.Method.invokeNative(Native Method) 02-03 16:42:44.270: ERROR/AndroidRuntime(395): at java.lang.reflect.Method.invoke(Method.java:521) 02-03 16:42:44.270: ERROR/AndroidRuntime(395): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java: 791) 02-03 16:42:44.270: ERROR/AndroidRuntime(395): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549) 02-03 16:42:44.270: ERROR/AndroidRuntime(395): at dalvik.system.NativeStart.main(Native Method) The crash happens because com.android.internal.app.ResolverActivity is trying to find a (single) component which resolves the following intent: <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> Please note that this has been tested BOTH with the AppInstaller, and the actual Marketplace on a real device.

    Read the article

  • Force close when starting new activity

    - by Alex
    I'm trying to launch a new activity from my main activity, but I just get error codes all the time. Heres my main activity; public class gunstats extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Button button4 = (Button)findViewById(R.id.button4); button4.setOnClickListener(new Button.OnClickListener() { public void onClick(View v) { Intent intent = new Intent(gunstats.this, more.class); startActivity(intent); } }); } } and the activity that is being called from my main class; public class more extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); final MediaPlayer mp = MediaPlayer.create(this, R.raw.deagle); Button buttonm1 = (Button)this.findViewById(R.id.buttonm1); buttonm1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mp.start(); } }); } } And there's nothing wrong in the manifest Heres my logcat: 01-08 16:33:17.647: ERROR/AndroidRuntime(552): Uncaught handler: thread main exiting due to uncaught exception 01-08 16:33:17.676: ERROR/AndroidRuntime(552): android.content.ActivityNotFoundException: Unable to find explicit activity class {com.gunstats/com.gunstats.more}; have you declared this activity in your AndroidManifest.xml? 01-08 16:33:17.676: ERROR/AndroidRuntime(552): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1480) 01-08 16:33:17.676: ERROR/AndroidRuntime(552): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1454) 01-08 16:33:17.676: ERROR/AndroidRuntime(552): at android.app.Activity.startActivityForResult(Activity.java:2660) 01-08 16:33:17.676: ERROR/AndroidRuntime(552): at android.app.Activity.startActivity(Activity.java:2704) 01-08 16:33:17.676: ERROR/AndroidRuntime(552): at com.gunstats.gunstats$4.onClick(gunstats.java:64) 01-08 16:33:17.676: ERROR/AndroidRuntime(552): at android.view.View.performClick(View.java:2344) 01-08 16:33:17.676: ERROR/AndroidRuntime(552): at android.view.View.onTouchEvent(View.java:4133) 01-08 16:33:17.676: ERROR/AndroidRuntime(552): at android.widget.TextView.onTouchEvent(TextView.java:6504) 01-08 16:33:17.676: ERROR/AndroidRuntime(552): at android.view.View.dispatchTouchEvent(View.java:3672) 01-08 16:33:17.676: ERROR/AndroidRuntime(552): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:882) 01-08 16:33:17.676: ERROR/AndroidRuntime(552): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:882) 01-08 16:33:17.676: ERROR/AndroidRuntime(552): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:882) 01-08 16:33:17.676: ERROR/AndroidRuntime(552): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:882) 01-08 16:33:17.676: ERROR/AndroidRuntime(552): at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1712) 01-08 16:33:17.676: ERROR/AndroidRuntime(552): at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1202) 01-08 16:33:17.676: ERROR/AndroidRuntime(552): at android.app.Activity.dispatchTouchEvent(Activity.java:1987) 01-08 16:33:17.676: ERROR/AndroidRuntime(552): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1696) 01-08 16:33:17.676: ERROR/AndroidRuntime(552): at android.view.ViewRoot.handleMessage(ViewRoot.java:1658) 01-08 16:33:17.676: ERROR/AndroidRuntime(552): at android.os.Handler.dispatchMessage(Handler.java:99) 01-08 16:33:17.676: ERROR/AndroidRuntime(552): at android.os.Looper.loop(Looper.java:123) 01-08 16:33:17.676: ERROR/AndroidRuntime(552): at android.app.ActivityThread.main(ActivityThread.java:4203) 01-08 16:33:17.676: ERROR/AndroidRuntime(552): at java.lang.reflect.Method.invokeNative(Native Method) 01-08 16:33:17.676: ERROR/AndroidRuntime(552): at java.lang.reflect.Method.invoke(Method.java:521) 01-08 16:33:17.676: ERROR/AndroidRuntime(552): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791) 01-08 16:33:17.676: ERROR/AndroidRuntime(552): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549) 01-08 16:33:17.676: ERROR/AndroidRuntime(552): at dalvik.system.NativeStart.main(Native Method) What is causing this force close?

    Read the article

  • Adding view cart function

    - by user228390
    Hey guys need some help in adding a view cart button but I'm stuck not sure how to code it. any help? The way I have coded it is that when a user clicks 'add item' they will get a alert box with info about the total price but I want that to appear in the HTML file but only once I have clicked on 'view cart' and I need it to be in a table format with info about the name, sum, price of the items and total. any ideas how I can do this? here is my javascript var f,d,str,items,qnts,price,bag,total; function cart(){ f=document.forms[0]; d=f.getElementsByTagName('div'); var items=[];var qnts=[];price=[];bag=[] for(i=0,e=0;i<d.length;i++){ items[i]=d[i].getElementsByTagName('b')[0].innerHTML; qnts[i]=d[i].getElementsByTagName('select')[0].value; str=d[i].getElementsByTagName('p')[1].innerHTML; priceStart(str,i); if(qnts[i]!=0){bag.push(new Array()); ib=bag[bag.length-1]; ib.push(items[i]);ib.push(qnts[i]);ib.push(price[i]);ib.push(qnts[i]*price[i]);} } if(bag.length>0){ total=bag[0][3]; if(bag.length>1){for(t=1;t<bag.length;t++){total+=bag[t][3]}} alert(bag.join('\n')+'\n----------------\ntotal='+total) } } function priceStart(str,inx){for(j=0;j<str.length;j++){if(str.charAt(j)!=' ' && !isNaN(str.charAt(j))){priceEnd(j,str,inx);return }}} function priceEnd(j,str,inx){for(k=str.length;k>j;k--){if(str.charAt(k)!=' ' && !isNaN(str.charAt(k))){price[inx]=str.substring(j,k);return }}} and my HTML <script type="text/javascript" src="cart.js" /> </script> <link rel="stylesheet" type="text/css" href="shopping_cart.css" /> <title> A title </title> </head> <body> <form name="form1" method="post" action="data.php" > <div id="product1"> <p id="title1"><b>Star Wars Tie Interceptor</b></p> <img src="images/DS.jpg" /> <p id="price1">Price £39.99</p> <p><b>Qty</b></p> <select name="qty"> <option value="0">0</option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> </select> <input type="button" value="Add to cart" onclick="cart()" /> </div>

    Read the article

  • NullPointerException in generated JSP code calling setJspId()

    - by Dobbo
    I am trying to deploy the Duke's Bank example form the J2EE 5 tutorial on JBoss 7.1.1. I have only used (unaltered) the source, and the standard XML configuration files for deployment, part of the exercise here is to see how I might structure a JSP based project of my own. The exception I get is as follows: ERROR [[jsp]] Servlet.service() for servlet jsp threw exception: java.lang.NullPointerException at javax.faces.webapp.UIComponentClassicTagBase.setJspId(UIComponentClassicTagBase.java:1858) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final] at org.apache.jsp.main_jsp._jspx_meth_f_005fview_005f0(main_jsp.java:99) at org.apache.jsp.main_jsp._jspService(main_jsp.java:76) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) [jbossweb-7.0.13.Final.jar:] at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final] at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369) [jbossweb-7.0.13.Final.jar:] at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:326) [jbossweb-7.0.13.Final.jar:] at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:253) [jbossweb-7.0.13.Final.jar:] at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.13.Final.jar:] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar:] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.13.Final.jar:] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.13.Final.jar:] at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:397) [jbossweb-7.0.13.Final.jar:] at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50) [jboss-as-jpa-7.1.1.Final.jar:7.1.1.Final] at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155) [jbossweb-7.0.13.Final.jar:] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.13.Final.jar:] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.13.Final.jar:] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368) [jbossweb-7.0.13.Final.jar:] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.13.Final.jar:] at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671) [jbossweb-7.0.13.Final.jar:] at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930) [jbossweb-7.0.13.Final.jar:] at java.lang.Thread.run(Thread.java:636) [rt.jar:1.6.0_18] I have not given any JBoss configuration files, the WAR's WEB-INF part looks like this: $ jar tvf build/lib/dukebank-web.war 0 Sat Dec 15 22:00:12 GMT 2012 META-INF/ 123 Sat Dec 15 22:00:10 GMT 2012 META-INF/MANIFEST.MF 0 Sat Dec 15 22:00:12 GMT 2012 WEB-INF/ 2514 Fri Dec 14 14:29:20 GMT 2012 WEB-INF/web.xml 1348 Sat Dec 15 08:19:46 GMT 2012 WEB-INF/dukesBank.tld 7245 Sat Dec 15 08:19:46 GMT 2012 WEB-INF/faces-config.xml 2153 Sat Dec 15 08:19:46 GMT 2012 WEB-INF/tutorial-template.tld 0 Sat Dec 15 22:00:12 GMT 2012 WEB-INF/classes/... The JSP file (main.jsp) that causes this problem is: <f:view> <h:form> <jsp:include page="/template/template.jsp"/> <center> <h3><h:outputText value="#{bundle.Welcome}"/></h3> </center> </h:form> </f:view> The template file it includes: <%@ taglib uri="/WEB-INF/tutorial-template.tld" prefix="tt" %> <%@ page errorPage="/template/errorpage.jsp" %> <%@ include file="/template/screendefinitions.jspf" %> <html> <head> <title> <tt:insert definition="bank" parameter="title"/> </title> <link rel="stylesheet" type="text/css" href="stylesheet.css"> </head> <body bgcolor="#ffffff"> <tt:insert definition="bank" parameter="banner"/> <tt:insert definition="bank" parameter="links"/> </body> </html> I will refrain from coping any more files because, as I said at the start I haven't altered any of the files I have used. Many thanks for your help, Steve

    Read the article

  • Improve heavy work in a loop in multithreading

    - by xjaphx
    I have a little problem with my data processing. public void ParseDetails() { for (int i = 0; i < mListAppInfo.Count; ++i) { ParseOneDetail(i); } } For 300 records, it usually takes around 13-15 minutes. I've tried to improve by using Parallel.For() but it always stop at some point. public void ParseDetails() { Parallel.For(0, mListAppInfo.Count, i => ParseOneDetail(i)); } In method ParseOneDetail(int index), I set an output log for tracking the record id which is under processing. Always hang at some point, I don't know why.. ParseOneDetail(): 89 ... ParseOneDetail(): 90 ... ParseOneDetail(): 243 ... ParseOneDetail(): 92 ... ParseOneDetail(): 244 ... ParseOneDetail(): 93 ... ParseOneDetail(): 245 ... ParseOneDetail(): 247 ... ParseOneDetail(): 94 ... ParseOneDetail(): 248 ... ParseOneDetail(): 95 ... ParseOneDetail(): 99 ... ParseOneDetail(): 249 ... ParseOneDetail(): 100 ... _ <hang at this point> Appreciate your help and suggestions to improve this. Thank you! Edit 1: update for method: private void ParseOneDetail(int index) { Console.WriteLine("ParseOneDetail(): " + index + " ... "); ApplicationInfo appInfo = mListAppInfo[index]; var htmlWeb = new HtmlWeb(); var document = htmlWeb.Load(appInfo.AppAnnieURL); // get first one only HtmlNode nodeStoreURL = document.DocumentNode.SelectSingleNode(Constants.XPATH_FIRST); appInfo.StoreURL = nodeStoreURL.Attributes[Constants.HREF].Value; } Edit 2: This is the error output after a while running as Enigmativity suggest, ParseOneDetail(): 234 ... ParseOneDetail(): 87 ... ParseOneDetail(): 235 ... ParseOneDetail(): 236 ... ParseOneDetail(): 88 ... ParseOneDetail(): 238 ... ParseOneDetail(): 89 ... ParseOneDetail(): 90 ... ParseOneDetail(): 239 ... ParseOneDetail(): 92 ... Unhandled Exception: System.AggregateException: One or more errors occurred. --- > System.Net.WebException: The operation has timed out at System.Net.HttpWebRequest.GetResponse() at HtmlAgilityPack.HtmlWeb.Get(Uri uri, String method, String path, HtmlDocum ent doc, IWebProxy proxy, ICredentials creds) in D:\Source\htmlagilitypack.new\T runk\HtmlAgilityPack\HtmlWeb.cs:line 1355 at HtmlAgilityPack.HtmlWeb.LoadUrl(Uri uri, String method, WebProxy proxy, Ne tworkCredential creds) in D:\Source\htmlagilitypack.new\Trunk\HtmlAgilityPack\Ht mlWeb.cs:line 1479 at HtmlAgilityPack.HtmlWeb.Load(String url, String method) in D:\Source\htmla gilitypack.new\Trunk\HtmlAgilityPack\HtmlWeb.cs:line 1103 at HtmlAgilityPack.HtmlWeb.Load(String url) in D:\Source\htmlagilitypack.new\ Trunk\HtmlAgilityPack\HtmlWeb.cs:line 1061 at SimpleChartParser.AppAnnieParser.ParseOneDetail(ApplicationInfo appInfo) i n c:\users\nhn60\documents\visual studio 2010\Projects\FunToolPack\SimpleChartPa rser\AppAnnieParser.cs:line 90 at SimpleChartParser.AppAnnieParser.<ParseDetails>b__0(ApplicationInfo ai) in c:\users\nhn60\documents\visual studio 2010\Projects\FunToolPack\SimpleChartPar ser\AppAnnieParser.cs:line 80 at System.Threading.Tasks.Parallel.<>c__DisplayClass21`2.<ForEachWorker>b__17 (Int32 i) at System.Threading.Tasks.Parallel.<>c__DisplayClassf`1.<ForWorker>b__c() at System.Threading.Tasks.Task.InnerInvoke() at System.Threading.Tasks.Task.InnerInvokeWithArg(Task childTask) at System.Threading.Tasks.Task.<>c__DisplayClass7.<ExecuteSelfReplicating>b__ 6(Object ) --- End of inner exception stack trace --- at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceled Exceptions) at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationTo ken cancellationToken) at System.Threading.Tasks.Parallel.ForWorker[TLocal](Int32 fromInclusive, Int 32 toExclusive, ParallelOptions parallelOptions, Action`1 body, Action`2 bodyWit hState, Func`4 bodyWithLocal, Func`1 localInit, Action`1 localFinally) at System.Threading.Tasks.Parallel.ForEachWorker[TSource,TLocal](TSource[] ar ray, ParallelOptions parallelOptions, Action`1 body, Action`2 bodyWithState, Act ion`3 bodyWithStateAndIndex, Func`4 bodyWithStateAndLocal, Func`5 bodyWithEveryt hing, Func`1 localInit, Action`1 localFinally) at System.Threading.Tasks.Parallel.ForEachWorker[TSource,TLocal](IEnumerable` 1 source, ParallelOptions parallelOptions, Action`1 body, Action`2 bodyWithState , Action`3 bodyWithStateAndIndex, Func`4 bodyWithStateAndLocal, Func`5 bodyWithE verything, Func`1 localInit, Action`1 localFinally) at System.Threading.Tasks.Parallel.ForEach[TSource](IEnumerable`1 source, Act ion`1 body) at SimpleChartParser.AppAnnieParser.ParseDetails() in c:\users\nhn60\document s\visual studio 2010\Projects\FunToolPack\SimpleChartParser\AppAnnieParser.cs:li ne 80 at SimpleChartParser.Program.Main(String[] args) in c:\users\nhn60\documents\ visual studio 2010\Projects\FunToolPack\SimpleChartParser\Program.cs:line 15

    Read the article

  • Android JSon Array is not working with Maplocations class

    - by user1505962
    I am developing a map application in android i have made maplocation class to pass latitude and longitude and using Json Array to fetch data from MYSQl to display in map.But When I run application it crashed unfortunantely here is my log cat 07-07 14:02:26.423: E/AndroidRuntime(366): FATAL EXCEPTION: main 07-07 14:02:26.423: E/AndroidRuntime(366): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.icons.draw.view/com.icons.draw.view.DrawIcons}: android.view.InflateException: Binary XML file line #6: Error inflating class com.icons.draw.view.LocationViewers 07-07 14:02:26.423: E/AndroidRuntime(366): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647) 07-07 14:02:26.423: E/AndroidRuntime(366): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663) 07-07 14:02:26.423: E/AndroidRuntime(366): at android.app.ActivityThread.access$1500(ActivityThread.java:117) 07-07 14:02:26.423: E/AndroidRuntime(366): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931) 07-07 14:02:26.423: E/AndroidRuntime(366): at android.os.Handler.dispatchMessage(Handler.java:99) 07-07 14:02:26.423: E/AndroidRuntime(366): at android.os.Looper.loop(Looper.java:130) 07-07 14:02:26.423: E/AndroidRuntime(366): at android.app.ActivityThread.main(ActivityThread.java:3683) 07-07 14:02:26.423: E/AndroidRuntime(366): at java.lang.reflect.Method.invokeNative(Native Method) 07-07 14:02:26.423: E/AndroidRuntime(366): at java.lang.reflect.Method.invoke(Method.java:507) 07-07 14:02:26.423: E/AndroidRuntime(366): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839) 07-07 14:02:26.423: E/AndroidRuntime(366): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597) 07-07 14:02:26.423: E/AndroidRuntime(366): at dalvik.system.NativeStart.main(Native Method) 07-07 14:02:26.423: E/AndroidRuntime(366): Caused by: android.view.InflateException: Binary XML file line #6: Error inflating class com.icons.draw.view.LocationViewers 07-07 14:02:26.423: E/AndroidRuntime(366): at android.view.LayoutInflater.createView(LayoutInflater.java:518) 07-07 14:02:26.423: E/AndroidRuntime(366): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:570) 07-07 14:02:26.423: E/AndroidRuntime(366): at android.view.LayoutInflater.rInflate(LayoutInflater.java:623) 07-07 14:02:26.423: E/AndroidRuntime(366): at android.view.LayoutInflater.inflate(LayoutInflater.java:408) 07-07 14:02:26.423: E/AndroidRuntime(366): at android.view.LayoutInflater.inflate(LayoutInflater.java:320) 07-07 14:02:26.423: E/AndroidRuntime(366): at android.view.LayoutInflater.inflate(LayoutInflater.java:276) 07-07 14:02:26.423: E/AndroidRuntime(366): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:207) 07-07 14:02:26.423: E/AndroidRuntime(366): at android.app.Activity.setContentView(Activity.java:1657) 07-07 14:02:26.423: E/AndroidRuntime(366): at com.icons.draw.view.DrawIcons.onCreate(DrawIcons.java:16) 07-07 14:02:26.423: E/AndroidRuntime(366): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047) 07-07 14:02:26.423: E/AndroidRuntime(366): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611) 07-07 14:02:26.423: E/AndroidRuntime(366): ... 11 more 07-07 14:02:26.423: E/AndroidRuntime(366): Caused by: java.lang.reflect.InvocationTargetException 07-07 14:02:26.423: E/AndroidRuntime(366): at java.lang.reflect.Constructor.constructNative(Native Method) 07-07 14:02:26.423: E/AndroidRuntime(366): at java.lang.reflect.Constructor.newInstance(Constructor.java:415) 07-07 14:02:26.423: E/AndroidRuntime(366): at android.view.LayoutInflater.createView(LayoutInflater.java:505) 07-07 14:02:26.423: E/AndroidRuntime(366): ... 21 more 07-07 14:02:26.423: E/AndroidRuntime(366): Caused by: java.lang.NullPointerException 07-07 14:02:26.423: E/AndroidRuntime(366): at org.json.JSONTokener.nextCleanInternal(JSONTokener.java:112) 07-07 14:02:26.423: E/AndroidRuntime(366): at org.json.JSONTokener.nextValue(JSONTokener.java:90) 07-07 14:02:26.423: E/AndroidRuntime(366): at org.json.JSONArray.<init>(JSONArray.java:87) 07-07 14:02:26.423: E/AndroidRuntime(366): at org.json.JSONArray.<init>(JSONArray.java:103) 07-07 14:02:26.423: E/AndroidRuntime(366): at com.icons.draw.view.LocationViewers.getMapLocations(LocationViewers.java:102) 07-07 14:02:26.423: E/AndroidRuntime(366): at com.icons.draw.view.LocationViewers.init(LocationViewers.java:65) 07-07 14:02:26.423: E/AndroidRuntime(366): at com.icons.draw.view.LocationViewers.<init>(LocationViewers.java:45) 07-07 14:02:26.423: E/AndroidRuntime(366): ... 24 more And Here is My JSOn Array and loop code to make markers double LAT; double LANG; String INFO; public List<MapLocation> getMapLocations() { if (mapLocations == null) { try{ jArray = new JSONArray(result); JSONObject json_data=null; for(int i=0;i<jArray.length();i++){ json_data = jArray.getJSONObject(i); LAT=json_data.getDouble("lat"); LANG=json_data.getDouble("lang"); INFO=json_data.getString("info"); mapLocations = new ArrayList<MapLocation>(); mapLocations.add(new MapLocation(INFO,LAT,LANG)); } } catch(JSONException e1){ Toast.makeText(getContext(), "No Vehicles Found" ,Toast.LENGTH_LONG).show(); } catch (ParseException e1) { e1.printStackTrace(); } } return mapLocations; } Please Help to Remove this error

    Read the article

  • How to get the value of an item from database and set it as the spinner value

    - by kulPrins
    I have a database and the database populates a listview. when i long press a list item from the listview i get a context menu where i have the option to edit. When the edit option is clicked i open an activity and get all the values of the respective fields from the database. Now, here I want to get a value from the database and show it in the spinner. the spinner already has these values and is getting populated from the database... I have tried the following, but i get an error saying I can't cast a SimpleCursorAdapter to an ArrayAdapter.. String osub = cursor.getString(Database.INDEX_SUBJECT); Cursor cs = mDBS.querySub(osub); String subs = cs.getString(DatabaseSub.INDEX_SSUBJECT); if(cs!=null){ ArrayAdapter<String> myAdap = (ArrayAdapter<String>) subSpinner.getAdapter(); //cast to an ArrayAdapter int spinnerPosition = myAdap.getPosition(subs); //set the default according to value subSpinner.setSelection(spinnerPosition); Please tell me how to do this.. Thank you.. I am relatively new so please let me know if I am overlooking something. Thanks.. EDIT querySub method public Cursor querySub(String sub) throws SQLException { Cursor cursor = mDatabase.query(true, DATABASE_TABLE, sAllColumns, "ssub like " + "'" + sub + "'", null, null, null, null, null); if (cursor.moveToNext()) { return cursor; } cursor.moveToFirst(); return cursor; } Error Log 06-05 12:11:14.144: E/AndroidRuntime(775): FATAL EXCEPTION: main 06-05 12:11:14.144: E/AndroidRuntime(775): java.lang.RuntimeException: Unable to start activity ComponentInfo{an.droid.kit/an.droid.kit.DetailsActivity}: java.lang.ClassCastException: android.widget.SimpleCursorAdapter cannot be cast to android.widget.ArrayAdapter 06-05 12:11:14.144: E/AndroidRuntime(775): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1956) 06-05 12:11:14.144: E/AndroidRuntime(775): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981) 06-05 12:11:14.144: E/AndroidRuntime(775): at android.app.ActivityThread.access$600(ActivityThread.java:123) 06-05 12:11:14.144: E/AndroidRuntime(775): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147) 06-05 12:11:14.144: E/AndroidRuntime(775): at android.os.Handler.dispatchMessage(Handler.java:99) 06-05 12:11:14.144: E/AndroidRuntime(775): at android.os.Looper.loop(Looper.java:137) 06-05 12:11:14.144: E/AndroidRuntime(775): at android.app.ActivityThread.main(ActivityThread.java:4424) 06-05 12:11:14.144: E/AndroidRuntime(775): at java.lang.reflect.Method.invokeNative(Native Method) 06-05 12:11:14.144: E/AndroidRuntime(775): at java.lang.reflect.Method.invoke(Method.java:511) 06-05 12:11:14.144: E/AndroidRuntime(775): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784) 06-05 12:11:14.144: E/AndroidRuntime(775): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551) 06-05 12:11:14.144: E/AndroidRuntime(775): at dalvik.system.NativeStart.main(Native Method) 06-05 12:11:14.144: E/AndroidRuntime(775): Caused by: java.lang.ClassCastException: android.widget.SimpleCursorAdapter cannot be cast to android.widget.ArrayAdapter 06-05 12:11:14.144: E/AndroidRuntime(775): at an.droid.kit.DetailsActivity.dbToUI(DetailsActivity.java:217) 06-05 12:11:14.144: E/AndroidRuntime(775): at an.droid.kit.DetailsActivity.onCreate(DetailsActivity.java:104) 06-05 12:11:14.144: E/AndroidRuntime(775): at android.app.Activity.performCreate(Activity.java:4465) 06-05 12:11:14.144: E/AndroidRuntime(775): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049) 06-05 12:11:14.144: E/AndroidRuntime(775): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920) 06-05 12:11:14.144: E/AndroidRuntime(775): ... 11 more

    Read the article

  • CSS Horizontal sub menu - IE 6,7 both dont working, tried with whatever hover.

    - by SHAKTI
    I'm not expert about css menus. But I know basic system to make css menu. I used this system before and works, but this time it is not working. The site is http://www.uniethos.com. Please check this site This menu works with all other latest Browsers. But not with IE 6 & 7. I know IE6 don't support hover except anchor. So before I was using Whatever Hover. But this time it is not working and even with IE7. I don't know why its happening. May be there could be some problem with my css. Please check the css. If you don't have IE 6 or 7 installed you can run one from http://spoon.net/browsers/. Require to install one plugin. The CSS I'm using for the menu is .glossymenu{ background: #B4B3B3; height: 30px; width: 100%; padding: 0; margin: 0; display:inline-block; position:relative; } .glossymenu ul { list-style: none; padding: 0px; margin: 0; padding-left: 0px; } .glossymenu li ul { display:none; position:absolute; width: 80%; top:30px; left:0px; background-color:#5B0C10; border:0px; z-index: 99; } .glossymenu li li a { padding: 0px 10px 0px 10px; } .glossymenu li li a:hover { background : #871016; } .glossymenu li{ float:left; padding: 0; } .glossymenu li a{ float: left; display:block; position:relative; color:#FFF; text-decoration: none; font-family: sans-serif; font-size: 13px; font-weight: bold; padding:0 0 0 16px; /*Padding to accomodate left tab image. Do not change*/ height: 30px; line-height: 30px; text-align: center; cursor: pointer; } .glossymenu li a b{ float: left; display: block; padding: 0 24px 0 8px; /*Padding of menu items*/ } .glossymenu li.current a, .glossymenu li a:hover{ color: #FFF; background: #5B0C10; background-position: left; text-decoration: none; } .glossymenu li a:visited{ text-decoration: none; } .glossymenu ul li:hover ul { display: block; }

    Read the article

  • How do I get around this lambda expression outer variable issue?

    - by panamack
    I'm playing with PropertyDescriptor and ICustomTypeDescriptor (still) trying to bind a WPF DataGrid to an object, for which the data is stored in a Dictionary. Since if you pass WPF DataGrid a list of Dictionary objects it will auto generate columns based on the public properties of a dictionary (Comparer, Count, Keys and Values) my Person subclasses Dictionary and implements ICustomTypeDescriptor. ICustomTypeDescriptor defines a GetProperties method which returns a PropertyDescriptorCollection. PropertyDescriptor is abstract so you have to subclass it, I figured I'd have a constructor that took Func and an Action parameters that delegate the getting and setting of the values in the dictionary. I then create a PersonPropertyDescriptor for each Key in the dictionary like this: foreach (string s in this.Keys) { var descriptor = new PersonPropertyDescriptor( s, new Func<object>(() => { return this[s]; }), new Action<object>(o => { this[s] = o; })); propList.Add(descriptor); } The problem is that each property get's its own Func and Action but they all share the outer variable s so although the DataGrid autogenerates columns for "ID","FirstName","LastName", "Age", "Gender" they all get and set against "Gender" which is the final resting value of s in the foreach loop. How can I ensure that each delegate uses the desired dictionary Key, i.e. the value of s at the time the Func/Action is instantiated? Much obliged. Here's the rest of my idea, I'm just experimenting here these are not 'real' classes... // DataGrid binds to a People instance public class People : List<Person> { public People() { this.Add(new Person()); } } public class Person : Dictionary<string, object>, ICustomTypeDescriptor { private static PropertyDescriptorCollection descriptors; public Person() { this["ID"] = "201203"; this["FirstName"] = "Bud"; this["LastName"] = "Tree"; this["Age"] = 99; this["Gender"] = "M"; } //... other ICustomTypeDescriptor members... public PropertyDescriptorCollection GetProperties() { if (descriptors == null) { var propList = new List<PropertyDescriptor>(); foreach (string s in this.Keys) { var descriptor = new PersonPropertyDescriptor( s, new Func<object>(() => { return this[s]; }), new Action<object>(o => { this[s] = o; })); propList.Add(descriptor); } descriptors = new PropertyDescriptorCollection(propList.ToArray()); } return descriptors; } //... other other ICustomTypeDescriptor members... } public class PersonPropertyDescriptor : PropertyDescriptor { private Func<object> getFunc; private Action<object> setAction; public PersonPropertyDescriptor(string name, Func<object> getFunc, Action<object> setAction) : base(name, null) { this.getFunc = getFunc; this.setAction = setAction; } // other ... PropertyDescriptor members... public override object GetValue(object component) { return getFunc(); } public override void SetValue(object component, object value) { setAction(value); } }

    Read the article

  • Asus me302c create script crash

    - by wxfred
    State beforehand: So far, only Asus me302c would crash when it creates a script. This device can create renderscript context successfully 06-03 10:12:50.509: V/RenderScript_jni(3144): RS compat mode 06-03 10:12:50.509: V/RenderScript(3144): 0x610bbfc0 Launching thread(s), CPUs 4 06-03 10:12:50.549: D/libEGL(3144): loaded /vendor/lib/egl/libEGL_POWERVR_SGX544_115.so 06-03 10:12:50.559: D/libEGL(3144): loaded /vendor/lib/egl/libGLESv1_CM_POWERVR_SGX544_115.so 06-03 10:12:50.559: D/libEGL(3144): loaded /vendor/lib/egl/libGLESv2_POWERVR_SGX544_115.so 06-03 10:12:50.619: D/OpenGLRenderer(3144): Enabling debug mode 0 06-03 10:12:52.869: D/dalvikvm(3144): Rejecting registerization due to ushr-int/lit8 v4, v7, (#19) When create a script, it crashed. 06-03 09:55:09.859: D/basefilter(26682): ===createScript=== 06-03 09:55:09.869: E/RenderScript(26682): Unable to open shared library (/data/data/xxx.xxxxxxxxxxx.xxxxxxxxx.xxxxx.xxxx//lib/librs.basefilter.so): Cannot load library: soinfo_relocate(linker.cpp:975): cannot locate symbol "_Z3dotDv3_fS_" referenced by "librs.basefilter.so"... 06-03 09:55:09.869: E/RenderScript(26682): Unable to open system shared library (/system/lib/librs.basefilter.so): (null) 06-03 09:55:09.869: D/AndroidRuntime(26682): Shutting down VM 06-03 09:55:09.869: W/dalvikvm(26682): threadid=1: thread exiting with uncaught exception (group=0x418b9e10) 06-03 09:55:09.869: E/AndroidRuntime(26682): FATAL EXCEPTION: main 06-03 09:55:09.869: E/AndroidRuntime(26682): android.support.v8.renderscript.RSRuntimeException: Loading of ScriptC script failed. 06-03 09:55:09.869: E/AndroidRuntime(26682): at android.support.v8.renderscript.ScriptC.<init>(ScriptC.java:69) 06-03 09:55:09.869: E/AndroidRuntime(26682): at xxx.xxxxxxxxxxx.xxxxxxxxx.xxxxxxxxxx.xxxxxx.ScriptC_BaseFilter.<init>(ScriptC_BaseFilter.java:41) 06-03 09:55:09.869: E/AndroidRuntime(26682): at xxx.xxxxxxxxxxx.xxxxxxxxx.xxxxxxxxxx.xxxxxx.ScriptC_BaseFilter.<init>(ScriptC_BaseFilter.java:35) 06-03 09:55:09.869: E/AndroidRuntime(26682): at xxx.xxxxxxxxxxx.xxxxxxxxx.xxxxxxxxxx.xxxxxx.xxxxxx.TeethWhiteningRSFilter.onCreateScript(TeethWhiteningRSFilter.java:19) 06-03 09:55:09.869: E/AndroidRuntime(26682): at xxx.xxxxxxxxxxx.xxxxxxxxx.xxxxxxxxxx.xxxxxx.xxxxxx.TeethWhiteningRSFilter.onCreateScript(TeethWhiteningRSFilter.java:1) 06-03 09:55:09.869: E/AndroidRuntime(26682): at xxx.xxxxxxxxxxx.xxxxxxxxx.xxxxxxxxxx.BaseRSFilter.createScript(BaseRSFilter.java:39) 06-03 09:55:09.869: E/AndroidRuntime(26682): at xxx.xxxxxxxxxxx.xxxxxxxxx.xxxxxxxxxx.RSFilterEngine.addFilter(RSFilterEngine.java:76) 06-03 09:55:09.869: E/AndroidRuntime(26682): at xxx.xxxxxxxxxxx.xxxxxxxxx.xxxxx.xxxx.BeautyActivity.changeBeautyEffect(BeautyActivity.java:277) 06-03 09:55:09.869: E/AndroidRuntime(26682): at xxx.xxxxxxxxxxx.xxxxxxxxx.xxxxx.xxxx.BeautyActivity$2.onClick(BeautyActivity.java:100) 06-03 09:55:09.869: E/AndroidRuntime(26682): at com.android.internal.app.AlertController$ButtonHandler.handleMessage(AlertController.java:166) 06-03 09:55:09.869: E/AndroidRuntime(26682): at android.os.Handler.dispatchMessage(Handler.java:99) 06-03 09:55:09.869: E/AndroidRuntime(26682): at android.os.Looper.loop(Looper.java:152) 06-03 09:55:09.869: E/AndroidRuntime(26682): at android.app.ActivityThread.main(ActivityThread.java:5132) 06-03 09:55:09.869: E/AndroidRuntime(26682): at java.lang.reflect.Method.invokeNative(Native Method) 06-03 09:55:09.869: E/AndroidRuntime(26682): at java.lang.reflect.Method.invoke(Method.java:511) 06-03 09:55:09.869: E/AndroidRuntime(26682): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) 06-03 09:55:09.869: E/AndroidRuntime(26682): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560) 06-03 09:55:09.869: E/AndroidRuntime(26682): at dalvik.system.NativeStart.main(Native Method) Now, I will post some related infomation. project.properties ... renderscript.target=9 renderscript.support.mode=true sdk.buildtools=19.0.3 device info Brand: Asus Model: ME302C OS: 4.2.2 CPU: Intel(R) Atom(TM) CPU Z2560 @1.60GHz GPU Renderer PowerVR SGX 544MP Finally, by the way, the same code runs well on Galaxy s2, s4, note 2.

    Read the article

  • Launching an Activity from a Service

    - by nldev
    When I am trying to launch a call activity from a Service, I get a NullPointerException. Here is my code: Intent callIntent = new Intent(Intent.ACTION_CALL); callIntent.setData(Uri.parse("tel:" + number)); callIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(callIntent); I get the exception on the startActivity line. I tried to use getApplication.startActivity and getApplicationContext.startActivity but no luck. Any ideas? edit : Maybe some usefull info: I am trying to create a service that will run on the background and scan sensor data, when a certain signal is given i would like to maken an automated call to a number. edit : full adb error code: 03-31 09:04:10.214: ERROR/AndroidRuntime(1896): Uncaught handler: thread main exiting due to uncaught exception 03-31 09:04:10.226: ERROR/AndroidRuntime(1896): java.lang.RuntimeException: Unable to instantiate service dfz.epilepsiedetector.services.DetectionService: java.lang.NullPointerException 03-31 09:04:10.226: ERROR/AndroidRuntime(1896): at android.app.ActivityThread.handleCreateService(ActivityThread.java:2668) 03-31 09:04:10.226: ERROR/AndroidRuntime(1896): at android.app.ActivityThread.access$3100(ActivityThread.java:116) 03-31 09:04:10.226: ERROR/AndroidRuntime(1896): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1846) 03-31 09:04:10.226: ERROR/AndroidRuntime(1896): at android.os.Handler.dispatchMessage(Handler.java:99) 03-31 09:04:10.226: ERROR/AndroidRuntime(1896): at android.os.Looper.loop(Looper.java:123) 03-31 09:04:10.226: ERROR/AndroidRuntime(1896): at android.app.ActivityThread.main(ActivityThread.java:4203) 03-31 09:04:10.226: ERROR/AndroidRuntime(1896): at java.lang.reflect.Method.invokeNative(Native Method) 03-31 09:04:10.226: ERROR/AndroidRuntime(1896): at java.lang.reflect.Method.invoke(Method.java:521) 03-31 09:04:10.226: ERROR/AndroidRuntime(1896): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791) 03-31 09:04:10.226: ERROR/AndroidRuntime(1896): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549) 03-31 09:04:10.226: ERROR/AndroidRuntime(1896): at dalvik.system.NativeStart.main(Native Method) 03-31 09:04:10.226: ERROR/AndroidRuntime(1896): Caused by: java.lang.NullPointerException 03-31 09:04:10.226: ERROR/AndroidRuntime(1896): at android.content.ContextWrapper.getPackageName(ContextWrapper.java:120) 03-31 09:04:10.226: ERROR/AndroidRuntime(1896): at android.content.ComponentName.<init>(ComponentName.java:75) 03-31 09:04:10.226: ERROR/AndroidRuntime(1896): at android.content.Intent.<init>(Intent.java:2302) 03-31 09:04:10.226: ERROR/AndroidRuntime(1896): at dfz.epilepsiedetector.services.DetectionService.<init>(DetectionService.java:35) 03-31 09:04:10.226: ERROR/AndroidRuntime(1896): at java.lang.Class.newInstanceImpl(Native Method) 03-31 09:04:10.226: ERROR/AndroidRuntime(1896): at java.lang.Class.newInstance(Class.java:1472) 03-31 09:04:10.226: ERROR/AndroidRuntime(1896): at android.app.ActivityThread.handleCreateService(ActivityThread.java:2665) edit Trimmed class code: `public class DetectionService extends IntentService implements SensorEventListener { private SensorManager mSensorManager; private Sensor mAccelerometer; private boolean hasSeizure = false; private final int POLLS_PER_SECOND = 10; public DetectionService() { super("EpilepsionDetectionService"); //mSensorManager = (SensorManager)getSystemService(SENSOR_SERVICE); // mAccelerometer = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER); /*Intent callIntent = new Intent(Intent.ACTION_CALL); callIntent.setData(Uri.parse("tel:" + "+31648363944")); callIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);*/ Intent callIntent = new Intent(DetectionService.this, InformationActivity.class); callIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); getApplication().startActivity(callIntent); //((Activity) getContext()).startActivity(callIntent); }`

    Read the article

  • sherlock actionbar menu

    - by user1647443
    I am trying to setup a menu programatically and my method gets com.actionbarsherlock.view.Menu menu as a parameter. As I want to change the styling of the menu item I am trying to setup a SpannableString spannable and pass it to add. menu.add(0, MENU_ABOUT, 0, spannable); This is causing a crash only in ICS when I cick that menu item. Any ideas if I am missing something. Thanks Here is the code I am trying and it crashes when I run the app and select "About Application". FYI, I am using SpannableString because I want to add some styling and color to the menu item. The crash does NOT happen if I use a regular string, but then I cant do styling public boolean onCreateOptionsMenu(com.actionbarsherlock.view.Menu menu) { SpannableString spannable = new SpannableString("About Application"); menu.add(0, MENU_ABOUT, 0, spannable); return true; } Here is the stack trace: 09-05 02:25:32.849: E/AndroidRuntime(684): FATAL EXCEPTION: main 09-05 02:25:32.849: E/AndroidRuntime(684): java.lang.IllegalArgumentException: Invalid payload item type 09-05 02:25:32.849: E/AndroidRuntime(684): at android.util.EventLog.writeEvent(Native Method) 09-05 02:25:32.849: E/AndroidRuntime(684): at android.app.Activity.onMenuItemSelected(Activity.java:2501) 09-05 02:25:32.849: E/AndroidRuntime(684): at android.support.v4.app.FragmentActivity.onMenuItemSelected(FragmentActivity.java:351) 09-05 02:25:32.849: E/AndroidRuntime(684): at com.android.internal.policy.impl.PhoneWindow.onMenuItemSelected(PhoneWindow.java:950) 09-05 02:25:32.849: E/AndroidRuntime(684): at com.android.internal.view.menu.MenuBuilder.dispatchMenuItemSelected(MenuBuilder.java:735) 09-05 02:25:32.849: E/AndroidRuntime(684): at com.android.internal.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:149) 09-05 02:25:32.849: E/AndroidRuntime(684): at com.android.internal.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:874) 09-05 02:25:32.849: E/AndroidRuntime(684): at com.android.internal.view.menu.ListMenuPresenter.onItemClick(ListMenuPresenter.java:163) 09-05 02:25:32.849: E/AndroidRuntime(684): at android.widget.AdapterView.performItemClick(AdapterView.java:292) 09-05 02:25:32.849: E/AndroidRuntime(684): at android.widget.AbsListView.performItemClick(AbsListView.java:1058) 09-05 02:25:32.849: E/AndroidRuntime(684): at android.widget.AbsListView$PerformClick.run(AbsListView.java:2514) 09-05 02:25:32.849: E/AndroidRuntime(684): at android.widget.AbsListView.onTouchEvent(AbsListView.java:3180) 09-05 02:25:32.849: E/AndroidRuntime(684): at android.view.View.dispatchTouchEvent(View.java:5541) 09-05 02:25:32.849: E/AndroidRuntime(684): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1951) 09-05 02:25:32.849: E/AndroidRuntime(684): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1712) 09-05 02:25:32.849: E/AndroidRuntime(684): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1957) 09-05 02:25:32.849: E/AndroidRuntime(684): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1726) 09-05 02:25:32.849: E/AndroidRuntime(684): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1860) 09-05 02:25:32.849: E/AndroidRuntime(684): at android.view.View.dispatchPointerEvent(View.java:5721) 09-05 02:25:32.849: E/AndroidRuntime(684): at android.view.ViewRootImpl.deliverPointerEvent(ViewRootImpl.java:2890) 09-05 02:25:32.849: E/AndroidRuntime(684): at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2466) 09-05 02:25:32.849: E/AndroidRuntime(684): at android.view.ViewRootImpl.processInputEvents(ViewRootImpl.java:845) 09-05 02:25:32.849: E/AndroidRuntime(684): at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2475) 09-05 02:25:32.849: E/AndroidRuntime(684): at android.os.Handler.dispatchMessage(Handler.java:99) 09-05 02:25:32.849: E/AndroidRuntime(684): at android.os.Looper.loop(Looper.java:137) 09-05 02:25:32.849: E/AndroidRuntime(684): at android.app.ActivityThread.main(ActivityThread.java:4424) 09-05 02:25:32.849: E/AndroidRuntime(684): at java.lang.reflect.Method.invokeNative(Native Method) 09-05 02:25:32.849: E/AndroidRuntime(684): at java.lang.reflect.Method.invoke(Method.java:511) 09-05 02:25:32.849: E/AndroidRuntime(684): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784) 09-05 02:25:32.849: E/AndroidRuntime(684): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551) 09-05 02:25:32.849: E/AndroidRuntime(684): at dalvik.system.NativeStart.main(Native Method) Thanks

    Read the article

< Previous Page | 81 82 83 84 85 86 87 88 89 90 91 92  | Next Page >