Menu
  • HOME
  • TAGS

Android compiles but crashes

Tag: java,android,android-layout,listview,android-intent

i am trying to develop my first app. It compiles and installs but crashes when I open it.

Here is the Code

public class MainActivity extends ActionBarActivity implements OnItemClickListener {
private  ListView listview;
private DrawerLayout drawerlayout;
private ActionBarDrawerToggle drawerListener;
private LinearLayout menu;
private myAdapter myadapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);


    listview=(ListView)findViewById(R.id.ListView);




    myadapter=new myAdapter(this);
    listview.setOnItemClickListener(this);
    listview.setAdapter(myadapter);
    drawerlayout=(DrawerLayout)findViewById(R.id.drawerLayout);

    drawerListener= new ActionBarDrawerToggle(this,drawerlayout,R.drawable.ic_ic_drawer,R.string.app_name, R.string.app_name){
            @Override
            public void onDrawerClosed(View drawerView) {

                Toast.makeText(MainActivity.this, "ola", Toast.LENGTH_LONG).show();
                menu=(LinearLayout)findViewById(R.id.menu_lateral);
                 menu.setVisibility(View.VISIBLE);
                super.onDrawerClosed(drawerView);

        }



            @Override
            public void onDrawerOpened(View drawerView) {
                menu=(LinearLayout)findViewById(R.id.menu_lateral);
                 menu.setVisibility(View.GONE);
                super.onDrawerOpened(drawerView);
            }
    };




    drawerlayout.setDrawerListener(drawerListener);
    getSupportActionBar().setHomeButtonEnabled(true);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

}


@Override
public void onPostCreate(Bundle savedInstanceState,
        PersistableBundle persistentState) {
    drawerListener.syncState();
    super.onPostCreate(savedInstanceState, persistentState);
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.main, menu);
    return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
if(drawerListener.onOptionsItemSelected(item)){
    return true;
}
    return super.onOptionsItemSelected(item);
}

@Override
public void onConfigurationChanged(Configuration newConfig) {
    // TODO Auto-generated method stub
    super.onConfigurationChanged(newConfig);
    drawerListener.onConfigurationChanged(newConfig);
}

