Android TextView Doesn't Update

Jul 17, 2014

I am trying to present the user with a response of 'correct' or 'incorrect'. I do the following, but mResultTextView never updates.

mResultTextView.setText("Correct");
android.os.SystemClock.sleep(1000);

I think the problem is that my view needs to be re-drawn.

package com.example.quiz;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Random;
import android.graphics.Color;

[code]...

View Replies


ADVERTISEMENT

Text From The Class Game Doesn't Update

May 3, 2014

I have a main class that hold the frame and paints, a class for drawing my game, and an image that is drawn too.
I want to count the amount of times I click on this "android" (right now it counts if i click the screen) but the text from the class Game doesn't update.

androidX = Main.width - android.getWidth();

doesn't work. In my head the image should be inside the borders but it isn't. Have I calculated the pixels wrong or am I missing something?

public class Main extends JPanel{
public static final int width = 600;
public static final int height = 600;
Game game = new Game();
Android android = new Android();
public void paint(Graphics g) {
super.paint(g);
game.render(g);
android.render(g);

[code]....

View Replies View Related

JavaFX 2.0 :: Modifying Item In Observable List Doesn't Update ListView

Oct 3, 2014

I am using:

Java:..... 1.8.0_20JavaFX:... 8.0.20-b26 

I have this class:
 
public class Person {
    private SimpleStringProperty name;
    public SimpleStringProperty nameProperty(){
        if(this.name==null){
            this.name=new SimpleStringProperty();

[Code] .....

I have this:

lista = FXCollections.<Person>observableArrayList();
lista.addAll(new Person("uno"),new Person("due"),new Person("tre"));
myListView.setItems(lista);

The problem is if I add /remove an item all is fine, the listView refreshes correctly:

Person p = new Person(tfld_textAdd.getText());
lista.add(0, p);
 
But if I change a value on an item into the observable list it doesn't:

lista.get(0).setName("new value");
 
I also have a table linked in the same way and the table workd correctly after I updated my Java version...

View Replies View Related

Java Array Update Without Using ArrayList - Add Values And Update Size?

Feb 9, 2015

I am trying to create an array list without using the built in arrayList class that java has. I need to start the array being empty with a length of 5. I then add objects to the array. I want to check if the array is full and if not add a value to the next empty space. Once the array is full I then need to create a second array that starts empty and with the length of the first array + 1.

The contents of the first array are then copied into the new array without using the built in copy classes java has and then the new array ends up containing 5 elements and one null space the first time round. The first array is then overwritten with the new array containing the 5 elements and the null space. The process then starts again adding values until the array is full which will be 1 more value then recreating the second array empty and the length of the first array + 1. This is my attempt at creating this but I have run into multiple problems where I get only the last value I added and the rest of the values are null:

public class MyArrayList {
public Object arrayList[];
public MyArrayList(Object[] arrayList) {
this.arrayList = arrayList;

[code]...

View Replies View Related

JSF :: Update Action Does Not Update Bean Attribute

May 14, 2014

I have a strange behaviour when trying to update a bean. Here is the edit page:

<h3>Edit Post</h3>
<div class="row">
<h:form>
<div class="small-3 columns">
<label for="right-label" class="right inline">Title</label>

[Code] ....

Here is the bean class:

package com.airial.controllers;
import com.airial.domain.Post;
import com.airial.service.PostService;
import com.ocpsoft.pretty.faces.annotation.URLMapping;
import com.ocpsoft.pretty.faces.annotation.URLMappings;
import org.springframework.beans.factory.annotation.Autowired;

[code]...

postToUpdatet is always NULL. Why the title property is not binded ? What is wrong here ?

View Replies View Related

Android Manifest Could Not Be Found

Apr 14, 2014

I am trying to run a project and i am getting different errors, I know the code is working because i have seen it running, but now i cant even get the app to load up. sometime I get a AndroidManifest cannot be found error and sometimes i get a error like

[2014-04-14 17:28:31 - DatabasePrototype5] Failed to install DatabasePrototype5.apk on device 'emulator-5554!
[2014-04-14 17:28:31 - DatabasePrototype5] (null)
[2014-04-14 17:28:32 - DatabasePrototype5] Launch canceled!

my AndroidManifest

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.databaseprototype5"
android:versionCode="1"
android:versionName="1.0" >

[Code] ....

View Replies View Related

Android App Battleship Board

Nov 11, 2014

I want to make the board for the game, I want it to be a two-dimensional array of buttons.I know how to make a array but is there a class of buttons that I need to use? and how do I connect it to the xml?I am using eclipse.

View Replies View Related

Eclipse Android - How To Go From 2nd Activity To 3rd Using Buttons

Feb 8, 2015

I didn't see anything specific to Android. I am a very basic beginner when it comes to JAVA and Android programming.

The app is a very simple comic strip viewer that views 3 panels of a comic strip one at a time. My problem is going from a second activity to another. I can go from the main activity to the second fine but when I press the next button to go from the second activity to the third nothing happens. I have tried a few different things but end up with either nothing happening or the app crashes.

Here is my MainActivity Code:

package net.androidbootcamp.comicapp;
import android.support.v7.app.ActionBarActivity;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;

[Code]...

Here is the code for the second panel:

package net.androidbootcamp.comicapp;
import android.app.Activity;
import android.os.Bundle;
public class Panel2 extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {

[Code]...

Here is the code for Panel 3:

package net.androidbootcamp.comicapp;
import android.app.Activity;
import android.os.Bundle;
public class Panel3 extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {

[Code]...

And here is the manifest:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="[URL].."
package="net.androidbootcamp.comicapp"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk

[Code]...

I am sure it is something very simple but I am not sure what it could be.

View Replies View Related

Value Of Variable In Java - Android Studio

Jun 4, 2014

I have an integer variable called 'selectedname' which is declared as shown below.

public class MainActivity extends Activity implements View.onclickListener, AdapterView.OnItemClickListener {
int selectedname;

So when the app starts an Alert Dialog with two buttons asks the user if they want to tell the first or the last name. The two buttons are 'first' and 'last'.

The problem I'm facing is that in the code the value of selectedname is suppose to change depending on the users choice as shown below.

public void displayWelcome() {
//*other code comes here but it works fine*
AlertDialog.Builder choice = new AlertDialog.Builder(this);
choice.setTitle("Yo!");
choice.setMessage("First name or last");
choice.setPositiveButton("First", new DialogInterface.onclickListener() {
public void onclick(DialogInterface dialog, int whichButton) {
selectedname = 1;

[Code] .....

View Replies View Related

Adding App To Launcher Using Android Studio

Feb 5, 2015

I am trying to make my first application on Android. I have never done it before. I am totally new at it. I want my app to show as an icon on the launcher but how to do it.

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="net.graphicport.homeinventory" >
<!-- To auto-complete the email text field in the login form with the user's emails -->
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.READ_PROFILE" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.INTERNET" />

[code]...

View Replies View Related

How To Load Bitmap Image In Android

Apr 23, 2014

I have been trying to draw a bitmap image onto the canvas from Android and all it displays is a blank white screen. Whenever my app starts up, I am calling this in my game - view class which extends View and overrides the onDraw method:

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Paint;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;

[Code] ....

View Replies View Related

Make A Unique News App For Android

Jan 25, 2015

I'm planning to make a unique news app for android (maybe iOS later) and I am fairly experienced in Java. Im thinking to most likely use RSS feeds, but am unaware how to implement them into JAVA.

View Replies View Related

Android Large Strings / Data

Dec 4, 2014

I'm programming an android app where I want to send large sets of data from an MySQL Table to the app and write this data to an SQLite database.So I know i have send an HttpRequest and I can send data with json, but how can I handle large datasets like tables?I think its no good idea to just concatinate a string together in php and then send it?

View Replies View Related

Implementing Java Project With Android

Nov 19, 2014

I have a gameengine stil partially in the works for pc made in java, I am attempting a port over to java but certain classes and other fuctions are not available for android that there is in java. this means that my render engine, gameengine and a couple of other clases therefore don't work.

My question is, is there anyway of using the gameengine classes that work into the project so that all i have to do is declare within the engine what i want to export for wheather this is android or java. or importing packages from the game engine project and directly linking with the ability of re-writing the odd few classes that do not work.

View Replies View Related

Getting Android Animation To Move Along The Edge Of Screen

Feb 18, 2014

I'm trying to get my animation for my java game to move along the edges of my device. Once it hits the edge I would like it to turn and keep moving along the edges. I'm sure this is easier than I'm making it but I can't find much on this. Right now my animation moves right and goes right off the screen until the app is closed and restarted.

This is my code so far:

package com.pjf.animation;
import java.io.IOException;
import java.io.InputStream;
import android.content.Context;
import android.content.res.AssetManager;
import android.graphics.Bitmap;

[Code] .....

View Replies View Related

Android Game - Record A Single Click

Nov 7, 2014

I'm making a game to teach myself programming java so I can start making android. I have this game I'm making where there will be objects(so far its asteroids) will be falling with a progressive velocity (they will move faster as time goes on). The object is the click on the objects before they hit the bottom. It's still early meaning not all the parts I want to implement are there but it works the way I want it to so far besides my click function.

I'm using the Mouse.isButtonDown(0) to record left click but It lets me hold it down and hover over them instead of clicking on each one. Here is a snippet of the part of the code im talking about :

I uploaded a .jar and a exe file so you can see what I mean
[URL] .... -jar
[URL] .... -exe

public void update(GameContainer gc, int d) throws SlickException
{
posX = Mouse.getX();
posY = (Mouse.getY()-height)*-1;
timePassed += d;
deltaTime= deltaTime();

[Code] .....

View Replies View Related

Make Edit Text Validation For Android

Nov 22, 2014

I am currently developing an android application. there is a problem i got just now. here's the code for java.

public class doReceipt extends Activity
{
boolean nsPutih, nsBeriyani,nsMinyak,aymKurma,aymLemak,aymKari,aymRendang,aymMerah,
prtAsam, dggTomato, dggSinggang, dggMerah,kerabuTaugeh, pindangKacang,jelatah,dalcaSayur,papadom,
kariIkan,ikanMasin, sirapAis, oren,tehTarik,agarAgar, buburKacang,kuih, price;

TextView tvOutput1,tvOutput2, tvOutput3, tvOutput4, tvOutput5, tvOutput6, tvOutput7, tvOutput8, tvOutput9, tvOutput10,

[Code] ....

There is no error shown in the code. but, when i run my program for start, the page before cannot proceed and yet, i cannot proceed to this page and the application stop unexpectedly. below is the error that i gain in logcat.

11-22 06:59:57.664: D/dalvikvm(290): GC_EXPLICIT freed 1505 objects / 106560 bytes in 184ms
11-22 07:00:39.174: D/dalvikvm(320): GC_FOR_MALLOC freed 2489 objects / 160496 bytes in 109ms
11-22 07:00:39.534: E/MENU PAKEJ A(320): Total Price: RM 0.0
11-22 07:00:39.544: D/AndroidRuntime(320): Shutting down VM

[Code] .....

View Replies View Related

How To Return A String From Java To Android Project

Jun 26, 2014

I tried many times to return a string from java project to an android project But it keeps sending incorrect values as in as it should be 1 here is an example.

Java Project:

boolean somethingboolean = false;
if(something == "1"){
somethingboolean = true;
}
public static String getString(){
if(somethingboolean == true){
return "TRUE";
}else{
return "FALSE";
}
}

Android project:

System.out.println(JavaProject.getString())

And in the android project it prints "FALSE"

So what should i do?

View Replies View Related

Android Eclipse Home Game Poker

Sep 1, 2014

I'm trying to create a Texas hold'em Poker application. A rough idea of it would be similar to those poker games on the playstore e.g. Zynga Poker, however it will be a simplified version, more of a home-based application, for a small group of friends. This way, we can get to play poker on the go with each other, like a private table on the go. Anyway, right now how do I get started?

1) How should I even start this project? Do I start the GUI for the application first? Start designing the applications with photoshop? I figured I need a skeletal guide to start and follow.

2) How do I connect all the players together to a table? I know I could use my phone as a Server, where the rest could connect to mine. But I'm not sure what I should research on. Also, as I'm working towards a "Portable, On the go Application". So I would like to work this more based on 3G/4G networks.

3) Database, I would like something to keep a record on the buy-in, winnings & losings so we can keep track of it. However, if the server was my phone. When I turn off the server, would the database be gone? Maybe I might be able to save it on a notepad in a folder on my phone? I think this is possible.

View Replies View Related

Android Racing Game - Algorithm Efficiency

Feb 6, 2014

I am making an android racing game. I have a method that draws the track to the screen, the map is bigger than the screen so i clip the bitmap and draw it to the screen hence to draw the track I have to get the visible track points and then draw them. I have noticed that when I enable drawing the track the game lags quite a bit but when i disable it is smooth as expected the code is below :

public void drawTrack(Canvas canvas) {
if (this.trackPoints != null && this.trackPoints.size() > 0) {
 // get points, convert back to screen coords and add them to array,
// then
// use that arraylist<point> below
getCurrentVisibleTrack();
counter++;
if (this.visibleTrackPoints.size() > 0) {
 
[Code] .....

View Replies View Related

Mathematical Parser Only Returns Size2 And Not Size In Android App

Feb 1, 2014

Using exp4j which is a mathematical parser twice in one routine (or separated) in Eclipse and only the size2 is calculated when app is run in eclipse.

private void calculate size(){
String s1 = size.getText().toString();
String s2 = size2.getText().toString();
try {
Calculable result= new ExpressionBuilder(s1).build();
size1.setText(Double.toString(result.calculate())) ;

[Code] .....

View Replies View Related

Android - Looping Through Parse Data / Assigning To ArrayAdapter

Apr 24, 2015

I am looping through data in Android, using Parse data. I came up with this as a way to get user information; the larger goal is to create a model of data that I can use in an array adapter, so I can create a custom list view (as described here [URL] .... In the example, the data are hard-coded, not pulled from a database.

public static ArrayList<Midwifefirm> getUsers() {
//Parse data to get users
ParseQuery<ParseUser> query = ParseUser.getQuery();
query.orderByAscending(ParseConstants.KEY_PRACTICE_NAME);
query.findInBackground(new FindCallback<ParseUser>() {

[Code] ....

The intention is that for every user that does not have the type patient, collect this data about them, then store it in the arrayList.

On the return statement, though, there is an error: cannot return a value from a method with a void return type.

I may be over complicating this...read through various sources to get a model for this...in the end, I want to display a list of information about specific users, after the user makes a selection of a city...it would therefore display all the information about the medical practices in that city.

View Replies View Related

Android Audio Decoding For Morse Code And PSK31

Jan 6, 2014

I have some software I need to write. I am planning to write two apps for Android, one of which will send and receive Morse code, and the other to send and receive PSK31 data.

Programming is not my strong point, and I am currently struggling on how to do this. I have researched the software, and I am having a hard time finding out how to decode the audio streams on Android. I have also had difficulty finding examples and source code as what I have found is mostly written in C/C++, whereas I need examples in Java.

View Replies View Related

How To Create A Box To Hold Text Below Google Maps Within Android

Feb 19, 2014

At this point I know how to utilize Google Maps within Android but it always seems to take up the full window, there is an image below which shows what I'm attempting to accomplish (having a box below the Google maps where I can store text i.e. "Hello World"

How do I add box below Google Maps, so to store text i.e. "Hello World"

Code so far:

ActivityMain:

Java Code:

public class MainActivity extends Activity {
private GoogleMap googleMap;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

[Code] .....

Image:

View Replies View Related

Deploy Android Application That Connects To Java Server

Aug 25, 2014

I am trying to deploy an android application that connects to a java server. I am doing an apointments system, so the client asks for an apointments with a specific office/doctor. What i did, was to create a java server, using object for the offices, and via sockets it communicates with the android client.

The problem is that when i tried to use my (very demo still) app on my phone and sent it to some friends for testing, i coulnt find a way to have my server on the internet.

So I changed to (or trying to) servlet. But, how to do a client server application with servlets. All tutorials i have seen are more on website clients, but thats not what i need.

View Replies View Related

Solving / Roots Of Nonlinear System Of Equations - Java / Android

Oct 11, 2014

I am in search of a library that has been created in JAVA that can be utilized to solve for roots of a nonlinear system of equations. Each equation has 2 variables, x and y, and will need a library that uses higher calculus equations. No ones that just solve for x.

Most of the libraries that have been created to solve nonlinear equations are either in Fortran, C, or Python. There are a few libraries such minpack/scipy. The only libraries that I have been able to find or programming solutions that are in JAVA either require additional programs such as Matlab or are commercial products

I did find one library put together by a professor in Colorado State, but am unsure how to use it. There does not seem to be a way to enter your functions in the code.

Newton Raphson Method - Multivariable(x and y) Page Not Found

How to use this library or find a library that can be used in an android application would be amazing.

View Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved