|
Use the debugger (to step through each line of code).
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
As you said its running on Lollipop,but not in lower version.You should check gradle.app file firstly and should change minsdk version as your choice.Hope this will help.
|
|
|
|
|
How can we create a Draggable Button in Xamarin.Android?
I tried many times, I created a simple view which ca be dragged. But i can't implement touch event to that view.
How can i do this ?
Any Idea !
Thanks in Advance
Vaikesh K P
.NET\XAMARIN DEVELOPER
Kochi - India
|
|
|
|
|
|
Here is my logcat:
08-11 13:40:18.540 15571-15571/com.test E/SQLiteLog﹕ (1) no such table: mydb
08-11 13:40:18.547 15571-15571/com.test E/SQLiteDatabase﹕ Error inserting name=abc dates=2015-08-11 01:39:56 mobno=12344553mailid=abc@abc.com bday=2/2/4341
android.database.sqlite.SQLiteException: no such table: mydb (code 1): , while compiling: INSERT INTO mydb(name,dates,mobno,mailid,bday) VALUES (?,?,?,?,?)
Here is my DatabaseHelper.java file
package com.test;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;
import java.sql.SQLException;
public class DatabaseHelper {
public static final String KEY_ROWID="_id";
public static final String KEY_NAME="name";
public static final String KEY_BDAY="bday";
public static final String KEY_MOBNO="mobno";
public static final String KEY_MAIL="mailid";
public static final String KEY_DATE="dates";
private static final String DATABASE_NAME="mydb";
private static final String DATABASE_TABLE="mytable";
private static final int DATABASE_VERSION=1;
private DbHelper ourhelper;
private Context ourcontext;
private SQLiteDatabase ourdatabase;
public DatabaseHelper(Context c){
ourcontext=c;
}
public DatabaseHelper open() throws SQLException{
ourhelper = new DbHelper(ourcontext);
ourdatabase= ourhelper.getWritableDatabase();
return this;
}
public long createentry(String name, String bday, String mobno, String mail, String dater) {
ContentValues cv=new ContentValues();
cv.put(KEY_NAME,name);
cv.put(KEY_BDAY,bday);
cv.put(KEY_MOBNO,mobno);
cv.put(KEY_MAIL, mail);
cv.put(KEY_DATE, dater);
return ourdatabase.insert(DATABASE_NAME,null,cv);
}
public void close() {
ourhelper.close();
}
public String getdata() {
String[] columns=new String[]{KEY_NAME,KEY_BDAY,KEY_MOBNO,KEY_MAIL,KEY_DATE};
Cursor c=ourdatabase.query(DATABASE_TABLE, columns, null, null, null, null, null);
String result="";
int iName= c.getColumnIndex(KEY_NAME);
int iBday= c.getColumnIndex(KEY_BDAY);
int iMob= c.getColumnIndex(KEY_MOBNO);
int iMail= c.getColumnIndex(KEY_MAIL);
int iDate= c.getColumnIndex(KEY_DATE);
for (c.moveToFirst();c.isAfterLast();c.moveToNext()){
result= result +c.getString(iName) +" "+c.getString(iBday) +" "+
c.getString(iMob)+" "+c.getString(iMail)+" "+c.getString(iDate)+
"\n";
}
return result;
}
private static class DbHelper extends SQLiteOpenHelper{
public DbHelper(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
}
@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL("CREATE TABLE " + DATABASE_TABLE +" (" +
KEY_ROWID + " INTEGER PRIMARY KEY AUTOINCREMENT, " +
KEY_NAME + " TEXT NOT NULL, " +
KEY_BDAY + " TEXT NOT NULL, " +
KEY_MOBNO + " TEXT NOT NULL, " +
KEY_MAIL + " TEXT NOT NULL, " +
KEY_DATE + " TEXT NOT NULL);"
);
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
db.execSQL("DROP TABLE IF EXISTS " + DATABASE_TABLE);
onCreate(db);
}
}
}
And here is My form.java in which Button executes following code in Onclicklistener.
boolean ok=true;
try
{
String name=etname.getText().toString();
String bday=etbdate.getText().toString();
String mobno=etmobno.getText().toString();
String mail=etmailid.getText().toString();
String dater=date.toString();
DatabaseHelper entry=new DatabaseHelper(Form.this);
entry.open();
entry.createentry(name, bday, mobno, mail, dater);
entry.close();
Toast.makeText(getApplicationContext(), "Database Uploaded ", Toast.LENGTH_LONG).show();
}
catch(Exception ex)
{
ok=false;
catcherror(ex.toString());
}
modified 28-May-24 10:56am.
|
|
|
|
|
return ourdatabase.insert(DATABASE_NAME,null,cv);
That is the name of your database, not the table it contains.
|
|
|
|
|
dear expert,
as my question in my subject, I can't change the default color of the action bar and I'm following the android documentation and I understand how it works because I have changed the background color in the main content but in the action bar its not working..
I'm using an ecplise ide and have installed the latest SDK for android which is 5.1.1
modified 10-Aug-15 3:26am.
|
|
|
|
|
Member 11897566 wrote: its not working You need to explain what that actually means. We cannot guess what you have done, or what results you see.
|
|
|
|
|
what I mean by not working is that its not taking effect when I run in on my device, and I don't have any errors in the logcat window or any. but when I change the background color of the main content or inside the linear layout for ex. and run on my device and it does take effect it changed the background color.
I use the theme.holo.light. and the way I code it like this.
in the style.XML inside resource tag
<item name="android:background">#rrggbb color code</item
|
|
|
|
|
|
Hi all, I have a TableLayout nested within a ScrollView / LinearLayout, I add rows to the table dynamically when the application starts, the problem I have is I'm only seeing a third of my tables rows e.g. if I have 30 rows I can only scroll down to row 10 - my layout is as shown below - can anyone see anything wrong with this layout ? It displays and works perfectly for the rows that are visible ( please excuse the formatting )
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:fillViewport="true">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TableLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/tablelayoutmain"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_marginTop="20dp"
android:gravity="fill">
</TableLayout>
</LinearLayout>
</ScrollView>
We can’t stop here, this is bat country - Hunter S Thompson RIP
modified 25-Jul-15 5:29am.
|
|
|
|
|
I just tried using that exact layout, with a dynamically filled table of 40 rows each of 5 columns, and it scrolls fine top to bottom. Maybe you need to show us something more.
|
|
|
|
|
Hi Richard, thanks for replying - I should have said I'm adding ListViews to my table rows which I've read are problematic in ScrollViews but if it works for ten rows it should work ( to my mind ) with any amount
We can’t stop here, this is bat country - Hunter S Thompson RIP
|
|
|
|
|
Pete, would you like to share some code? It may be that the view handler is getting confused by the multi-level scrolling. My sample test just added some textviews to each row.
|
|
|
|
|
I just tried it and had the same problem using a ListView in each row. It looks like the view manager is taking the count of rows in each ListView item into account when calculating how far it scrolls, and getting confused. This may well be an Android restriction rather than a bug, but who knows?
|
|
|
|
|
I agree, thanks very much for your efforts - do you use Android Studio ? just being nosey.
We can’t stop here, this is bat country - Hunter S Thompson RIP
|
|
|
|
|
Just for your information, I tried removing the LinearLayout to see what would happen and I got all of my rows but only the ListView header was visible and the ListView itself is scrollable ( but too small to be of any use ).
We can’t stop here, this is bat country - Hunter S Thompson RIP
modified 26-Jul-15 7:14am.
|
|
|
|
|
|
Putting Richard's reply simply, we also need to see the Java code that you are using. That would explain the problem. This XML is just the layout for your application's activity, Java would show how this layout is actually rendered and other similar things.
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
Hi Afzaal, see Richards latest reply - thanks for replying.
We can’t stop here, this is bat country - Hunter S Thompson RIP
|
|
|
|
|
please mention horizontal view or vertical view in your lay out then only it will get scroll.In list view scroll will be automatically called when the items get increased
|
|
|
|
|
Hi there, if you read my original post you will see that my view does scroll but it only shows a third of the rows
We can’t stop here, this is bat country - Hunter S Thompson RIP
|
|
|
|
|
Dear Expert,
I am in level 0 of android programming.
I need to know how to start learning?
What are the software used to build Android application?
What is the latest software used to build the applications?
Regards,
|
|
|
|
|
|