@Override
public void onItemClick(AdapterView<?> parent, View view, int position,
        long id) {

    class myAdapter extends BaseAdapter{
private Context context;
View row=null;
String [] menu;
int [] images ={R.drawable.ic_contact, R.drawable.menu, R.drawable.ic_reservas, R.drawable.ic_map, R.drawable.galeria, R.drawable.info, R.drawable.facebook };

public myAdapter(Context context) {
menu=context.getResources().getStringArray(R.array.slide);
this.context=context;
}
@Override
public int getCount() {
    // TODO Auto-generated method stub
    return menu.length;
}
@Override
public Object getItem(int position) {
    // TODO Auto-generated method stub
    return menu[position];
}
@Override
public long getItemId(int position) {
    // TODO Auto-generated method stub
    return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    if(convertView==null){
        View row=null;
        LayoutInflater inflater=(LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        row=inflater.inflate(R.layout.custom_row, parent, false);
    }
    else
    {
        row=convertView;
    }

    TextView titulo=(TextView) row.findViewById(R.id.textView1);
    ImageView icone=(ImageView) row.findViewById(R.id.imageView1);

    titulo.setText(menu[position]);
    icone.setImageResource(images[position]);
    return row;
}

And here is the log cat

    06-13 18:55:12.842: D/OpenGLRenderer(4763): Render dirty regions requested: true
06-13 18:55:12.862: D/Atlas(4763): Validating map...
06-13 18:55:12.942: I/Adreno-EGL(4763): <qeglDrvAPI_eglInitialize:410>: EGL 1.4 QUALCOMM build: AU_LINUX_ANDROID_LA.AF.1.1.04.04.03.164.081_msm8960_LA.AF.1.1__release_AU ()
06-13 18:55:12.942: I/Adreno-EGL(4763): OpenGL ES Shader Compiler Version: E031.25.01.03
06-13 18:55:12.942: I/Adreno-EGL(4763): Build Date: 11/02/14 Sun
06-13 18:55:12.942: I/Adreno-EGL(4763): Local Branch: mybranch5454281
06-13 18:55:12.942: I/Adreno-EGL(4763): Remote Branch: quic/l_LNX.LA.3.6
06-13 18:55:12.942: I/Adreno-EGL(4763): Local Patches: NONE
06-13 18:55:12.942: I/Adreno-EGL(4763): Reconstruct Branch: AU_LINUX_ANDROID_LA.AF.1.1.04.04.03.164.081 + db92d1e + cb8de02 +  NOTHING
06-13 18:55:12.942: I/OpenGLRenderer(4763): Initialized EGL, version 1.4
06-13 18:55:12.972: D/OpenGLRenderer(4763): Enabling debug mode 0
06-13 18:55:13.072: D/AndroidRuntime(4763): Shutting down VM
06-13 18:55:13.102: E/AndroidRuntime(4763): FATAL EXCEPTION: main
06-13 18:55:13.102: E/AndroidRuntime(4763): Process: com.example.alambique, PID: 4763
06-13 18:55:13.102: E/AndroidRuntime(4763): java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.View android.view.View.findViewById(int)' on a null object reference
06-13 18:55:13.102: E/AndroidRuntime(4763):     at com.example.alambique.myAdapter.getView(MainActivity.java:155)
06-13 18:55:13.102: E/AndroidRuntime(4763):     at android.widget.AbsListView.obtainView(AbsListView.java:2346)
06-13 18:55:13.102: E/AndroidRuntime(4763):     at android.widget.ListView.makeAndAddView(ListView.java:1864)
06-13 18:55:13.102: E/AndroidRuntime(4763):     at android.widget.ListView.fillDown(ListView.java:698)
06-13 18:55:13.102: E/AndroidRuntime(4763):     at android.widget.ListView.fillFromTop(ListView.java:759)
06-13 18:55:13.102: E/AndroidRuntime(4763):     at android.widget.ListView.layoutChildren(ListView.java:1673)
06-13 18:55:13.102: E/AndroidRuntime(4763):     at android.widget.AbsListView.onLayout(AbsListView.java:2150)
06-13 18:55:13.102: E/AndroidRuntime(4763):     at android.view.View.layout(View.java:15596)
06-13 18:55:13.102: E/AndroidRuntime(4763):     at android.view.ViewGroup.layout(ViewGroup.java:4966)
06-13 18:55:13.102: E/AndroidRuntime(4763):     at android.support.v4.widget.DrawerLayout.onLayout(DrawerLayout.java:931)
06-13 18:55:13.102: E/AndroidRuntime(4763):     at android.view.View.layout(View.java:15596)
06-13 18:55:13.102: E/AndroidRuntime(4763):     at android.view.ViewGroup.layout(ViewGroup.java:4966)
06-13 18:55:13.102: E/AndroidRuntime(4763):     at android.widget.FrameLayout.layoutChildren(FrameLayout.java:573)
06-13 18:55:13.102: E/AndroidRuntime(4763):     at android.widget.FrameLayout.onLayout(FrameLayout.java:508)
06-13 18:55:13.102: E/AndroidRuntime(4763):     at android.view.View.layout(View.java:15596)
06-13 18:55:13.102: E/AndroidRuntime(4763):     at android.view.ViewGroup.layout(ViewGroup.java:4966)
06-13 18:55:13.102: E/AndroidRuntime(4763):     at android.widget.FrameLayout.layoutChildren(FrameLayout.java:573)
06-13 18:55:13.102: E/AndroidRuntime(4763):     at android.widget.FrameLayout.onLayout(FrameLayout.java:508)
06-13 18:55:13.102: E/AndroidRuntime(4763):     at android.view.View.layout(View.java:15596)
06-13 18:55:13.102: E/AndroidRuntime(4763):     at android.view.ViewGroup.layout(ViewGroup.java:4966)
06-13 18:55:13.102: E/AndroidRuntime(4763):     at android.support.v7.internal.widget.ActionBarOverlayLayout.onLayout(ActionBarOverlayLayout.java:493)
06-13 18:55:13.102: E/AndroidRuntime(4763):     at android.view.View.layout(View.java:15596)
06-13 18:55:13.102: E/AndroidRuntime(4763):     at android.view.ViewGroup.layout(ViewGroup.java:4966)
06-13 18:55:13.102: E/AndroidRuntime(4763):     at android.widget.FrameLayout.layoutChildren(FrameLayout.java:573)
06-13 18:55:13.102: E/AndroidRuntime(4763):     at android.widget.FrameLayout.onLayout(FrameLayout.java:508)
06-13 18:55:13.102: E/AndroidRuntime(4763):     at android.view.View.layout(View.java:15596)
06-13 18:55:13.102: E/AndroidRuntime(4763):     at android.view.ViewGroup.layout(ViewGroup.java:4966)
06-13 18:55:13.102: E/AndroidRuntime(4763):     at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1703)
06-13 18:55:13.102: E/AndroidRuntime(4763):     at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1557)
06-13 18:55:13.102: E/AndroidRuntime(4763):     at android.widget.LinearLayout.onLayout(LinearLayout.java:1466)
06-13 18:55:13.102: E/AndroidRuntime(4763):     at android.view.View.layout(View.java:15596)
06-13 18:55:13.102: E/AndroidRuntime(4763):     at android.view.ViewGroup.layout(ViewGroup.java:4966)
06-13 18:55:13.102: E/AndroidRuntime(4763):     at android.widget.FrameLayout.layoutChildren(FrameLayout.java:573)
06-13 18:55:13.102: E/AndroidRuntime(4763):     at android.widget.FrameLayout.onLayout(FrameLayout.java:508)
06-13 18:55:13.102: E/AndroidRuntime(4763):     at android.view.View.layout(View.java:15596)
06-13 18:55:13.102: E/AndroidRuntime(4763):     at android.view.ViewGroup.layout(ViewGroup.java:4966)
06-13 18:55:13.102: E/AndroidRuntime(4763):     at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2072)
06-13 18:55:13.102: E/AndroidRuntime(4763):     at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1829)
06-13 18:55:13.102: E/AndroidRuntime(4763):     at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1054)
06-13 18:55:13.102: E/AndroidRuntime(4763):     at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5786)
06-13 18:55:13.102: E/AndroidRuntime(4763):     at android.view.Choreographer$CallbackRecord.run(Choreographer.java:767)
06-13 18:55:13.102: E/AndroidRuntime(4763):     at android.view.Choreographer.doCallbacks(Choreographer.java:580)
06-13 18:55:13.102: E/AndroidRuntime(4763):     at android.view.Choreographer.doFrame(Choreographer.java:550)
06-13 18:55:13.102: E/AndroidRuntime(4763):     at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:753)
06-13 18:55:13.102: E/AndroidRuntime(4763):     at android.os.Handler.handleCallback(Handler.java:739)
06-13 18:55:13.102: E/AndroidRuntime(4763):     at android.os.Handler.dispatchMessage(Handler.java:95)
06-13 18:55:13.102: E/AndroidRuntime(4763):     at android.os.Looper.loop(Looper.java:135)
06-13 18:55:13.102: E/AndroidRuntime(4763):     at android.app.ActivityThread.main(ActivityThread.java:5256)
06-13 18:55:13.102: E/AndroidRuntime(4763):     at java.lang.reflect.Method.invoke(Native Method)
06-13 18:55:13.102: E/AndroidRuntime(4763):     at java.lang.reflect.Method.invoke(Method.java:372)
06-13 18:55:13.102: E/AndroidRuntime(4763):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:898)
06-13 18:55:13.102: E/AndroidRuntime(4763):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:693)
06-13 18:55:13.162: I/Process(4763): Sending signal. PID: 4763 SIG: 9

