Push And Pull In Eclipse
Dec 9, 2014
I'm quite new in android programming and I've meet some problem in push and pull method. I have created 2 activity in my app 1 of them call Push_activity and Pull activity(Code are shown below). The String that I keyed in PushActivity have to "transfer" to the PullActivity when the button is pressed:
PullActivity
but1 = (Button)findViewById(R.id.buttonll);
tx = (TextView)findViewById(R.id.editText1);
tx.setText(getIntent().getStringExtra("extra"));
but1.setonclickListener(new onclickListener(){
[Code] ....
The app works fine when it started. When I press the button in PushActivity, it crashed and the error came from my textview in PullActivity.
View Replies
ADVERTISEMENT
May 10, 2014
I have designed an applet to simulate a stack (last-in, first-out) of strings. The applet consists of:
Two JButtons
Two JTextFields
Two JLabels
A TextArea
The user enters text in the first text field then clicks the push button and it goes in the textArea. After entering several strings the user can click the pop button and the top string goes into the second text field. I am a total newbie and am stuck. I can get a string of text to push to the textArea and then pop it out; however I can't stack them LIFO. Most examples I've seen use integers and I'm not sure how to translate the concept to strings. I'm just not sure how the stack concept works even though I read the API webpage.
My code
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Vector;
import javax.swing.JApplet;
import javax.swing.JButton;
[Code] ....
View Replies
View Related
Jan 18, 2012
I have some data in the database and values can be added on demand. so when ever the value added to the database i need to promt that message to all users which are accessing my website, so how can i acheive this....
View Replies
View Related
Dec 12, 2014
I'm unable to get the output for "AverageDriver" to print correctly(5 scores in descending order and average). The output displays the scores the same way they are entered and the average is always zero. The output for the Average program works fine and with the correct output.
import java.util.Scanner;
//This class keeps 5 scores entered by the user
public class Average
{
private int[] data;
private double mean;
public Average()
[Code] ....
View Replies
View Related
Apr 15, 2015
I'm trying to pull the authors from this Json object but I'm having issues trying to pull the author only, I'm only able to get a huge string which is a valid JSON object i tested it in [URL]
private class RunSearch extends AsyncTask<String, Void, String> {
private Exception e;
protected String doInBackground(String ...query){
[Code].....
View Replies
View Related
Apr 26, 2015
This method keeps throwing a NullPointerException. Not only that, but its not doing what I want it to do.
Heres the code:
/*
Remove all the numbers from the queue and push onto the stack until an operator is reached
*/
private static void processQueue() {
// Check what is at the front of the queue. If an operator is found or the queue is empty, exit method.
while(queue.front() != null || !queue.front().equals("*") || !queue.front().equals("/") || !queue.front().equals("%")
|| !queue.front().equals("+") || !queue.front().equals("-"))
{
stack.push(queue.removeFront()); // push the operand onto the stack
}
}
Here is the method that calls the processQueue() method
/*
Process the mathematical expression using a stack and a queue
*/
private static double processExpression() {
// insert all elements from the stack to the queue for processing
while(stack.top() != null) {
queue.insertBack(stack.pop());
[Code] .....
View Replies
View Related
Oct 18, 2014
Program to pull prime numbers between two entered values,
import java.util.Scanner;
public class question6 {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.println("Enter lower int:");
[Code] ....
View Replies
View Related
Apr 29, 2014
This program reads off of a text file that I have attached to my post. It is supposed to:
display the total sales for each week
the average daily sales for each week
the total sales for all of the weeks
the average weekly sales
the week number that had the highest amount of sales
the week number that had the lowest amount of sales
I can get everything but the very last one. In my code you will see that I tried to use a really large number so it would pull out the lowest amount, but it still didn't work: low = 100000000;
SalesData.txt (173bytes)
Number of downloads: 29
import javax.swing.JOptionPane;
import java.io.*;
import java.text.DecimalFormat;
import java.util.Scanner;
[code]....
View Replies
View Related
Apr 26, 2014
I've been trying to pull data from another class file "Calculations.java" and have it be displayed in a TextField in "DataAnalyzerGUI.java". Here is how the hierarchy is broken down for my assignment:
DataAnalyzerGUI.java extends JFrame
ReadFiles.java extends DataAnalyzerGUI.java
Calculations.java extends ReadFiles.java
Everything displays and functions correctly in a command prompt if I use a line like this:
System.out.println ("Lowest opening " + dateArray[lowestOpenIndex] + ": " + dataArray[lowestOpenIndex][2]);
But trying to get it to display in a GUI has been quite troubling.
I know the code is supposed to look something like this:
dataOutput.setText(DESIRED CODE HERE);
But I am unable to find anything of value to work out.
I have attached my complete project....
Attached File(s)
Assignment 4.pdf (247.05K)
Assignment 4.zip (235.81K)
View Replies
View Related
Feb 27, 2014
I'm not sure if that's the right place to ask
But I am a bit confused:
I know that JDK means "Java Development Kit" , but isn't Eclipse the same thing? (so why it's called "IDE"?)
Or maybe Eclipse is a type of JDK?
Or actually JDK and Eclipse are 2 different things
View Replies
View Related
Sep 10, 2014
I tried to run the program in eclipse(See Attachments 2 3 4) but I got the following errors(Attach 1), I have attached them as screen shots.
1.Errors
2. Mapper code
3. Reducer code
4. Driver
Since am new to java and hadoop, I want to know the procedure step by step in a brief manner.run this program and rest of the two statements successfully.
View Replies
View Related
Feb 10, 2015
i have programmed a game using JPanel and JFrame. My App is of this type (if this is relevant to the problem):
public class Main extends JPanel {
private JFrame frame;
public static void main(String[] args) {
new Main();
} public Main() {
frame.setSize(WIDTH, HEIGHT);
[Code] ....
The problem is, When i export the file in eclipse as Runnable jar file,and run the exported file, it gives me a blank screen (white default) and nothing is running. Whereas, normal debugging of the game is working quite well.
View Replies
View Related
Feb 27, 2015
i have an older file I was working on 2 months ago and when i try to open it in eclipse I get a message corruption error. I know this is not possible since I was just working on it a while back, and it's the same program version as what i am currently using..Or would I do a file import instead?
View Replies
View Related
Jul 22, 2014
it gives me an error at the end class part some syntax error insert "}"..
* Course: IT110 - Introduction to Programming
* Filename: MyCustomShirtsPhase1.java
*
* Purpose: Created a simple online ordering system for My Custom Shirts customers
*/
import javax.swing.JOptionPane;
[code]....
View Replies
View Related
Jan 25, 2012
I just started Java programming bout 3wks ago and using jGrasp since then. But ive started using eclipse and just wondering if it can be set up to use allman style? I dont like having to use tab and backspace to get my brackets in line and neat. I decided to ask before i went snooping around the settings and mess something up since im not to familiar with it right now.
View Replies
View Related
Nov 14, 2014
I'm installing sonarQube in Eclipse indigo, How to run SonarQube in Eclipse Projects and adding sonar plug in into Eclipse IDE.
View Replies
View Related
Jan 11, 2014
I'm new to java programming and I've been trying to make my first program in eclipse for a while, and I finally managed to do that. Well my problem is that I want to be able to use my program without having to open eclipse and opening my program from there, is there any way to do that ?
View Replies
View Related
Aug 26, 2014
I am new to Java and Eclipse. What does lined-out lines mean?
View Replies
View Related
Mar 26, 2014
I am trying to .wav file using java eclipse ..
[B]import java.io.* ;
import sun.audio.*;
public class AudioDemo{
public static void main(String[] args)
throws Exception
[Code] ....
And I am getting the following errors ...
Exception in thread "main" java.io.FileNotFoundException: E:pppp.wma (The system cannot find the file specified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(Unknown Source)
at java.io.FileInputStream.<init>(Unknown Source)
at AudioDemo.main(AudioDemo.java:10)
View Replies
View Related
May 31, 2014
I'm programming a game in Eclipse using Java for Android. I was wondering if any good example of a Health bar using Images. All I can find is people using the progress bar, but i feel that's unprofessional looking.
My goal is to layer 2 images. 1 being the frame of the health bar, 1 being the value of the health bar. I figured it would be something like moving the value health bar image few pixels over depending on the variable of health.
View Replies
View Related
Apr 13, 2014
import java.io.*;
public class ReadNumbers
{
void input()
{
String File_name = "num.txt";
File numbers = new File(File_name);
[code]....
I am using eclipse and I went to file, add new file and named it num.txt:shot.png like show in the picture.
View Replies
View Related
Apr 21, 2015
I'm trying to finish this game of hangman for java in the program eclipse. Currently when I run the program I get this in the text field:
in randomword
in string2Array[Ljava.lang.String;@22998b08
v
i
d
e
o
g
a
m
e
s
New Game
Enter a letter: s
s
???????????
After I try entering a letter it doesn't prompt for the user to enter another, nor does it change the ? mark when the user guesses correctly.
Here's the code :
import java.util.Scanner;
public class Hangman {
int NUMBER_STRIKES = 7;
int strikes = 0;
String userguess= " ";
private ArrayFunctions func = new ArrayFunctions();
String currentWord;
[Code] ....
View Replies
View Related
Jul 10, 2013
I write lot of java code everyday. Sometime in hurry I forget to close the resources (connection,file,etc,) in JAVA6 and this causes memory leak issues. I am looking for an eclipse plugin which can complain for these minor mistakes. Also I am looking for some more eclipse plugins which can improve my source code quality like naming conventions, code redundancy, complexity, too long code outside methods, etc,.
View Replies
View Related
May 6, 2015
I am watching BrandonioProductions on youtube. His videos are pretty good, but he doesn't seem to get errors where I get them. Here is an example.
public class compareUnequal {
public static void main(String[] args){
compareTwo();
}
public static void compareTwo(){
String x = "david";
String y = "Notdavid";
if (!x.equals(y)){
System.out.println("Not equal");
}
}
}
It runs ok, but asked me to proceed when there is an error, but I can`t figure out where the error is!
View Replies
View Related
May 26, 2014
Follow the //? FIRST and SECOND notes, then I understood that Java has GOTO as Keyword for future versions and that usually one can avoid GOTO using break inside the cycles, but I need a jump( salto) in the code.
import java.util.Scanner;
public class ArrayOrdinati {
public static void main (String[] args){
int[] Array = {5,3,1};
int e=Array.length;
int b;
[Code] .....
View Replies
View Related
Apr 9, 2014
I'm trying to JFileChooser to open up a window. I'm just trying to learn how to use it for a school assignment this week. The problem is I can't get anything to show up. I can create a new window and print to the console without errors, but JFileChooser doesn't do anything. No errors either.
import java.awt.*;
import javax.swing.*;
public class TestingStuff extends JFrame {
public TestingStuff() {
setTitle("This is a new window!");
setVisible(true);
[Code] .....
View Replies
View Related