[android-developers] Why Can't My Java Server And Android Client Send Any Messages?

2012-07-16 Thread Jeresam515
for an mmo  I am attempting to create, I have an android client connecting 
to a java server. The android is running on the emulator while the server 
is running straight on my computer. They can connect fine and acknowledge 
the connection but  unless I close either the client or the server the 
other can't recieve the former's message but they can if I do close one.

The server's WorkerThread's Run method:
[code]

public void run() {
try {
InputStream input  = clientSocket.getInputStream();
OutputStream output = clientSocket.getOutputStream();
String returns=;
String s=;
try{
s= inputStreamToString(input).toString();
}
catch(Exception e)
{}
   output.write((HTTP/1.1 200 OK\n\nWorkerRunnable:  +
   this.serverText +  -  +
   ).getBytes());
output.close();
input.close();
} catch (IOException e) {
//report exception somewhere.
e.printStackTrace();
}
}[/code]

The InputStream stringbulider:
[code]
private static StringBuilder inputStreamToString(InputStream is) {
String line = ;
StringBuilder total = new StringBuilder();

BufferedReader rd = new BufferedReader(new InputStreamReader(is));

try {
while ((line = rd.readLine()) != null) {
total.append(line);
}
} catch (Exception e) {
}

return total;}
[/code]

The client's connection method:

[code]  public String sendMessage(String message)
  {
try{ clientSocket = new Socket(10.0.2.2, 9000);

  String modifiedSentence;
  DataOutputStream outToServer = new 
DataOutputStream(clientSocket.getOutputStream());
  BufferedReader inFromServer = new BufferedReader(new 
InputStreamReader(clientSocket.getInputStream()));
  outToServer.writeBytes(message+\n);
  //Stops here
  modifiedSentence = inFromServer.readLine();
  outToServer.close();
  inFromServer.close();
  clientSocket.close();
  Log.v(modifiedSentence, modifiedSentence);
  return modifiedSentence;}
catch(Exception e)
{
return ;}
 
  }[/code]

Thanks, any help will be appreciated.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Re: How can I send an image from an sql database to an android client?

2012-05-22 Thread Jeresam515
It does seem to decode the string into bytes(ie: not null), but the image 
that is made from thos bytes by the bitmapfactory is null.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Re: How can I send an image from an sql database to an android client?

2012-05-22 Thread Jeresam515


 I don't know how I'd do that, but I have made sure the r used in the 
 decoding is correct by pasting the encoding of the image into there as r. 
 Using an online decoder I decoded it manually and it worked.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] How can I send an image from an sql database to an android client?

2012-05-21 Thread Jeresam515


I'm trying to send an image from an sql database to an android client. I'm 
doing this by way of a php middleman. The code stops working due to a null 
returning of the method below. My php code(works fine to encode image into 
base64(decoded the encoding and it worked)):

?php
//get image
function ob_base64_encode($c) {
$a=base64_encode($c);
$arr = array('base64' = $a);
  return json_encode($arr);
}
$image=resize(48,80,$image);
// And pass its name as a string
ob_start('ob_base64_encode');
imagepng($image);
ob_end_flush();
?

My android code:

public static Bitmap getIm(String IP, int height, int width)
{
ArrayListNameValuePair nameValuePairs = new ArrayListNameValuePair();
//Network queries and gets response(works)
String result = Network.getResponse(IP, nameValuePairs);
//manually decode string since for some reason JSON decode won't work(also 
works)
String r=result.split(:\)[1];
r=r.split(\)[0];
//decode string
byte[] decodedString = Base64.decode(r, Base64.DEFAULT);
Bitmap decodedByte = BitmapFactory.decodeByteArray(decodedString, 0, 
decodedString.length); 
return decodedByte;
//returns null
}


-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Re: Android to PHP error- Unidentified Index

2012-05-13 Thread Jeresam515


Thanks all, Matt I can not seem to get it to work under your code 
 either, same error. Thanks for correcting my mistake in the query Marcin. 
 I'm starting to think the error my be in my device and not the code itself. 
 Thanks, and if you habe more ideas please let me know.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Re: Android to PHP error- Unidentified Index

2012-05-13 Thread Jeresam515
Thanks all, I have gotten it to work.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Android to PHP error- Unidentified Index

2012-05-12 Thread Jeresam515


when sending data to a php server through android I cam across this error: 
Notice: Undefined index: IT in C:\xampp\htdocs\hello.php on line 4. After 
a few hours of messing around with it I can't solve my issue.

hello.php :

?php
mysql_connect(localhost,user,pass);
mysql_select_db(mmo);
$r=mysql_query(update players set X = '.$_REQUEST['IT'].' where 22=22);
if(!$r)
echo Error in query: .mysql_error();
mysql_close();
header('Refresh: 0.01; URL=http://localhost/hello.php');
?

update method in android:

public void UpdateSeverWithPlayer()
{ListNameValuePair nameValuePairs = new ArrayListNameValuePair();  
nameValuePairs.add(new BasicNameValuePair(IT,3));
try{
 HttpClient httpclient = new DefaultHttpClient();
 HttpPost httppost = new HttpPost(http://10.0.2.2/hello.php;);
 httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));

 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());
}}

I am working on the android emulator and do have the internet permission. 
As always help is greatly appreciated. EDIT 1: It appears the issue is in 
the android and not the php code.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Re: Android to PHP error- Unidentified Index

2012-05-12 Thread Jeresam515
POST does not seem to be making a difference, thanks though.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] How can I convert a double to a string without notation and with a high amount of accuracy in Java?

2012-02-27 Thread Jeresam515
I'm trying to convert a double to a string without notation, and tried
this:

f=
Double.valueOf(c.getString(c.getColumnIndex(NotesDbAdapter.KEY_VALUE)));
NumberFormat formatter = new DecimalFormat(###.##);
However, the value of 7^3^7 is returning as: 558546
opposed to 558545864083284007. As always help would be greatly
appreciated.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: Why doesn't this delete method work to vacuum the Database?

2012-02-21 Thread Jeresam515
bump

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] How should one make an SQL database correctly send/receive booleans. How should one make an SQL database correctly send/receive booleans. How should one make an SQL database corre

2012-02-20 Thread Jeresam515
I created a database with the following variables:

public static final String KEY_VALUE = x;
public static final String KEY_ISROOT = y;
public static final String KEY_ROWID = _id;
public static final String KEY_REALROWID = _ids;
public static final String KEY_ISPOWER = z;
public static final String KEY_POWERORROOTNUMBER = b;
public static final String KEY_ISDIVISOR = a;
public static final String KEY_ISMULTIPLIER = c;
public static final String KEY_ISADD = d;
public static final String KEY_ISSUBTRACT = e;
public static final String KEY_ISPS = f;
public static final String KEY_ISPE = g;
private static final String TAG = NotesDbAdapter;
private DatabaseHelper mDbHelper;
private SQLiteDatabase mDb;
private static final String DATABASE_NAME = data;
private static final String DATABASE_TABLE = notes;
private static final int DATABASE_VERSION =1;
private static final String DATABASE_CREATE =
   create table  +DATABASE_TABLE+  (
 +KEY_VALUE+  double,  
 +KEY_REALROWID+  integer,  
 +KEY_ROWID+  integer primary key autoincrement,  
+KEY_ISPOWER+  boolean,  
+KEY_ISDIVISOR+  boolean,  
+KEY_ISMULTIPLIER+  boolean,  
+KEY_ISADD+  boolean,  
+KEY_ISSUBTRACT+  boolean,  
+KEY_ISPS+  boolean,  
+KEY_ISPE+  boolean,  
+KEY_POWERORROOTNUMBER+  double,  
 +KEY_ISROOT+  boolean);;

The insert row ID code is:

public void createNote(double value, boolean isroot, boolean ispower,
boolean ismultiply, boolean isdivisor, boolean add,
boolean issubtract, double roototpowerval, boolean
paranthaseesend, boolean paranthaseesstart) {
ContentValues initialValues = new ContentValues();
initialValues.put(KEY_VALUE, value);
initialValues.put(KEY_ISROOT, isroot);
initialValues.put(KEY_ISPOWER, ispower);
initialValues.put(KEY_ISMULTIPLIER, ismultiply);
initialValues.put(KEY_ISDIVISOR, isdivisor);
initialValues.put(KEY_ISADD, add);
initialValues.put(KEY_ISSUBTRACT, issubtract);
initialValues.put(KEY_POWERORROOTNUMBER, roototpowerval);
initialValues.put(KEY_ISPE, paranthaseesend);
initialValues.put(KEY_ISPS, paranthaseesstart);
  long r= mDb.insert(DATABASE_TABLE, null, initialValues);
  int a = testCount();
  ContentValues argsa = new ContentValues();
  argsa.put(KEY_VALUE, value);
  argsa.put(KEY_ISROOT, isroot);
  argsa.put(KEY_ISPOWER, ispower);
  argsa.put(KEY_ISMULTIPLIER, ismultiply);
  argsa.put(KEY_ISDIVISOR, isdivisor);
  argsa.put(KEY_ISADD, add);
  argsa.put(KEY_ISSUBTRACT, issubtract);
  argsa.put(KEY_POWERORROOTNUMBER, roototpowerval);
  argsa.put(KEY_REALROWID, a);
  argsa.put(KEY_ISPE, paranthaseesend);
  argsa.put(KEY_ISPS, paranthaseesstart);
  mDb.update(DATABASE_TABLE, argsa, KEY_ROWID + = + r, null);
}