Best How To :

View row=null;

Is defined twice as local variable in if{} block, and as class field in adapter. Row variable here:

TextView titulo=(TextView) row.findViewById(R.id.textView1);
ImageView icone=(ImageView) row.findViewById(R.id.imageView1);

is declared as adapter field, assigned to null (probably to avoid compiler complains) and then never touched again. Solution - just declare variable in proper way.

viewResolver with more folders inside of WEB-INF/jsp is not working in spring

java,spring,jsp,spring-mvc

Say you have a jsp test.jsp under /WEB-INF/jsp/reports From your controller return @RequestMapping("/helloWorld") public String helloWorld(Model model) { model.addAttribute("message", "Hello World!"); return "reports/test"; } ...

Fixed element in android?

android,xml,android-fragments

You need a FrameLayout. In a FrameLayout, the children are overlapped on top of each other with the last child being at the topmost. activity_main.xml <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:fab="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true"> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent"...

Interpreting hex dump of java class file

java,class,hex

The 000000b0 is not part of the data. It's the memory address where the following 16 bytes are located. The two-digit hex numbers are the actual data. Read them from left to right. Each row is in two groups of eight, purely to asist in working out memory addresses etc....

Android Implicit Intent for Viewing a Video File

java,android,android-intent,uri,avd

Change your onClick method to below code. You should give the option to choose the external player. @Override public void onClick(View v) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(Uri.parse("https://youtu.be/jxoG_Y6dvU8"), "video/*"); startActivity(Intent.createChooser(intent, "Complete action using")); } ...

Finding embeded xpaths in a String

java,regex

Use {} instead of () because {} are not used in XPath expressions and therefore you will not have confusions.

Get current latitude and longitude android

java,android,gps,geolocation,location

See my post at http://gabesechansoftware.com/location-tracking/. The code you're using is just broken. It should never be used. The behavior you're seeing is one of the bugs- it doesn't handle the case of getLastLocation returning null, an expected failure. It was written by someone who kind of knew what he was...

Android programming, draw a rectangle with specific coordinates

android

http://android.okhelp.cz/draw-rect-android-basic-example/ http://alvinalexander.com/android/how-to-draw-rectangle-in-android-view-ondraw-canvas canvas.drawColor(Color.CYAN); Paint p = new Paint(); // smooths p.setAntiAlias(true); p.setColor(Color.RED); p.setStyle(Paint.Style.STROKE); p.setStrokeWidth(4.5f); canvas.drawRect(10, 10, 30, 30, p); ...

How to resolve Out of Memory Error on Bitmap in Android?

android,android-intent,android-activity,bitmap

use following method..... **************************************************** Bitmap bm = ShrinkBitmap(imagefile, 300, 300); image.setImageBitmap(bm); Bitmap ShrinkBitmap(String file, int width, int height) { BitmapFactory.Options bmpFactoryOptions = new BitmapFactory.Options(); bmpFactoryOptions.inJustDecodeBounds = true; Bitmap bitmap = BitmapFactory.decodeFile(file, bmpFactoryOptions); int heightRatio =(int)Math.ceil(bmpFactoryOptions.outHeight/(float)height); int widthRatio =...

why is Android app publishing taking several days [on hold]

android,google-play,publishing

here is detail provided by the google and for more details http://www.appmakr.com/blog/how-long-app-approved/ https://somethingididnotknow.wordpress.com/2014/03/11/how-long-does-it-take-for-the-google-play-store-to-publish-my-app-in-beta/ Android application approval process in playstore ...

Dagger 2 Custom Scope for each Fragment

android,android-fragments,dagger-2

Your understanding is correct. The named scopes allow you to communicate intention, but they all work the same way. For scoped provider methods, each Component instance will create 1 instance of the provided object. For unscoped provider methods, each Component instance will create a new instance of the provided object...

Android set clickable text to go one fragment to another fragment

java,android,android-fragments,spannablestring

If LoginActivity is a fragment class then it would be okay is you use setOnClickListener on textview. But for fragment change you have to change Intent to fragmentTransaction, Use something like, textview.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { getFragmentManager().beginTransaction().replace(R.id.container, new LoginActivity() ).addToBackStack("").commit(); }); But, if you want to...

Android custom calendar view disable specific dates

android,calendarview

Include CalendarPickerView in your layout XML. <com.squareup.timessquare.CalendarPickerView android:id="@+id/calendar_view" android:layout_width="match_parent" android:layout_height="match_parent" /> In the onCreate of your activity/dialog or the onCreateView of your fragment, initialize the view with a range of valid dates as well as the currently selected date. Calendar nextYear = Calendar.getInstance(); nextYear.add(Calendar.YEAR, 1); CalendarPickerView calendar = (CalendarPickerView) findViewById(R.id.calendar_view);...

type conversion if flex

java,actionscript-3,flex

You try to cast data type mx.collections:IList to UI component type spark.components:List, which of course leads to exception. Try to follow the error message hint and use mx.collections:IList: screenList.addAll(event.result as IList); ...

How to call MySQL view in Struts2 or Hibernate

java,mysql,hibernate,java-ee,struts2

You can simply create an Entity, that's mapping the database view: @Entity public class CustInfo { private String custMobile; private String profession; private String companyName; private Double annualIncome; } Make sure you include an @Id in your view as well, if that's an updatable view. Then you can simply use...

Set value for Spinner with custom Adapter in Android

android,dynamic,android-arrayadapter,android-spinner