The fetchRow code is:

public Cursor fetchNote(long rowId) throws SQLException {

Cursor mCursor =

mDb.query(true, DATABASE_TABLE, new String[]
{KEY_ISPS,KEY_ISPE,KEY_VALUE,KEY_ISROOT,KEY_REALROWID,KEY_ISPOWER,KEY_POWERORROOTNUMBER,KEY_ISDIVISOR,KEY_ISMULTIPLIER,KEY_ISADD,KEY_ISSUBTRACT},
KEY_REALROWID + = + rowId, null,
null, null, null, null);
if (mCursor != null) {
mCursor.moveToFirst();
}
return mCursor;

}

It can change views here:
public void onClick(View v) {
double d = 3;
mDbHelper.deleteAllNotes();
mDbHelper.createNote(d, false, false, false, false, 
false,
false, 0, false, false);
mDbHelper.createNote(0, false, false, true,false, false,
false, 0, false, false);
Cursor c = mDbHelper.fetchNote(1);
if(d==Double.valueOf(c.getString(c.getColumnIndexOrThrow(NotesDbAdapter.KEY_VALUE
{setContentView(R.layout.works);}
}
However, It doesn't here:
public void onClick(View v) {
double d = 3;
mDbHelper.deleteAllNotes();
mDbHelper.createNote(d, false, false, false, false, 
false,
false, 0, false, false);
mDbHelper.createNote(0, false, false, true,false, false,
false, 0, false, false);
Cursor c = mDbHelper.fetchNote(2);
if(Boolean.parseBoolean(c.getString(c.getColumnIndexOrThrow(NotesDbAdapter.KEY_ISMULTIPLIER
{setContentView(R.layout.awesome);}
}

How should I make an SQL database correctly send/receive booleans?

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit 

[android-developers] How should one make an SQL database correctly send/receive booleans

2012-02-20 Thread Jeresam515
I created a database with the following variables:
public static final String KEY_VALUE = x;
public static final String KEY_ISROOT = y;
public static final String KEY_ROWID = _id;
public static final String KEY_REALROWID = _ids;
public static final String KEY_ISPOWER = z;
public static final String KEY_POWERORROOTNUMBER = b;
public static final String KEY_ISDIVISOR = a;
public static final String KEY_ISMULTIPLIER = c;
public static final String KEY_ISADD = d;
public static final String KEY_ISSUBTRACT = e;
public static final String KEY_ISPS = f;
public static final String KEY_ISPE = g;
private static final String TAG = NotesDbAdapter;
private DatabaseHelper mDbHelper;
private SQLiteDatabase mDb;
private static final String DATABASE_NAME = data;
private static final String DATABASE_TABLE = notes;
private static final int DATABASE_VERSION =1;
private static final String DATABASE_CREATE =
   create table  +DATABASE_TABLE+  (
 +KEY_VALUE+  double,  
 +KEY_REALROWID+  integer,  
 +KEY_ROWID+  integer primary key autoincrement,  
+KEY_ISPOWER+  boolean,  
+KEY_ISDIVISOR+  boolean,  
+KEY_ISMULTIPLIER+  boolean,  
+KEY_ISADD+  boolean,  
+KEY_ISSUBTRACT+  boolean,  
+KEY_ISPS+  boolean,  
+KEY_ISPE+  boolean,  
+KEY_POWERORROOTNUMBER+  double,  
 +KEY_ISROOT+  boolean);;
The insert row ID code is:
public void createNote(double value, boolean isroot, boolean ispower,
boolean ismultiply, boolean isdivisor, boolean add,
boolean issubtract, double roototpowerval, boolean
paranthaseesend, boolean paranthaseesstart) {
ContentValues initialValues = new ContentValues();
initialValues.put(KEY_VALUE, value);
initialValues.put(KEY_ISROOT, isroot);
initialValues.put(KEY_ISPOWER, ispower);
initialValues.put(KEY_ISMULTIPLIER, ismultiply);
initialValues.put(KEY_ISDIVISOR, isdivisor);
initialValues.put(KEY_ISADD, add);
initialValues.put(KEY_ISSUBTRACT, issubtract);
initialValues.put(KEY_POWERORROOTNUMBER, roototpowerval);
initialValues.put(KEY_ISPE, paranthaseesend);
initialValues.put(KEY_ISPS, paranthaseesstart);
  long r= mDb.insert(DATABASE_TABLE, null, initialValues);
  int a = testCount();
  ContentValues argsa = new ContentValues();
  argsa.put(KEY_VALUE, value);
  argsa.put(KEY_ISROOT, isroot);
  argsa.put(KEY_ISPOWER, ispower);
  argsa.put(KEY_ISMULTIPLIER, ismultiply);
  argsa.put(KEY_ISDIVISOR, isdivisor);
  argsa.put(KEY_ISADD, add);
  argsa.put(KEY_ISSUBTRACT, issubtract);
  argsa.put(KEY_POWERORROOTNUMBER, roototpowerval);
  argsa.put(KEY_REALROWID, a);
  argsa.put(KEY_ISPE, paranthaseesend);
  argsa.put(KEY_ISPS, paranthaseesstart);
  mDb.update(DATABASE_TABLE, argsa, KEY_ROWID + = + r, null);
}
The fetchRow code is:
public Cursor fetchNote(long rowId) throws SQLException {
Cursor mCursor =
mDb.query(true, DATABASE_TABLE, new String[]
{KEY_ISPS,KEY_ISPE,KEY_VALUE,KEY_ISROOT,KEY_REALROWID,KEY_ISPOWER,KEY_POWER
ORROOTNUMBER,KEY_ISDIVISOR,KEY_ISMULTIPLIER,KEY_ISADD,KEY_ISSUBTRACT},
KEY_REALROWID + = + rowId, null,
null, null, null, null);
if (mCursor != null) {
mCursor.moveToFirst();
}
return mCursor;
}
It can change views here:
public void onClick(View v) {
double d = 3;
mDbHelper.deleteAllNotes();
mDbHelper.createNote(d, false, false, false,
false, false,
false, 0, false, false);
mDbHelper.createNote(0, false, false,
true,false, false,
false, 0, false, false);
Cursor c = mDbHelper.fetchNote(1);
if(d==Double.valueOf(c.getString(c.getColumnIndexOrThrow(NotesDbAdapter.KEY
_VALUE
{setContentView(R.layout.works);}
}
However, It doesn't here:
public void onClick(View v) {
double d = 3;
mDbHelper.deleteAllNotes();
mDbHelper.createNote(d, false, false, false,
false, false,
false, 0, false, false);
mDbHelper.createNote(0, false, false,
true,false, false,
false, 0, false, false);
Cursor c = mDbHelper.fetchNote(2);
if(Boolean.parseBoolean(c.getString(c.getColumnIndexOrThrow(NotesDbAdapter.
KEY_ISMULTIPLIER
{setContentView(R.layout.awesome);}
}
How should I make an SQL database correctly send/receive booleans?

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group 

[android-developers] Re: How should one make an SQL database correctly send/receive booleans

2012-02-20 Thread Jeresam515
Thanks

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Why doesn't this delete method work to vacuum the Database?

2012-02-20 Thread Jeresam515
I have a datbase with the following method:
public void deleteNote(long rowId) {
mDb.delete(DATABASE_TABLE, KEY_REALROWID + = + rowId, null);
int x = (int) rowId;
int y = testCount();
while(xy)
{x++;
Cursor note= fetchNote(x);
ContentValues argsan = new ContentValues();
argsan.put(KEY_REALROWID, x-1);
long z
=Integer.valueOf(note.getString(note.getColumnIndexOrThrow(NotesDbAdapter.KEY_ROWID)));
mDb.update(DATABASE_TABLE, argsan, KEY_ROWID + = + z,
null);
}
}
The insert method is this:
  public void createNote(double value, String isroot, String ispower,
String ismultiply, String isdivisor, String add,
String issubtract, double roototpowerval, String
paranthaseesend, String paranthaseesstart) {
ContentValues initialValues = new ContentValues();
initialValues.put(KEY_VALUE, value);
initialValues.put(KEY_ISROOT, isroot);
initialValues.put(KEY_ISPOWER, ispower);
initialValues.put(KEY_ISMULTIPLIER, ismultiply);
initialValues.put(KEY_ISDIVISOR, isdivisor);
initialValues.put(KEY_ISADD, add);
initialValues.put(KEY_ISSUBTRACT, issubtract);
initialValues.put(KEY_POWERORROOTNUMBER, roototpowerval);
initialValues.put(KEY_REALROWID, testCount()+1);
initialValues.put(KEY_ISPE, paranthaseesend);
initialValues.put(KEY_ISPS, paranthaseesstart);
  mDb.insert(DATABASE_TABLE, null, initialValues);
}
The fetch method is this:
public Cursor fetchNote(long rowId) throws SQLException {

Cursor mCursor =

mDb.query(true, DATABASE_TABLE, new String[]
{KEY_ISPS,KEY_ISPE,KEY_VALUE,
 
KEY_ISROOT,KEY_REALROWID,KEY_ISPOWER,KEY_POWERORROOTNUMBER,KEY_ISDIVISOR
,KEY_ISMULTIPLIER,KEY_ISADD,KEY_ISSUBTRACT},
KEY_REALROWID + = + rowId, null,
null, null, null, null);
if (mCursor != null) {
mCursor.moveToFirst();
}
return mCursor;

}
When I run this I get an error:
mDbHelper.createNote(d, false, false, false, false,
false, false, 0, false, false);
   mDbHelper.createNote(0, false, false, 
false,false,
false, true, 0, false, false);
  mDbHelper.createNote(d, false, false, false,false,
false, false, 0, false, false);
 mDbHelper.createNote(d, false, false, false,false,
false, false, 0, false, false);
mDbHelper.deleteNote(3);
   Cursor c = mDbHelper.fetchNote(3);

Help would be greatly appreciated.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: Shy are things not sending/recieving correctly from this database?

2012-02-19 Thread Jeresam515
Thanks for the constructive criticism, I have deleted my posts, and
will try to whittle the problem down my code and repost when I  have
that.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Why can't this database make rows?

2012-02-19 Thread Jeresam515
This database has been unable to make any rows as illustrated by the
fact that testcount always = 0.

Here is my variable initialization:
public static final String KEY_VALUE = x;
public static final String KEY_ISROOT = y;
public static final String KEY_ROWID = _id;
public static final String KEY_REALROWID = _ids;
public static final String KEY_ISPOWER = z;
public static final String KEY_POWERORROOTNUMBER = b;
public static final String KEY_ISDIVISOR = a;
public static final String KEY_ISMULTIPLIER = c;
public static final String KEY_ISADD = d;
public static final String KEY_ISSUBTRACT = e;
public static final String KEY_ISPS = f;
public static final String KEY_ISPE = g;
private static final String TAG = NotesDbAdapter;
private DatabaseHelper mDbHelper;
private SQLiteDatabase mDb;
private static final String DATABASE_NAME = data;
private static final String DATABASE_TABLE = notes;
private static final int DATABASE_VERSION =20;
private static final String DATABASE_CREATE =
   create table  +DATABASE_TABLE+  (
 +KEY_VALUE+  double,  
 +KEY_REALROWID+  integer,  
 +KEY_ROWID+  integer primary key autoincrement,  
+KEY_ISPOWER+  boolean,  
+KEY_ISDIVISOR+  boolean,  
+KEY_ISMULTIPLIER+  boolean,  
+KEY_ISADD+  boolean,  
+KEY_ISSUBTRACT+  boolean,  
+KEY_ISPS+  boolean,  
+KEY_ISPE+  boolean,  
+KEY_POWERORROOTNUMBER+  double,  
 +KEY_ISROOT+  boolean);;

Here is the create row:
 public void createNote(double value, boolean isroot, boolean ispower,
boolean ismultiply, boolean isdivisor, boolean add,
boolean issubtract, double roototpowerval, boolean
paranthaseesend, boolean paranthaseesstart) {
ContentValues initialValues = new ContentValues();
initialValues.put(KEY_VALUE, value);
initialValues.put(KEY_ISROOT, isroot);
initialValues.put(KEY_ISPOWER, ispower);
initialValues.put(KEY_ISMULTIPLIER, ismultiply);
initialValues.put(KEY_ISDIVISOR, isdivisor);
initialValues.put(KEY_ISADD, add);
initialValues.put(KEY_ISSUBTRACT, issubtract);
initialValues.put(KEY_POWERORROOTNUMBER, roototpowerval);
initialValues.put(KEY_ISPE, paranthaseesend);
initialValues.put(KEY_ISPS, paranthaseesstart);
  long r= mDb.insert(DATABASE_TABLE, null, initialValues);
  int a = testCount();
  ContentValues argsa = new ContentValues();
  argsa.put(KEY_VALUE, value);
  argsa.put(KEY_ISROOT, isroot);
  argsa.put(KEY_ISPOWER, ispower);
  argsa.put(KEY_ISMULTIPLIER, ismultiply);
  argsa.put(KEY_ISDIVISOR, isdivisor);
  argsa.put(KEY_ISADD, add);
  argsa.put(KEY_ISSUBTRACT, issubtract);
  argsa.put(KEY_POWERORROOTNUMBER, roototpowerval);
  argsa.put(KEY_REALROWID, a);
  argsa.put(KEY_ISPE, paranthaseesend);
  argsa.put(KEY_ISPS, paranthaseesstart);
  mDb.update(DATABASE_TABLE, argsa, KEY_ROWID + = + r, null);
}

Finally, here is testCount():
public int testCount() {
 Cursor c = mDb.rawQuery(select count(*) from notes, null);
 int tst = 0;
 if (c.moveToNext()) {
 tst = c.getInt(c.getColumnIndex(count(*)));
 }
 return tst;
}

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Why can't this database make rows?

2012-02-19 Thread Jeresam515
This database has been unable to make any rows as illustrated by the
fact that testcount always = 0.

Here is my variable initialization:
public static final String KEY_VALUE = x;
public static final String KEY_ISROOT = y;
public static final String KEY_ROWID = _id;
public static final String KEY_REALROWID = _ids;
public static final String KEY_ISPOWER = z;
public static final String KEY_POWERORROOTNUMBER = b;
public static final String KEY_ISDIVISOR = a;
public static final String KEY_ISMULTIPLIER = c;
public static final String KEY_ISADD = d;
public static final String KEY_ISSUBTRACT = e;
public static final String KEY_ISPS = f;
public static final String KEY_ISPE = g;
private static final String TAG = NotesDbAdapter;
private DatabaseHelper mDbHelper;
private SQLiteDatabase mDb;
private static final String DATABASE_NAME = data;
private static final String DATABASE_TABLE = notes;
private static final int DATABASE_VERSION =20;
private static final String DATABASE_CREATE =
   create table  +DATABASE_TABLE+  (
 +KEY_VALUE+  double,  
 +KEY_REALROWID+  integer,  
 +KEY_ROWID+  integer primary key autoincrement,  
+KEY_ISPOWER+  boolean,  
+KEY_ISDIVISOR+  boolean,  
+KEY_ISMULTIPLIER+  boolean,  
+KEY_ISADD+  boolean,  
+KEY_ISSUBTRACT+  boolean,  
+KEY_ISPS+  boolean,  
+KEY_ISPE+  boolean,  
+KEY_POWERORROOTNUMBER+  double,  
 +KEY_ISROOT+  boolean);;

Here is the create row:
 public void createNote(double value, boolean isroot, boolean ispower,
boolean ismultiply, boolean isdivisor, boolean add,
boolean issubtract, double roototpowerval, boolean
paranthaseesend, boolean paranthaseesstart) {
ContentValues initialValues = new ContentValues();
initialValues.put(KEY_VALUE, value);
initialValues.put(KEY_ISROOT, isroot);
initialValues.put(KEY_ISPOWER, ispower);
initialValues.put(KEY_ISMULTIPLIER, ismultiply);
initialValues.put(KEY_ISDIVISOR, isdivisor);
initialValues.put(KEY_ISADD, add);
initialValues.put(KEY_ISSUBTRACT, issubtract);
initialValues.put(KEY_POWERORROOTNUMBER, roototpowerval);
initialValues.put(KEY_ISPE, paranthaseesend);
initialValues.put(KEY_ISPS, paranthaseesstart);
  long r= mDb.insert(DATABASE_TABLE, null, initialValues);
  int a = testCount();
  ContentValues argsa = new ContentValues();
  argsa.put(KEY_VALUE, value);
  argsa.put(KEY_ISROOT, isroot);
  argsa.put(KEY_ISPOWER, ispower);
  argsa.put(KEY_ISMULTIPLIER, ismultiply);
  argsa.put(KEY_ISDIVISOR, isdivisor);
  argsa.put(KEY_ISADD, add);
  argsa.put(KEY_ISSUBTRACT, issubtract);
  argsa.put(KEY_POWERORROOTNUMBER, roototpowerval);
  argsa.put(KEY_REALROWID, a);
  argsa.put(KEY_ISPE, paranthaseesend);
  argsa.put(KEY_ISPS, paranthaseesstart);
  mDb.update(DATABASE_TABLE, argsa, KEY_ROWID + = + r, null);
}

Finally, here is testCount():
public int testCount() {
 Cursor c = mDb.rawQuery(select count(*) from notes, null);
 int tst = 0;
 if (c.moveToNext()) {
 tst = c.getInt(c.getColumnIndex(count(*)));
 }
 return tst;
}

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: Method oddly not working, help needed.

2012-02-18 Thread Jeresam515
Bump

On Feb 17, 9:09 pm, Jeresam515 jeremyschiff...@gmail.com wrote:
 Here is my method for part of a calculator app, could someone take a
 look and see why it isnt working?(PS is parenthases start while PE is
 end)
 Boolean solve2( int min, int max){
                 int x = min-1;
                 while(xmax)
                 {
                         x++;
                         Cursor note = mDbHelper.fetchNote(x);

 if(Boolean.parseBoolean(note.getString(note.getColumnIndexOrThrow(NotesDbAd 
 apter.KEY_ISPS
                         {
                         int y = x;
                         boolean z = false;
                         while(ymax  z==false){
                                 y++;
                         Cursor note1 = mDbHelper.fetchNote(y);

 if(Boolean.parseBoolean(note1.getString(note.getColumnIndexOrThrow(NotesDbA 
 dapter.KEY_ISPE
                         {z = true;}
                         }
                         solve1(x,y);
                 max-=(y-x);
                 }}
                 int xa = min-1;
                 while(xamax)
                 {
                         xa++;
                         Cursor note2 = mDbHelper.fetchNote(xa);

 if(Boolean.parseBoolean(note2.getString(note2.getColumnIndexOrThrow(NotesDb 
 Adapter.KEY_ISPOWER
                         {
                         int ya = xa+1;
                         int za = xa-1;
                         Cursor note3 = mDbHelper.fetchNote(ya);
                         Cursor note4 = mDbHelper.fetchNote(za);

          double n =
 Double.valueOf(note3.getString(note3.getColumnIndexOrThrow(NotesDbAdapter.K 
 EY_VALUE)));
          double m =
 Double.valueOf(note4.getString(note4.getColumnIndexOrThrow(NotesDbAdapter.K 
 EY_VALUE)));
         double g = Math.pow(n,m);
         double da = g;
         mDbHelper.updateNote(da, false, false, false, false, false, false, 0,
 za, false, false);
         mDbHelper.deleteNote(xa);
         mDbHelper.deleteNote(xa);
         max -=2;
                         }

 if(Boolean.parseBoolean(note2.getString(note2.getColumnIndexOrThrow(NotesDb 
 Adapter.KEY_ISROOT
                         {
                         int aya = xa+1;
                         int aza = xa-1;
                         Cursor anote3 = mDbHelper.fetchNote(aya);
                         Cursor anote4 = mDbHelper.fetchNote(aza);
          double an =
 Double.valueOf(anote3.getString(anote3.getColumnIndexOrThrow(NotesDbAdapter 
 .KEY_VALUE)));
          double am =
 Double.valueOf(anote4.getString(anote4.getColumnIndexOrThrow(NotesDbAdapter 
 .KEY_VALUE)));
         double ag = Math.pow(an,1/am);
         double ada = ag;
         mDbHelper.updateNote(ada, false, false, false, false, false, false,
 0, aza, false, false);
         mDbHelper.deleteNote(xa);
         mDbHelper.deleteNote(xa);
         max -=2;
                         }
                 }
                 int xb = min-1;
                 while(xbmax)
                 {
                         xb++;
                         Cursor note2 = mDbHelper.fetchNote(xb);

 if(Boolean.parseBoolean(note2.getString(note2.getColumnIndexOrThrow(NotesDb 
 Adapter.KEY_ISMULTIPLIER
                         {
                         int yb = xb+1;
                         int zb = xb-1;
                         Cursor note3 = mDbHelper.fetchNote(yb);
                         Cursor note4 = mDbHelper.fetchNote(zb);

          double n =
 Double.valueOf(note3.getString(note3.getColumnIndexOrThrow(NotesDbAdapter.K 
 EY_VALUE)));
          double m =
 Double.valueOf(note4.getString(note4.getColumnIndexOrThrow(NotesDbAdapter.K 
 EY_VALUE)));
         double g = n*m;
         double db = g;
         mDbHelper.updateNote(db, false, false, false, false, false, false, 0,
 zb, false, false);
         mDbHelper.deleteNote(xb);
         mDbHelper.deleteNote(xb);
         max -=2;
                         }

 if(Boolean.parseBoolean(note2.getString(note2.getColumnIndexOrThrow(NotesDb 
 Adapter.KEY_ISDIVISOR
                         {
                         int ya = xb+1;
                         int za = xb-1;
                         Cursor note3 = mDbHelper.fetchNote(ya);
                         Cursor note4 = mDbHelper.fetchNote(za);
          double n =
 Double.valueOf(note3.getString(note3.getColumnIndexOrThrow(NotesDbAdapter.K 
 EY_VALUE)));
          double m =
 Double.valueOf(note4.getString(note4.getColumnIndexOrThrow(NotesDbAdapter.K 
 EY_VALUE)));
         double g = n/m;
         double da = g;
         mDbHelper.updateNote(da, false, false, false, false, false, false, 0,
 za, false, false);
         mDbHelper.deleteNote(xb);
         mDbHelper.deleteNote(xb);
         max -=2;
                         }
                 }
                 int xc = min-1;
                 while(xcmax)
                 {
                         xc++;
                         Cursor note2 = mDbHelper.fetchNote(xc

[android-developers] Shy are things not sending/recieving correctly from this database?

2012-02-18 Thread Jeresam515
None of the notes are created and as such I can't do anything with
them, help would be appreciated. TestCount always returns 0.

package com.real;


import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;

public class NotesDbAdapter {

public static final String KEY_VALUE = x;
public static final String KEY_ISROOT = y;
public static final String KEY_ROWID = _id;
public static final String KEY_REALROWID = _ids;
public static final String KEY_ISPOWER = z;
public static final String KEY_POWERORROOTNUMBER = b;
public static final String KEY_ISDIVISOR = a;
public static final String KEY_ISMULTIPLIER = c;
public static final String KEY_ISADD = d;
public static final String KEY_ISSUBTRACT = e;
public static final String KEY_ISPS = f;
public static final String KEY_ISPE = g;
private static final String TAG = NotesDbAdapter;
private DatabaseHelper mDbHelper;
private SQLiteDatabase mDb;
private static final String DATABASE_NAME = data;
private static final String DATABASE_TABLE = notes;
private static final int DATABASE_VERSION =20;
private static final String DATABASE_CREATE =
   create table  +DATABASE_TABLE+  (
 +KEY_VALUE+  double,  
 +KEY_REALROWID+  integer,  
 +KEY_ROWID+  integer primary key autoincrement,  
+KEY_ISPOWER+  boolean,  
+KEY_ISDIVISOR+  boolean,  
+KEY_ISMULTIPLIER+  boolean,  
+KEY_ISADD+  boolean,  
+KEY_ISSUBTRACT+  boolean,  
+KEY_ISPS+  boolean,  
+KEY_ISPE+  boolean,  
+KEY_POWERORROOTNUMBER+  double,  
 +KEY_ISROOT+  boolean);;
private final Context mCtx;

private static class DatabaseHelper extends SQLiteOpenHelper {

DatabaseHelper(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
}


@Override
public void onCreate(SQLiteDatabase db) {
try {
db.execSQL(DATABASE_CREATE);
} catch (Exception e) {
Log.e(dbAdapter, e.getMessage().toString());
}
}

@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int
newVersion) {
Log.w(TAG, Upgrading database from version  + oldVersion
+  to 
+ newVersion + , which will destroy all old
data);
db.execSQL(DROP TABLE IF EXISTS notes);
onCreate(db);
}

}

public NotesDbAdapter(Context ctx) {
this.mCtx = ctx;
}

public NotesDbAdapter open() throws SQLException {
mDbHelper = new DatabaseHelper(mCtx);
mDb = mDbHelper.getWritableDatabase();
return this;
}

public void close() {
mDbHelper.close();
}


public void createNote(double value, boolean isroot, boolean
ispower, boolean ismultiply, boolean isdivisor, boolean add,
boolean issubtract, double roototpowerval, boolean
paranthaseesend, boolean paranthaseesstart) {
ContentValues initialValues = new ContentValues();
initialValues.put(KEY_VALUE, value);
initialValues.put(KEY_ISROOT, isroot);
initialValues.put(KEY_ISPOWER, ispower);
initialValues.put(KEY_ISMULTIPLIER, ismultiply);
initialValues.put(KEY_ISDIVISOR, isdivisor);
initialValues.put(KEY_ISADD, add);
initialValues.put(KEY_ISSUBTRACT, issubtract);
initialValues.put(KEY_POWERORROOTNUMBER, roototpowerval);
initialValues.put(KEY_ISPE, paranthaseesend);
initialValues.put(KEY_ISPS, paranthaseesstart);
  long r= mDb.insert(DATABASE_TABLE, null, initialValues);
  int a = testCount();
  ContentValues argsa = new ContentValues();
  argsa.put(KEY_VALUE, value);
  argsa.put(KEY_ISROOT, isroot);
  argsa.put(KEY_ISPOWER, ispower);
  argsa.put(KEY_ISMULTIPLIER, ismultiply);
  argsa.put(KEY_ISDIVISOR, isdivisor);
  argsa.put(KEY_ISADD, add);
  argsa.put(KEY_ISSUBTRACT, issubtract);
  argsa.put(KEY_POWERORROOTNUMBER, roototpowerval);
  argsa.put(KEY_REALROWID, a);
  argsa.put(KEY_ISPE, paranthaseesend);
  argsa.put(KEY_ISPS, paranthaseesstart);
  mDb.update(DATABASE_TABLE, argsa, KEY_ROWID + = + r, null);
}

public void deleteNote(long rowId) {
mDb.delete(DATABASE_TABLE, KEY_REALROWID + = + rowId, null);
int x = (int) rowId;
int y = testCount();
while(xy)
{x++;
Cursor note= fetchNote(x);
ContentValues argsan = new ContentValues();
argsan.put(KEY_VALUE,
note.getString(note.getColumnIndexOrThrow(NotesDbAdapter.KEY_VALUE)));
argsan.put(KEY_ISROOT,

[android-developers] Re: Shy are things not sending/recieving correctly from this database?

2012-02-18 Thread Jeresam515
bump

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Method oddly not working, help needed.

2012-02-17 Thread Jeresam515
Here is my method for part of a calculator app, could someone take a
look and see why it isnt working?(PS is parenthases start while PE is
end)
Boolean solve2( int min, int max){
int x = min-1;
while(xmax)
{
x++;
Cursor note = mDbHelper.fetchNote(x);

if(Boolean.parseBoolean(note.getString(note.getColumnIndexOrThrow(NotesDbAdapter.KEY_ISPS
{
int y = x;
boolean z = false;
while(ymax  z==false){
y++;
Cursor note1 = mDbHelper.fetchNote(y);

if(Boolean.parseBoolean(note1.getString(note.getColumnIndexOrThrow(NotesDbAdapter.KEY_ISPE
{z = true;}
}
solve1(x,y);
max-=(y-x);
}}
int xa = min-1;
while(xamax)
{
xa++;
Cursor note2 = mDbHelper.fetchNote(xa);

if(Boolean.parseBoolean(note2.getString(note2.getColumnIndexOrThrow(NotesDbAdapter.KEY_ISPOWER
{
int ya = xa+1;
int za = xa-1;
Cursor note3 = mDbHelper.fetchNote(ya);
Cursor note4 = mDbHelper.fetchNote(za);

 double n =
Double.valueOf(note3.getString(note3.getColumnIndexOrThrow(NotesDbAdapter.KEY_VALUE)));
 double m =
Double.valueOf(note4.getString(note4.getColumnIndexOrThrow(NotesDbAdapter.KEY_VALUE)));
double g = Math.pow(n,m);
double da = g;
mDbHelper.updateNote(da, false, false, false, false, false, false, 0,
za, false, false);
mDbHelper.deleteNote(xa);
mDbHelper.deleteNote(xa);
max -=2;
}

if(Boolean.parseBoolean(note2.getString(note2.getColumnIndexOrThrow(NotesDbAdapter.KEY_ISROOT
{
int aya = xa+1;
int aza = xa-1;
Cursor anote3 = mDbHelper.fetchNote(aya);
Cursor anote4 = mDbHelper.fetchNote(aza);
 double an =
Double.valueOf(anote3.getString(anote3.getColumnIndexOrThrow(NotesDbAdapter.KEY_VALUE)));
 double am =
Double.valueOf(anote4.getString(anote4.getColumnIndexOrThrow(NotesDbAdapter.KEY_VALUE)));
double ag = Math.pow(an,1/am);
double ada = ag;
mDbHelper.updateNote(ada, false, false, false, false, false, false,
0, aza, false, false);
mDbHelper.deleteNote(xa);
mDbHelper.deleteNote(xa);
max -=2;
}
}
int xb = min-1;
while(xbmax)
{
xb++;
Cursor note2 = mDbHelper.fetchNote(xb);

if(Boolean.parseBoolean(note2.getString(note2.getColumnIndexOrThrow(NotesDbAdapter.KEY_ISMULTIPLIER
{
int yb = xb+1;
int zb = xb-1;
Cursor note3 = mDbHelper.fetchNote(yb);
Cursor note4 = mDbHelper.fetchNote(zb);

 double n =
Double.valueOf(note3.getString(note3.getColumnIndexOrThrow(NotesDbAdapter.KEY_VALUE)));
 double m =
Double.valueOf(note4.getString(note4.getColumnIndexOrThrow(NotesDbAdapter.KEY_VALUE)));
double g = n*m;
double db = g;
mDbHelper.updateNote(db, false, false, false, false, false, false, 0,
zb, false, false);
mDbHelper.deleteNote(xb);
mDbHelper.deleteNote(xb);
max -=2;
}

if(Boolean.parseBoolean(note2.getString(note2.getColumnIndexOrThrow(NotesDbAdapter.KEY_ISDIVISOR
{
int ya = xb+1;
int za = xb-1;
Cursor note3 = mDbHelper.fetchNote(ya);
Cursor note4 = mDbHelper.fetchNote(za);
 double n =
Double.valueOf(note3.getString(note3.getColumnIndexOrThrow(NotesDbAdapter.KEY_VALUE)));
 double m =
Double.valueOf(note4.getString(note4.getColumnIndexOrThrow(NotesDbAdapter.KEY_VALUE)));
double g = n/m;
double da = g;
mDbHelper.updateNote(da, false, false, false, false, false, false, 0,
za, false, false);
mDbHelper.deleteNote(xb);
mDbHelper.deleteNote(xb);
max -=2;
}
}
int xc = min-1;
while(xcmax)
{
xc++;
Cursor note2 = mDbHelper.fetchNote(xc);

if(Boolean.parseBoolean(note2.getString(note2.getColumnIndexOrThrow(NotesDbAdapter.KEY_ISADD
{
int yb = xc+1;
int 

[android-developers] How should one delete all of the table(but not the table itself without making the thread using that database give an error

2011-12-30 Thread Jeresam515
So I'm trying to have a menu button to clear my database when it is
pressed, that works fine. However, as soon as new information is sent
to the database the app force closes. How should i stop this? Here is
the clear part:

@Override public boolean onMenuItemSelected(int featureId, MenuItem
item) { switch(item.getItemId()) { case INSERT_ID: //reset just makes
all the variables in the thred reinitialize at base values
mLemonadeMainMenuView.reset(); NotesMade = 0;
mDbHelper.deleteAllNotes(); return true; }

Here is deleteallnotes(): public boolean deleteAllNotes() { return
mDb.delete(DATABASE_TABLE,1, null)  0; }

Here is the new data information:

@Override public boolean onTouchEvent(MotionEvent event)
{ mDbHelper.createNote(event.getX(), event.getY(), 1); NotesMade ++;
mLemonadeMainMenuView.setCoords(NotesMade); return true; }

Finally, here is the recieving end:

while(mNotesMademNoteId) {mNoteId++; Cursor note =
mDbHelper.fetchNote(mNoteId); Float x; Float y; Float size; x =
Float.valueOf(note.getString(note.getColumnIndexOrThrow(NotesDb
Adapter.KEY_X))); y=
Float.valueOf(note.getString(note.getColumnIndexOrThrow(NotesDb
Adapter.KEY_Y))); size
=Float.valueOf(note.getString(note.getColumnIndexOrThrow(NotesD
bAdapter.KEY_X))); canvas.drawCircle(x, y, 1, paint);} }

note: I have already tried starting and stopping the thred in addition
to the above

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: How should one delete all of the table(but not the table itself without making the thread using that database give an error

2011-12-30 Thread Jeresam515
The solution I found is to change deleteallnotes() to: public void
deleteAllNotes() { mDb.execSQL(DROP TABLE IF EXISTS
notes);mDb.execSQL(DATABASE_CREATE); }

On Dec 30, 8:44 am, Jeresam515 jeremyschiff...@gmail.com wrote:
 So I'm trying to have a menu button to clear my database when it is
 pressed, that works fine. However, as soon as new information is sent
 to the database the app force closes. How should i stop this? Here is
 the clear part:

 @Override public boolean onMenuItemSelected(int featureId, MenuItem
 item) { switch(item.getItemId()) { case INSERT_ID: //reset just makes
 all the variables in the thred reinitialize at base values
 mLemonadeMainMenuView.reset(); NotesMade = 0;
 mDbHelper.deleteAllNotes(); return true; }

 Here is deleteallnotes(): public boolean deleteAllNotes() { return
 mDb.delete(DATABASE_TABLE,1, null)  0; }

 Here is the new data information:

 @Override public boolean onTouchEvent(MotionEvent event)
 { mDbHelper.createNote(event.getX(), event.getY(), 1); NotesMade ++;
 mLemonadeMainMenuView.setCoords(NotesMade); return true; }

 Finally, here is the recieving end:

 while(mNotesMademNoteId) {mNoteId++; Cursor note =
 mDbHelper.fetchNote(mNoteId); Float x; Float y; Float size; x =
 Float.valueOf(note.getString(note.getColumnIndexOrThrow(NotesDb
 Adapter.KEY_X))); y=
 Float.valueOf(note.getString(note.getColumnIndexOrThrow(NotesDb
 Adapter.KEY_Y))); size
 =Float.valueOf(note.getString(note.getColumnIndexOrThrow(NotesD
 bAdapter.KEY_X))); canvas.drawCircle(x, y, 1, paint);} }

 note: I have already tried starting and stopping the thred in addition
 to the above

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Is my OnTouchEvent() not working correctly?

2011-12-30 Thread Jeresam515
So I'm making a simple painting app for the Android SDK. However, the
onTouchEvent() is only getting some of the events not all of them(if I
drag my finger across the screen it gets roughly half of the
events(points)) Here is my OnTouchEvent():

@Override
public boolean onTouchEvent(MotionEvent event) {
mDbHelper.createNote(event.getX(), event.getY(), 11);
NotesMade ++;
mLemonadeMainMenuView.setCoords(NotesMade);
return true;
}


private void doDraw(Canvas canvas) {
  canvas.drawColor(Color.TRANSPARENT);
Paint paint = new Paint();
paint.setColor(Color.BLUE);
paint.setStyle(Style.FILL);
int mNoteId = 0;
 while(mNotesMademNoteId)
{mNoteId++;
 Cursor note = mDbHelper.fetchNote(mNoteId);
 Float x;
 Float y;
 Float size;
 x =
Float.valueOf(note.getString(note.getColumnIndexOrThrow(NotesDbAdapter.KEY_X)));
 y=
Float.valueOf(note.getString(note.getColumnIndexOrThrow(NotesDbAdapter.KEY_Y)));
 size =
Float.valueOf(note.getString(note.getColumnIndexOrThrow(NotesDbAdapter.KEY_Size)));
  canvas.drawCircle(x, y, size, paint);}
}}

Drawing portion above. Logcat also reveals nothing. Help would be
greatly appreciated. How can I fix my OnTouchEvent()?

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: Why is my program not correctly writing to my database?

2011-12-29 Thread Jeresam515
Thanks so much

On Dec 29, 11:43 am, James Black planiturth...@gmail.com wrote:
 Change your database version to recreate the table.
 On Dec 29, 2011 1:14 PM, Jeresam515 jeremyschiff...@gmail.com wrote:







  Thanks, I fixed that still have the same error though, here's my new
  code.
  package com.drawing;

  import android.content.ContentValues;
  import android.content.Context;
  import android.database.Cursor;
  import android.database.SQLException;
  import android.database.sqlite.SQLiteDatabase;
  import android.database.sqlite.SQLiteOpenHelper;
  import android.util.Log;

  public class NotesDbAdapter {

     public static final String KEY_ROWID = _id;
     public static final String KEY_X = x;
     public static final String KEY_Y = y;
     public static final String KEY_Size = size;
     private static final String TAG = NotesDbAdapter;
     private DatabaseHelper mDbHelper;
     private SQLiteDatabase mDb;
     private static final String DATABASE_NAME = data;
     private static final String DATABASE_TABLE = notes;
     private static final int DATABASE_VERSION = 2;
     private static final String DATABASE_CREATE =
                create table  +DATABASE_TABLE+  (
              +KEY_ROWID+  integer primary key autoincrement,  
              +KEY_X+  integer, 
              +KEY_Y+  integer, 
              +KEY_Size+  integer);;
     private final Context mCtx;

     private static class DatabaseHelper extends SQLiteOpenHelper {

         DatabaseHelper(Context context) {
             super(context, DATABASE_NAME, null, DATABASE_VERSION);
         }

                 @Override
                 public void onCreate(SQLiteDatabase db) {
                     try {
                         db.execSQL(DATABASE_CREATE);
                     } catch (Exception e) {
                         Log.e(dbAdapter, e.getMessage().toString());
                     }
                 }

         @Override
         public void onUpgrade(SQLiteDatabase db, int oldVersion, int
  newVersion) {
             Log.w(TAG, Upgrading database from version  + oldVersion
  +  to 
                     + newVersion + , which will destroy all old
  data);
             db.execSQL(DROP TABLE IF EXISTS notes);
             onCreate(db);
         }

     }

     public NotesDbAdapter(Context ctx) {
         this.mCtx = ctx;
     }

     public NotesDbAdapter open() throws SQLException {
         mDbHelper = new DatabaseHelper(mCtx);
         mDb = mDbHelper.getWritableDatabase();
         return this;
     }

     public void close() {
         mDbHelper.close();
     }

     public long createNote(float f, float g, int size) {
         ContentValues initialValues = new ContentValues();
         initialValues.put(KEY_X, f);
         initialValues.put(KEY_Y, g);
         initialValues.put(KEY_Size, size);
         return mDb.insert(DATABASE_TABLE, null, initialValues);
     }

     public boolean deleteNote(long rowId) {

         return mDb.delete(DATABASE_TABLE, KEY_ROWID + = + rowId,
  null)  0;
     }

     public Cursor fetchAllNotes() {

         return mDb.query(DATABASE_TABLE, new String[] {KEY_ROWID,
  KEY_X,KEY_Y,KEY_Size}, null, null, null, null, null);
     }

     public Cursor fetchNote(long rowId) throws SQLException {

         Cursor mCursor =

             mDb.query(true, DATABASE_TABLE, new String[] {KEY_ROWID,
  KEY_X,KEY_Y,KEY_Size}, KEY_ROWID + = + rowId, null,
                     null, null, null, null);
         if (mCursor != null) {
             mCursor.moveToFirst();
         }
         return mCursor;

     }

     public boolean updateNote(long rowId, int x, int y, int size) {
         ContentValues args = new ContentValues();
         args.put(KEY_X, x);
         args.put(KEY_Y, y);
         args.put(KEY_Size, size);
         return mDb.update(DATABASE_TABLE, args, KEY_ROWID + = +
  rowId, null)  0;
     }
  }

  On Dec 28, 2:57 pm, Kostya Vasilyev kmans...@gmail.com wrote:
   Are all these supposed to be mapped to the same column, _id, or is
  this a
   copy /  paste artifact?

      public static final String KEY_ROWID = _id;
      public static final String KEY_X = _id;
      public static final String KEY_Y = _id;
      public static final String KEY_Size = _id;

   29 декабря 2011 г. 1:50 пользователь Jeresam515
   jeremyschiff...@gmail.comнаписал:

I did the notepad tutorials, and am using a modified version of that
for my database. I don't understand why my program isn't correctly
writing to it. Help would be greatly appreciated.

package com.drawing;

import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;

public class NotesDbAdapter {

   public static final String KEY_ROWID = _id;
   public static final String KEY_X = _id

[android-developers] Re: Why is my program not correctly writing to my database?

2011-12-29 Thread Jeresam515
Thanks, I fixed that still have the same error though, here's my new
code.
package com.drawing;

import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;

public class NotesDbAdapter {

public static final String KEY_ROWID = _id;
public static final String KEY_X = x;
public static final String KEY_Y = y;
public static final String KEY_Size = size;
private static final String TAG = NotesDbAdapter;
private DatabaseHelper mDbHelper;
private SQLiteDatabase mDb;
private static final String DATABASE_NAME = data;
private static final String DATABASE_TABLE = notes;
private static final int DATABASE_VERSION = 2;
private static final String DATABASE_CREATE =
   create table  +DATABASE_TABLE+  (
 +KEY_ROWID+  integer primary key autoincrement,  
 +KEY_X+  integer, 
 +KEY_Y+  integer, 
 +KEY_Size+  integer);;
private final Context mCtx;

private static class DatabaseHelper extends SQLiteOpenHelper {

DatabaseHelper(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
}


@Override
public void onCreate(SQLiteDatabase db) {
try {
db.execSQL(DATABASE_CREATE);
} catch (Exception e) {
Log.e(dbAdapter, e.getMessage().toString());
}
}

@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int
newVersion) {
Log.w(TAG, Upgrading database from version  + oldVersion
+  to 
+ newVersion + , which will destroy all old
data);
db.execSQL(DROP TABLE IF EXISTS notes);
onCreate(db);
}

}

public NotesDbAdapter(Context ctx) {
this.mCtx = ctx;
}

public NotesDbAdapter open() throws SQLException {
mDbHelper = new DatabaseHelper(mCtx);
mDb = mDbHelper.getWritableDatabase();
return this;
}

public void close() {
mDbHelper.close();
}


public long createNote(float f, float g, int size) {
ContentValues initialValues = new ContentValues();
initialValues.put(KEY_X, f);
initialValues.put(KEY_Y, g);
initialValues.put(KEY_Size, size);
return mDb.insert(DATABASE_TABLE, null, initialValues);
}

public boolean deleteNote(long rowId) {

return mDb.delete(DATABASE_TABLE, KEY_ROWID + = + rowId,
null)  0;
}


public Cursor fetchAllNotes() {

return mDb.query(DATABASE_TABLE, new String[] {KEY_ROWID,
KEY_X,KEY_Y,KEY_Size}, null, null, null, null, null);
}

public Cursor fetchNote(long rowId) throws SQLException {

Cursor mCursor =

mDb.query(true, DATABASE_TABLE, new String[] {KEY_ROWID,
KEY_X,KEY_Y,KEY_Size}, KEY_ROWID + = + rowId, null,
null, null, null, null);
if (mCursor != null) {
mCursor.moveToFirst();
}
return mCursor;

}

public boolean updateNote(long rowId, int x, int y, int size) {
ContentValues args = new ContentValues();
args.put(KEY_X, x);
args.put(KEY_Y, y);
args.put(KEY_Size, size);
return mDb.update(DATABASE_TABLE, args, KEY_ROWID + = +
rowId, null)  0;
}
}


On Dec 28, 2:57 pm, Kostya Vasilyev kmans...@gmail.com wrote:
 Are all these supposed to be mapped to the same column, _id, or is this a
 copy /  paste artifact?

    public static final String KEY_ROWID = _id;
    public static final String KEY_X = _id;
    public static final String KEY_Y = _id;
    public static final String KEY_Size = _id;

 29 декабря 2011 г. 1:50 пользователь Jeresam515
 jeremyschiff...@gmail.comнаписал:







  I did the notepad tutorials, and am using a modified version of that
  for my database. I don't understand why my program isn't correctly
  writing to it. Help would be greatly appreciated.

  package com.drawing;

  import android.content.ContentValues;
  import android.content.Context;
  import android.database.Cursor;
  import android.database.SQLException;
  import android.database.sqlite.SQLiteDatabase;
  import android.database.sqlite.SQLiteOpenHelper;
  import android.util.Log;

  public class NotesDbAdapter {

     public static final String KEY_ROWID = _id;
     public static final String KEY_X = _id;
     public static final String KEY_Y = _id;
     public static final String KEY_Size = _id;
     private static final String TAG = NotesDbAdapter;
     private DatabaseHelper mDbHelper;
     private SQLiteDatabase mDb;
     private static final String DATABASE_CREATE =
         create table notes (_id integer primary key autoincrement, 
         + title text not null

[android-developers] How should one delete all of the table(but not the table itself) without making the thread using that database give an error?

2011-12-29 Thread Jeresam515
So I'm trying to have a menu button to clear my database when it is
pressed, that works fine. However, as soon as new information is sent
to the database the app force closes. How should i stop this? Here is
the clear part:

@Override
public boolean onMenuItemSelected(int featureId, MenuItem item) {
switch(item.getItemId()) {
case INSERT_ID:
//reset just makes all the variables in the thred reinitialize at base
values
mLemonadeMainMenuView.reset();
NotesMade = 0;
mDbHelper.deleteAllNotes();
return true;
}

Here is the new data information:

  @Override
public boolean onTouchEvent(MotionEvent event) {
mDbHelper.createNote(event.getX(), event.getY(), 1);
NotesMade ++;
mLemonadeMainMenuView.setCoords(NotesMade);
return true;
}
Finally, here is the recieving end:

 while(mNotesMademNoteId)
{mNoteId++;
 Cursor note = mDbHelper.fetchNote(mNoteId);
 Float x;
 Float y;
 Float size;
 x =
Float.valueOf(note.getString(note.getColumnIndexOrThrow(NotesDbAdapter.KEY_X)));
 y=
Float.valueOf(note.getString(note.getColumnIndexOrThrow(NotesDbAdapter.KEY_Y)));
 size
=Float.valueOf(note.getString(note.getColumnIndexOrThrow(NotesDbAdapter.KEY_X)));
  canvas.drawCircle(x, y, 1, paint);}
}

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Why is my program not correctly writing to my database?

2011-12-28 Thread Jeresam515
I did the notepad tutorials, and am using a modified version of that
for my database. I don't understand why my program isn't correctly
writing to it. Help would be greatly appreciated.

package com.drawing;

import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;

public class NotesDbAdapter {

public static final String KEY_ROWID = _id;
public static final String KEY_X = _id;
public static final String KEY_Y = _id;
public static final String KEY_Size = _id;
private static final String TAG = NotesDbAdapter;
private DatabaseHelper mDbHelper;
private SQLiteDatabase mDb;
private static final String DATABASE_CREATE =
create table notes (_id integer primary key autoincrement, 
+ title text not null, body text not null);;

private static final String DATABASE_NAME = data;
private static final String DATABASE_TABLE = notes;
private static final int DATABASE_VERSION = 2;

private final Context mCtx;

private static class DatabaseHelper extends SQLiteOpenHelper {

DatabaseHelper(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
}

@Override
public void onCreate(SQLiteDatabase db) {

db.execSQL(DATABASE_CREATE);
}

@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int
newVersion) {
Log.w(TAG, Upgrading database from version  + oldVersion
+  to 
+ newVersion + , which will destroy all old
data);
db.execSQL(DROP TABLE IF EXISTS notes);
onCreate(db);
}
}

public NotesDbAdapter(Context ctx) {
this.mCtx = ctx;
}

public NotesDbAdapter open() throws SQLException {
mDbHelper = new DatabaseHelper(mCtx);
mDb = mDbHelper.getWritableDatabase();
return this;
}

public void close() {
mDbHelper.close();
}


public long createNote(float f, float g, int size) {
ContentValues initialValues = new ContentValues();
initialValues.put(KEY_X, f);
initialValues.put(KEY_Y, g);
initialValues.put(KEY_Size, size);
return mDb.insert(DATABASE_TABLE, null, initialValues);
}

public boolean deleteNote(long rowId) {

return mDb.delete(DATABASE_TABLE, KEY_ROWID + = + rowId,
null)  0;
}


public Cursor fetchAllNotes() {

return mDb.query(DATABASE_TABLE, new String[] {KEY_ROWID,
KEY_X,KEY_Y,KEY_Size}, null, null, null, null, null);
}

public Cursor fetchNote(long rowId) throws SQLException {

Cursor mCursor =

mDb.query(true, DATABASE_TABLE, new String[] {KEY_ROWID,
KEY_X,KEY_Y,KEY_Size}, KEY_ROWID + = + rowId, null,
null, null, null, null);
if (mCursor != null) {
mCursor.moveToFirst();
}
return mCursor;

}

public boolean updateNote(long rowId, int x, int y, int size) {
ContentValues args = new ContentValues();
args.put(KEY_X, x);
args.put(KEY_Y, y);
args.put(KEY_Size, size);
return mDb.update(DATABASE_TABLE, args, KEY_ROWID + = +
rowId, null)  0;
}
}

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Why is my app not writing correctly to my SQL server?

2011-12-28 Thread Jeresam515
I did the notepad tutorials and my SQL server is a modified version of
that. For some reason my app is not writing to it correctly. Any help
would be greatly appreciated.

package com.drawing;

import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;

public class NotesDbAdapter {

public static final String KEY_ROWID = _id;
public static final String KEY_X = _id;
public static final String KEY_Y = _id;
public static final String KEY_Size = _id;
private static final String TAG = NotesDbAdapter;
private DatabaseHelper mDbHelper;
private SQLiteDatabase mDb;
private static final String DATABASE_CREATE =
create table notes (_id integer primary key autoincrement, 
+ title text not null, body text not null);;

private static final String DATABASE_NAME = data;
private static final String DATABASE_TABLE = notes;
private static final int DATABASE_VERSION = 2;

private final Context mCtx;

private static class DatabaseHelper extends SQLiteOpenHelper {

DatabaseHelper(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
}

@Override
public void onCreate(SQLiteDatabase db) {

db.execSQL(DATABASE_CREATE);
}

@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int
newVersion) {
Log.w(TAG, Upgrading database from version  + oldVersion
+  to 
+ newVersion + , which will destroy all old
data);
db.execSQL(DROP TABLE IF EXISTS notes);
onCreate(db);
}
}

public NotesDbAdapter(Context ctx) {
this.mCtx = ctx;
}

public NotesDbAdapter open() throws SQLException {
mDbHelper = new DatabaseHelper(mCtx);
mDb = mDbHelper.getWritableDatabase();
return this;
}

public void close() {
mDbHelper.close();
}


public long createNote(float f, float g, int size) {
ContentValues initialValues = new ContentValues();
initialValues.put(KEY_X, f);
initialValues.put(KEY_Y, g);
initialValues.put(KEY_Size, size);
return mDb.insert(DATABASE_TABLE, null, initialValues);
}

public boolean deleteNote(long rowId) {

return mDb.delete(DATABASE_TABLE, KEY_ROWID + = + rowId,
null)  0;
}


public Cursor fetchAllNotes() {

return mDb.query(DATABASE_TABLE, new String[] {KEY_ROWID,
KEY_X,KEY_Y,KEY_Size}, null, null, null, null, null);
}

public Cursor fetchNote(long rowId) throws SQLException {

Cursor mCursor =

mDb.query(true, DATABASE_TABLE, new String[] {KEY_ROWID,
KEY_X,KEY_Y,KEY_Size}, KEY_ROWID + = + rowId, null,
null, null, null, null);
if (mCursor != null) {
mCursor.moveToFirst();
}
return mCursor;

}

public boolean updateNote(long rowId, int x, int y, int size) {
ContentValues args = new ContentValues();
args.put(KEY_X, x);
args.put(KEY_Y, y);
args.put(KEY_Size, size);
return mDb.update(DATABASE_TABLE, args, KEY_ROWID + = +
rowId, null)  0;
}
}

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Why isn't my SQL database working correctly?

2011-12-28 Thread Jeresam515
I did the notepad tutorials and my SQL server is a modified version of
that. For some reason my app is not writing to it correctly. Any help
would be greatly appreciated.

package com.drawing;

import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;

public class NotesDbAdapter {

public static final String KEY_ROWID = _id;
public static final String KEY_X = _id;
public static final String KEY_Y = _id;
public static final String KEY_Size = _id;
private static final String TAG = NotesDbAdapter;
private DatabaseHelper mDbHelper;
private SQLiteDatabase mDb;
private static final String DATABASE_CREATE =
create table notes (_id integer primary key autoincrement, 
+ title text not null, body text not null);;

private static final String DATABASE_NAME = data;
private static final String DATABASE_TABLE = notes;
private static final int DATABASE_VERSION = 2;

private final Context mCtx;

private static class DatabaseHelper extends SQLiteOpenHelper {

DatabaseHelper(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
}

@Override
public void onCreate(SQLiteDatabase db) {

db.execSQL(DATABASE_CREATE);
}

@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int
newVersion) {
Log.w(TAG, Upgrading database from version  + oldVersion
+  to 
+ newVersion + , which will destroy all old
data);
db.execSQL(DROP TABLE IF EXISTS notes);
onCreate(db);
}
}

public NotesDbAdapter(Context ctx) {
this.mCtx = ctx;
}

public NotesDbAdapter open() throws SQLException {
mDbHelper = new DatabaseHelper(mCtx);
mDb = mDbHelper.getWritableDatabase();
return this;
}

public void close() {
mDbHelper.close();
}


public long createNote(float f, float g, int size) {
ContentValues initialValues = new ContentValues();
initialValues.put(KEY_X, f);
initialValues.put(KEY_Y, g);
initialValues.put(KEY_Size, size);
return mDb.insert(DATABASE_TABLE, null, initialValues);
}

public boolean deleteNote(long rowId) {

return mDb.delete(DATABASE_TABLE, KEY_ROWID + = + rowId,
null)  0;
}


public Cursor fetchAllNotes() {

return mDb.query(DATABASE_TABLE, new String[] {KEY_ROWID,
KEY_X,KEY_Y,KEY_Size}, null, null, null, null, null);
}

public Cursor fetchNote(long rowId) throws SQLException {

Cursor mCursor =

mDb.query(true, DATABASE_TABLE, new String[] {KEY_ROWID,
KEY_X,KEY_Y,KEY_Size}, KEY_ROWID + = + rowId, null,
null, null, null, null);
if (mCursor != null) {
mCursor.moveToFirst();
}
return mCursor;

}

public boolean updateNote(long rowId, int x, int y, int size) {
ContentValues args = new ContentValues();
args.put(KEY_X, x);
args.put(KEY_Y, y);
args.put(KEY_Size, size);
return mDb.update(DATABASE_TABLE, args, KEY_ROWID + = +
rowId, null)  0;
}
}

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Why is my drawing so unfluid and blinky?

2011-12-27 Thread Jeresam515
Here is the code of my two files:

package com.drawing;


import android.app.Activity;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;

import com.drawing.LemonadeMainMenuView.LemonadeMainMenuThread;
public class Main extends Activity{
private LemonadeMainMenuThread mLemonadeMainMenuThread;
private LemonadeMainMenuView mLemonadeMainMenuView;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
mLemonadeMainMenuView = (LemonadeMainMenuView)
findViewById(R.id.lunar);
mLemonadeMainMenuThread = mLemonadeMainMenuView.getThread();
}
@Override
public boolean onTouchEvent(MotionEvent event) {
mLemonadeMainMenuView.setCoords(event.getX(), event.getY(), 11);
return true;
}

}


and

package com.drawing;




import android.content.Context;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Paint.Style;
import android.graphics.Rect;
import android.os.Handler;
import android.os.Message;
import android.util.AttributeSet;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.widget.TextView;
public class LemonadeMainMenuView extends SurfaceView implements
SurfaceHolder.Callback{
private boolean mRun = false;
public boolean b = false;
class LemonadeMainMenuThread extends Thread {
Bitmap bitmap = null;
private SurfaceHolder mSurfaceHolder;
private Handler mHandler;
private Context mContext;
public void setRunning(boolean b) {
mRun = b;
}
public LemonadeMainMenuThread(SurfaceHolder surfaceHolder, Context
context,
Handler handler) {
 mSurfaceHolder = surfaceHolder;
 mHandler = handler;
 mContext = context;
}
Resources res = getResources();

  @Override
  public void run() {
  while (mRun) {
  Canvas c = null;
  try {
  c = mSurfaceHolder.lockCanvas(null);
  synchronized (mSurfaceHolder) {
  c.restore();
  doDraw(c);
  c.save();
  }
  } finally {
  if (c != null) {
  mSurfaceHolder.unlockCanvasAndPost(c);
  }
  }
  }
  }


private void doDraw(Canvas canvas) {
if (bitmap == null) {
bitmap = Bitmap.createBitmap(1000,
1000,Bitmap.Config.ARGB_);
canvas.setBitmap(bitmap);
}
  if(b){
  canvas.drawColor(Color.TRANSPARENT);
  canvas.drawBitmap(bitmap, 0, 0, null);
Paint paint = new Paint();
paint.setColor(Color.BLUE);
paint.setStyle(Style.FILL);
  canvas.drawCircle(mx, my, msize, paint);
  }
}}
private TextView mStatusText;
private LemonadeMainMenuThread thread;
public int mx;
public int my;
public int msize;
public LemonadeMainMenuView(Context context, AttributeSet attrs) {
super(context, attrs);
SurfaceHolder holder = getHolder();
holder.addCallback(this);

thread = new LemonadeMainMenuThread(holder, context, new
Handler() {
@Override
public void handleMessage(Message m) {
}
});

setFocusable(true);
}
public void surfaceChanged(SurfaceHolder arg0, int arg1, int arg2,
int arg3) {

}
public void surfaceCreated(SurfaceHolder arg0) {
thread.setRunning(true);
thread.start();
}
public LemonadeMainMenuThread getThread() {
return thread;
}
public LemonadeMainMenuThread setThreadRunning(boolean b) {
  mRun = b;
return thread;
}
public LemonadeMainMenuThread setCoords(float f, float g, int size) {
 mx = (int) f;
 my = (int) g;
 msize = size;
 b = true;
return thread;
}
public void setTextView(TextView textView) {
mStatusText = textView;
}
public void surfaceDestroyed(SurfaceHolder arg0) {


}


}
 main.xml just displays LemonadeMainMenu.java

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit 

[android-developers] Edit boxes in OpenGL?

2011-12-20 Thread Jeresam515
Is there a way to put Edit Boxes into an OpenGL rendered program, such
as putting the GL view into the main.xml somehow?

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en