@Haresh Chhelana example is good, However if you want to show both name and code in spinner after selecting, check this out. List<Map<String, String>> items = new ArrayList<Map<String, String>>(); for (int i = 0; i < JA.length(); i++) { json = JA.getJSONObject(i); mapData = new HashMap<String, String>(); mapData.put("name", json.getString("Name")); mapData.put("code",...

Mysterious claim of a missing { in eclipse

java,eclipse

In Java, you cannot write executable statements directly in class.So this is syntactically wrong: for(int i=0; i<10; i++) { this.colorList[i] = this.allColors[this.r.nextInt(this.allColors.length)]; } Executable statements can only be in methods/constructors/code blocks...

BitmapFont class does not have getBound(String) method

java,android,libgdx

After the API 1.5.6 we have a different way to get the String bound. try this GlyphLayout layout = new GlyphLayout(); layout.setText(bitmapFont,"text"); float width = layout.width; float height = layout.height; and it's not recommended to create new GlyphLayout on each frame, create once and use it. ...

Keep HashMap with object data while app is idle - Android

android,android-activity

May be the activity is again loading that is onCreate() is called. So save the state and restore it. Use onSaveInstanceState() and onRestoreInstanceState(). Let me know whether it worked or not.

Floating Action Button in Xamarin.Forms

android,xamarin,monodroid,xamarin.forms,floating-action-button

Before the official support library came out I ported the FAB over. There is now a Xamarin.Forms sample in my GitHub repo that you can use: https://github.com/jamesmontemagno/FloatingActionButton-for-Xamarin.Android...

Is there any way to use a pre-existing database from Xamarin without copying it from Assets?

android,xamarin,xamarin.forms

You don't want to use it from assets, even if you could, because assets is a compressed read only file, part of your installation. You can't write updates into it, which kills 90% of database use. And its inefficient for reading as its zipped up. So you really do need...

Problems implementing ViewHolder pattern

android,design-patterns

Try like this... public View getView(int poisition, View convertView , ViewGroup parent) { ViewHolder crimeHolder = null; //If we weren't given a view, inflate one if (convertView == null) { convertView = getActivity().getLayoutInflater().inflate(R.layout.list_item_crime, null); crimeHolder = new ViewHolder(); crimeHolder.titleTextView = (TextView)convertView.findViewById(R.id.listItemTitleTextView); crimeHolder.dateTextView = (TextView)convertView.findViewById(R.id.listItemDateTextView); crimeHolder.solvedCheckBox =...

Twitter4j - cannot resolve method - setUsessl(boolean)

android,android-studio,twitter4j

Try to use the following configuration: ConfigurationBuilder cb = new ConfigurationBuilder(); cb.setOAuthAuthenticationURL("https://api.twitter.com/oauth/request_token"); cb.setOAuthAccessTokenURL("https://api.twitter.com/oauth/access_token"); cb.setOAuthAuthorizationURL("https://api.twitter.com/oauth/authorize"); cb.setOAuthRequestTokenURL("https://api.twitter.com/oauth/request_token"); cb.setRestBaseURL("https://api.twitter.com/1.1/"); cb.setOAuthConsumerKey(consumerKey);...

How to set speaker phone off when the app is killed by the “Recent App drawer”

android,android-audiomanager,ondestroy

Use a service like: public class FirstService extends Service { private AudioManager audioManager; @Override public IBinder onBind(Intent arg0) { return null; } @Override public void onDestroy() { super.onDestroy(); audioManager.setSpeakerphoneOn(false); //Turn of speaker } } public void onDestroy () Added in API level 1 Called by the system to notify a...

Join files using Apache Spark / Spark SQL

java,apache-spark,apache-spark-sql

If you use plain spark you can join two RDDs. let a = RDD<Tuple2<K,T>> let b = RDD<Tuple2<K,S>> RDD<Tuple2<K,Tuple2<S,T>>> c = a.join(b) This produces an RDD of every pair for key K. There are also leftOuterJoin, rightOuterJoin, and fullOuterJoin methods on RDD. So you have to map both datasets to...

Is there any sdk to log exceptions, events and errors in production app?

android,logging,error-handling,sdk,production

Flurry analytics crashlytics They will give you the logs and errors in production app..I think this will suits you well...

Get network interfaces on remote machine

java,network-programming

No, we cannot by definition. The IP address is needed to hide the mac address from external world. To retrieve it you definitely need some code running on that machine. It means that you need some kind of agent. You can either implement it in Java or use platform specific...

Getting particular view from expandable listview

java,android,listview,android-fragments,expandablelistview

You shouldn't pass your view item form a fragment to an other. You should retrieve the object associated with your group view, pass this object to your second/edition fragment. You can use setTargetFragment(...) and onActivityResult(...) to send the modified text from your second to your first fragment. And then you...

how to add menu items to action bar in more than 30 activities

android,android-activity,android-studio,menu,menuitem

Option A A base Activity class that implements the logic for the menu items - in this case all 30 of your Activities should extend the base Activity. This approach has the serious limitation that it forces you to extend a class even though you may need to extend another...

Selenium catch popup on close browser

java,selenium,browser

Instead of using driver.quit() to close the browser, closing it using the Actions object may work for you. This is another way to close the browser using the keyboard shortcuts. Actions act = new Actions(driver); act.sendKeys(Keys.chord(Keys.CONTROL+"w")).perform(); Or, if there are multiple tabs opened in driver window: act.sendKeys(Keys.chord(Keys.CONTROL,Keys.SHIFT+"w")).perform(); ...

PropertyNotFoundException in jsp

java,jsp

The name of your getter & setter is wrong. By convention it must be: public Integer getSurvey_id() { return survey_id; } public void setSurvey_id(Integer survey_id) { this.survey_id=survey_id; } ...

Can I install 2 or more Android SDK when using Eclipse

java,android,eclipse,sdk,versions

There shouldn't be any problem if you use the latest SDK version ; actually, this is recommended. However, make sure to set the correct "Target SDK", i.e. the highest android version you have successfully tested your app with, and the "Minimum Required SDK" as well....

Why i get can not resolve method error in class android?

android,json

You didn't create setName() method in Person class. public class Person { private String name; private String country; private String twitter; //getters & setters.... public void setName(String pName) { this.name = pName; } public void getName() { return this.name; } } ...

How can implement long running process in spring hibernate?

java,spring,hibernate

I recommend you to use DeferredResult of Spring. It´s a Future implementation, that use the http long poling technique. http://docs.spring.io/spring-framework/docs/3.2.0.BUILD-SNAPSHOT/api/org/springframework/web/context/request/async/DeferredResult.html So let´s says that you will make a request, and the server it will return you the deferredResult, and then your request will keep it open until the internal process(Hibernate)...

Javadoc: Do parameter and return need an explicit type description

java,types,javadoc

No, there's no need, the JavaDoc tool parses the Java code and gets the types from there. This article on the Oracle Java site may be useful: How to Write Doc Comments for the Javadoc Tool From the @param part of that article: The @param tag is followed by the...

Java dice roll with unexpected random number

java,if-statement

else { System.out.println(diceNumber); } You are printing the address of diceNumber by invoking its default toString() function in your else clause. That is why you are getting the [email protected] The more critical issue is why it gets to the 'else' clause, I believe that is not your intention. Note: In...

Java Scanner not reading newLine after wrong input in datatype verification while loop

java,while-loop,java.util.scanner

You are reading too much from the scanner! In this line while (sc.nextLine() == "" || sc.nextLine().isEmpty()) you are basically reading a line from the scanner, comparing it (*) with "", then forgetting it, because you read the next line again. So if the first read line really contains the...

Using world coordinates

java,libgdx

You shouldn't use constant a pixel-to-unit conversion, as this would lead to different behavior on different screen sizes/resolutions. Also don't forget about different aspect ratios, you also need to take care about them. The way you should solve this problem is using Viewports. Some of them support virtual screen sizes,...

Get document on some condition in elastic search java API

java,elasticsearch,elasticsearch-plugin

When indexing documents in this form, Elasticsearch will not be able to parse those strings as dates correctly. In case you transformed those strings to correctly formatted timestamps, the only way you could perform the query you propose is to index those documents in this format { "start": "2010-09", "end":...

how to call Java method which returns any List from R Language? [on hold]

java,r,rjava

You can do it with rJava package. install.packages('rJava') library(rJava) .jinit() jObj=.jnew("JClass") result=.jcall(jObj,"[D","method1") Here, JClass is a Java class that should be in your ClassPath environment variable, method1 is a static method of JClass that returns double[], [D is a JNI notation for a double array. See that blog entry for...

Unfortunately, (My app) has stopped. Eclipse Android [duplicate]

java,android,eclipse,adt

In your MainActivity.java at line no 34 you are trying to initialize some widget that is not present in your xml layout which you have set it in your setContentView(R.layout.... That;s why you are geting nullpointerexception. EDIT: change your setContentView(R.layout.activity_main) to setContentView(R.layout.fragment_main)...

Android String if-statement

java,android,string

Correct me if I'm wrong. If you're saying that your code looks like this: new Thread(new Runnable() { public void run() { // thread code if (ready.equals("yes")) { // handler code } // more thread code }).start(); // later on... ready = "yes"; And you're asking why ready = "yes"...

how does android ImageView resize my image?

android

I'm not sure what are you trying to do, are you trying to have the imageview to adapt to your image's size or are you trying to have your image view at a fixed size? When the image is shown on a xhdpi screen will the image be scaled to...