on Tuesday, March 31, 2015


I want to make an android app that is going act as a middle ware system rather than an actual application. I want it to be comprised of bunch of services that communicates to various servers and to each other. There is no need of UI or Activity. Is this possible or will I have to make a dummy Activity? How do I achieve this ? and how do I start all the services and make communication between this?




I developed an android app using Text To Speech engine. For Hindi language, I installed Google text to speech engine .apk (com.google.android.tts-3.3.12.1616444.arm-210303120-minAPI15.apk) file to my android emulator using command prompt.


Here my question is, how to add this .apk file to my project? When I open another emulator its not working.





int num++;
img.setBackgroundResource(R.drawable.card +num);


my pictures are in the drawable folder and they are ok! the problem is that i cant use R.drawable.card_1 ! how can i solve this!?


i've already tried the code below



int num++;
img.setBackfroundResource("R.drawable.card_"+num);


but its not working either!


one of my pictures name is card_1 to card_10 i want when user clicked on Next button the next picture comes!




I installed some useful Android SDK tools, but now I got this problem. Can somebody tell me where can I find "Update & Restart"? Or which is another way of getting rid of this problem? Thanks :D



Rendering Problems


This version of the rendering library is more recent than your version of Android Studio. Please update Android Studio (Details)





I am new to AspectJ, and we are working on migrating a third-party application originally written using Eclipse to use Android Studio 1.1.0 and Gradle instead. We have taken an external library this app needs and created a library module in the project, and this library has an AspectJ .aj file that we need to compile and have work with the main app for a field-level Observable pattern. Using the plugin found here, I have been able to get the .aj file to compile into a .class file, verified by looking in the intermediates folder.


The problem is coming in the 'weaving' step, where this code is injected into the bytecode of the necessary classes. This does not appear to be happening. Below are my build files.


Project build.gradle:



buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.1.0'
classpath 'com.uphyca.gradle:gradle-android-aspectj-plugin:0.9.12'
}
}

allprojects {
repositories {
jcenter()
}
}


app module build.gradle:



apply plugin: 'com.android.application'

android {
compileSdkVersion 19
buildToolsVersion "22.0.1"

defaultConfig {
applicationId "com.example.myapp"
minSdkVersion 14
targetSdkVersion 19
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}

dependencies {
compile project(':blahblah')
compile 'com.android.support:support-v4:19.1.0'
compile 'com.google.code.gson:gson:2.2.4'
compile 'com.google.android.gms:play-services:6.1.11'
compile files('libs/commons-lang3-3.3.2.jar')
}


'blahblah' library module build.gradle:



import com.android.build.gradle.LibraryPlugin
import org.aspectj.bridge.IMessage
import org.aspectj.bridge.MessageHandler
import org.aspectj.tools.ajc.Main

apply plugin: 'com.android.library'
apply plugin: 'android-aspectj'

def gsonVersion = '2.2.4'
def aspectjVersion = '1.8.5'

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile "com.google.code.gson:gson:${gsonVersion}"
compile "org.aspectj:aspectjrt:${aspectjVersion}"
}

android {
compileSdkVersion 19
buildToolsVersion "22.0.1"

defaultConfig {
minSdkVersion 14
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

android.libraryVariants.all { variant ->

LibraryPlugin plugin = project.plugins.getPlugin(LibraryPlugin)

variant.javaCompile.doLast {
String[] args = ["-showWeaveInfo",
"-1.5",
"-inpath", javaCompile.destinationDir.toString(),
"-aspectpath", javaCompile.classpath.asPath,
"-d", javaCompile.destinationDir.toString(),
"-classpath", javaCompile.classpath.asPath,
"-bootclasspath", plugin.project.android.bootClasspath.join(
File.pathSeparator)]

MessageHandler handler = new MessageHandler(true);
new Main().run(args, handler)

def log = project.logger
for (IMessage message : handler.getMessages(null, true)) {
switch (message.getKind()) {
case IMessage.ABORT:
case IMessage.ERROR:
case IMessage.FAIL:
log.error message.message, message.thrown
break;
case IMessage.WARNING:
case IMessage.INFO:
log.info message.message, message.thrown
break;
case IMessage.DEBUG:
log.debug message.message, message.thrown
break;
}
}
}
}


What am I missing?




I'm using bluetooth to transfer data and audio from phone to windows computer. At the moment i have 2 socket (rfcomm) connections, 1 for data and second one for pure audio packets.


Could someone explain what advantages i could get, if i implement a2dp properly for audio transfer instead of over pure socket transfer.




i want to set a mp3 sound file as a ringtone one of my contact's call receiving. i studied about this problem in stack and many other websites. but still i can not solve this problem. please help me with code. and i used codes that there are update method or insert method that insert or update ringtone for contact. last thing that i must say is that i have list of my contacts name in a list view. and i want when clicking in list view items change ringtone happen. thank you for your help.




I am working on a project, in which I need to convert Recorded Mp3 to Text, so as I understood the problem, I have to find out Vocals and Decode it to text, is any library available for that in android?


Thank you.




I traced the files created when browsing an e-Book (.pdf) using special ebook reader application installed on my android that i have bought an books from it


i try to download the pdf file to my computer it's ok downloaded but cannot open it it's given me white pages ..I'm not familiar with encryption pdf files.. but I'm looking for any way that i can open it since i have the hmac code here the responding i got it if i request to open the book the ebook reader received



<fulfillmentToken fulfillmentType="buy" xmlns="http://ns.adobe.com/adept">
<distributor>urn:uuid:10344192-0619-4454-0003-206542567541</distributor>
<operatorURL>http://example.com:8081/fulfillment</operatorURL>
<expiration>2015-03-21T20:46:10+02:00</expiration>
<transaction>15-043567_54</transaction>
<resourceItemInfo>
<resource>urn:uuid:10344192-0619-4454-0003-206542567541</resource>
<resourceItem>1</resourceItem>
<metadata>
<dc:title xmlns:dc="http://purl.org/dc/elements/1.1/">bla bla bla bla</dc:title> <dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">bla bla bla</dc:creator>
<dc:format xmlns:dc="http://purl.org/dc/elements/1.1/">application/pdf</dc:format>
<dc:publisher xmlns:dc="http://purl.org/dc/elements/1.1/">bla bla</dc:publisher> <dc:description xmlns:dc="http://purl.org/dc/elements/1.1/">some description here.</dc:description>
<dc:identifier xmlns:dc="http://purl.org/dc/elements/1.1/">ISBN:12345678</dc:identifier>
<thumbnailURL>http://example.com:8081/Thum/12345678.jpg</thumbnailURL>
</metadata>
<src>http://example.com:8081/media/rbx_9953438358.pdf</src>
<downloadType>simple</downloadType>
</resourceItemInfo>
<hmac>0csdfAQOVJ01sdfsqRERGERSExA=</hmac>
</fulfillmentToken>



i try to connect my Android application to a Webservice. I wrote a new class and defined some Variables:


I´ve got the Async Class to use the Network



class GetValueTask extends AsyncTask<ApiConnector,Long,String> {
@Override
protected String doInBackground(ApiConnector... params) {
//wird im Background Thread ausgeführt
return params[0].getValue();

}

@Override
protected void onPostExecute(String s) {
//wird im Mainthread ausgeführt
MainActivity.this.setText(s);
}


}


And I have a Class where i want to call the Webservice


public class ApiConnector {



private static final String SOAP_ACTION ="urn:microsoft-dynamics-schemas/codeunit/AddService:Add";
private static final String METHOD_NAME ="Add";
private static final String NAMESPACE ="urn:microsoft-dynamics-schemas/codeunit/AddService";
private static final String URL ="http://192.168.0.154:9047/DynamicsNAV80/WS/CRONUS%20AG/Codeunit/AddService";
private static final String USERNAME="B.Denger";
private static final String PASSWORD ="TestPW123!";



public String getValue() {

SoapObject request = new SoapObject(NAMESPACE,METHOD_NAME);
request.addProperty("no","10");

PropertyInfo unamePI = new PropertyInfo();
PropertyInfo passPI = new PropertyInfo();
// Set Username
unamePI.setName("username");
// Set Value
unamePI.setValue(USERNAME);
// Set dataType
unamePI.setType(String.class);
// Add the property to request object
request.addProperty(unamePI);
//Set Password
passPI.setName("password");
//Set dataType
passPI.setValue(PASSWORD);
//Set dataType
passPI.setType(String.class);
//Add the property to request object
request.addProperty(passPI);

SoapSerializationEnvelope soapEnvelope = new SoapSerializationEnvelope(
SoapEnvelope.VER11);

soapEnvelope.setOutputSoapObject(request);

HttpTransportSE aht= new HttpTransportSE(URL);

try {
aht.call(SOAP_ACTION, soapEnvelope);
SoapPrimitive resultString = (SoapPrimitive) soapEnvelope.getResponse();
return resultString.toString();
}catch(Exception e ) {
e.printStackTrace();
return "Fail at Call";
}
}


}


I have set the using-permission in the Manifest file



<uses-permission android:name="android.permission.INTERNET"/>


in my MainActivity do i execute the AsynkTask with a Button



btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
GetValueTask getValueTask = new GetValueTask();
getValueTask.execute(new ApiConnector());
}
});


after execution i get following Logcat entry: W/System.err﹕ org.ksoap2.transport.HttpResponseException: HTTP request failed, HTTP status: 401


i googled a whole Day for it, but i did not solved the problem yet. is there anybody who could help me, or could give me a hint where i have to search?




my Android app, Drunk Locker, doesn't function properly on Android 5.0+ devices. In the app, we have about 25 or so apps that the user can choose to block for a certain amount of time. We have been receiving reports from Android 5.0 users that when they click block, they can still use all of their apps like normal. Can anyone help guide me to a solution? I'm very poor at coding but I know some of the basics. The app was a freelance job that went downhill after receiving the source code and we went separate ways with the developer who continuously wanted to overcharge for things so simple that I figured out how to do just by some research. Was something maybe deprecated in Android 5.0 that causes my app not to block the apps in the way it normally does? I can provide more information on the code and what not if it would help. Thanks in advance!


https://play.google.com/store/apps/details?id=vn.ibit.DrunkLocker




I'm trying to insert element from the StackOverFlow web service :





operations.add((ContentProviderOperation.newInsert(TagProvider.CONTENT_URI))
.withValue(TagTable.COLUMN_ID,i)
.withValue(TagTable.COLUMN_DISPLAY, currentTag.getName())
.withValue(TagTable.COLUMN_NB_OCCURRENCES,currentTag.getCount())
.build()) ;



What I want to know is what argument should I use as a second argument of the first withValue method, because when I use i (i is the counter of a for loop), I get this error :





03-31 14:34:16.539: E/AndroidRuntime(3066): FATAL EXCEPTION: main
03-31 14:34:16.539: E/AndroidRuntime(3066): Process: fr.isima.android.tp3, PID: 3066
03-31 14:34:16.539: E/AndroidRuntime(3066): java.lang.NullPointerException: Attempt to get length of null array
03-31 14:34:16.539: E/AndroidRuntime(3066): at android.text.TextUtils.join(TextUtils.java:298)
03-31 14:34:16.539: E/AndroidRuntime(3066): at fr.isima.android.tp3.ui.BookAdapter.getView(BookAdapter.java:55)
03-31 14:34:16.539: E/AndroidRuntime(3066): at android.widget.AbsListView.obtainView(AbsListView.java:2344)
03-31 14:34:16.539: E/AndroidRuntime(3066): at android.widget.ListView.makeAndAddView(ListView.java:1864)
03-31 14:34:16.539: E/AndroidRuntime(3066): at android.widget.ListView.fillDown(ListView.java:698)
03-31 14:34:16.539: E/AndroidRuntime(3066): at android.widget.ListView.fillFromTop(ListView.java:759)
03-31 14:34:16.539: E/AndroidRuntime(3066): at android.widget.ListView.layoutChildren(ListView.java:1673)
03-31 14:34:16.539: E/AndroidRuntime(3066): at android.widget.AbsListView.onLayout(AbsListView.java:2148)
03-31 14:34:16.539: E/AndroidRuntime(3066): at android.view.View.layout(View.java:15596)
03-31 14:34:16.539: E/AndroidRuntime(3066): at android.view.ViewGroup.layout(ViewGroup.java:4966)
03-31 14:34:16.539: E/AndroidRuntime(3066): at android.widget.FrameLayout.layoutChildren(FrameLayout.java:573)
03-31 14:34:16.539: E/AndroidRuntime(3066): at android.widget.FrameLayout.onLayout(FrameLayout.java:508)
03-31 14:34:16.539: E/AndroidRuntime(3066): at android.view.View.layout(View.java:15596)
03-31 14:34:16.539: E/AndroidRuntime(3066): at android.view.ViewGroup.layout(ViewGroup.java:4966)
03-31 14:34:16.539: E/AndroidRuntime(3066): at com.android.internal.widget.ActionBarOverlayLayout.onLayout(ActionBarOverlayLayout.java:494)
03-31 14:34:16.539: E/AndroidRuntime(3066): at android.view.View.layout(View.java:15596)
03-31 14:34:16.539: E/AndroidRuntime(3066): at android.view.ViewGroup.layout(ViewGroup.java:4966)
03-31 14:34:16.539: E/AndroidRuntime(3066): at android.widget.FrameLayout.layoutChildren(FrameLayout.java:573)
03-31 14:34:16.539: E/AndroidRuntime(3066): at android.widget.FrameLayout.onLayout(FrameLayout.java:508)
03-31 14:34:16.539: E/AndroidRuntime(3066): at android.view.View.layout(View.java:15596)
03-31 14:34:16.539: E/AndroidRuntime(3066): at android.view.ViewGroup.layout(ViewGroup.java:4966)
03-31 14:34:16.539: E/AndroidRuntime(3066): at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2072)
03-31 14:34:16.539: E/AndroidRuntime(3066): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1829)
03-31 14:34:16.539: E/AndroidRuntime(3066): at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1054)
03-31 14:34:16.539: E/AndroidRuntime(3066): at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5779)
03-31 14:34:16.539: E/AndroidRuntime(3066): at android.view.Choreographer$CallbackRecord.run(Choreographer.java:767)
03-31 14:34:16.539: E/AndroidRuntime(3066): at android.view.Choreographer.doCallbacks(Choreographer.java:580)
03-31 14:34:16.539: E/AndroidRuntime(3066): at android.view.Choreographer.doFrame(Choreographer.java:550)
03-31 14:34:16.539: E/AndroidRuntime(3066): at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:753)
03-31 14:34:16.539: E/AndroidRuntime(3066): at android.os.Handler.handleCallback(Handler.java:739)
03-31 14:34:16.539: E/AndroidRuntime(3066): at android.os.Handler.dispatchMessage(Handler.java:95)
03-31 14:34:16.539: E/AndroidRuntime(3066): at android.os.Looper.loop(Looper.java:135)
03-31 14:34:16.539: E/AndroidRuntime(3066): at android.app.ActivityThread.main(ActivityThread.java:5221)
03-31 14:34:16.539: E/AndroidRuntime(3066): at java.lang.reflect.Method.invoke(Native Method)
03-31 14:34:16.539: E/AndroidRuntime(3066): at java.lang.reflect.Method.invoke(Method.java:372)
03-31 14:34:16.539: E/AndroidRuntime(3066): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
03-31 14:34:16.539: E/AndroidRuntime(3066): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
03-31 14:34:58.938: E/SQLiteLog(3109): (1555) abort at 12 in [INSERT INTO tag(nb_occurrences,display,_id) VALUES (?,?,?)]: UNIQUE constraint failed: tag._id
03-31 14:34:58.943: E/SQLiteDatabase(3109): Error inserting nb_occurrences=816449 display=javascript _id=1
03-31 14:34:58.943: E/SQLiteDatabase(3109): android.database.sqlite.SQLiteConstraintException: UNIQUE constraint failed: tag._id (code 1555)
03-31 14:34:58.943: E/SQLiteDatabase(3109): at android.database.sqlite.SQLiteConnection.nativeExecuteForLastInsertedRowId(Native Method)
03-31 14:34:58.943: E/SQLiteDatabase(3109): at android.database.sqlite.SQLiteConnection.executeForLastInsertedRowId(SQLiteConnection.java:782)
03-31 14:34:58.943: E/SQLiteDatabase(3109): at android.database.sqlite.SQLiteSession.executeForLastInsertedRowId(SQLiteSession.java:788)
03-31 14:34:58.943: E/SQLiteDatabase(3109): at android.database.sqlite.SQLiteStatement.executeInsert(SQLiteStatement.java:86)
03-31 14:34:58.943: E/SQLiteDatabase(3109): at android.database.sqlite.SQLiteDatabase.insertWithOnConflict(SQLiteDatabase.java:1471)
03-31 14:34:58.943: E/SQLiteDatabase(3109): at android.database.sqlite.SQLiteDatabase.insert(SQLiteDatabase.java:1341)
03-31 14:34:58.943: E/SQLiteDatabase(3109): at fr.isima.android.tp3.provider.TagProvider.insert(TagProvider.java:56)
03-31 14:34:58.943: E/SQLiteDatabase(3109): at android.content.ContentProviderOperation.apply(ContentProviderOperation.java:240)
03-31 14:34:58.943: E/SQLiteDatabase(3109): at android.content.ContentProvider.applyBatch(ContentProvider.java:1712)
03-31 14:34:58.943: E/SQLiteDatabase(3109): at android.content.ContentProvider$Transport.applyBatch(ContentProvider.java:287)
03-31 14:34:58.943: E/SQLiteDatabase(3109): at android.content.ContentProviderClient.applyBatch(ContentProviderClient.java:377)
03-31 14:34:58.943: E/SQLiteDatabase(3109): at android.content.ContentResolver.applyBatch(ContentResolver.java:1244)
03-31 14:34:58.943: E/SQLiteDatabase(3109): at fr.isima.android.tp3.service.DataFetchingService$TestThread.run(DataFetchingService.java:126)
03-31 14:34:59.012: E/AndroidRuntime(3109): FATAL EXCEPTION: test
03-31 14:34:59.012: E/AndroidRuntime(3109): Process: fr.isima.android.tp3, PID: 3109
03-31 14:34:59.012: E/AndroidRuntime(3109): android.database.SQLException: Failed to insert row into content://fr.isima.android.tp3.provider.TagProvider/tags
03-31 14:34:59.012: E/AndroidRuntime(3109): at fr.isima.android.tp3.provider.TagProvider.insert(TagProvider.java:66)
03-31 14:34:59.012: E/AndroidRuntime(3109): at android.content.ContentProviderOperation.apply(ContentProviderOperation.java:240)
03-31 14:34:59.012: E/AndroidRuntime(3109): at android.content.ContentProvider.applyBatch(ContentProvider.java:1712)
03-31 14:34:59.012: E/AndroidRuntime(3109): at android.content.ContentProvider$Transport.applyBatch(ContentProvider.java:287)
03-31 14:34:59.012: E/AndroidRuntime(3109): at android.content.ContentProviderClient.applyBatch(ContentProviderClient.java:377)
03-31 14:34:59.012: E/AndroidRuntime(3109): at android.content.ContentResolver.applyBatch(ContentResolver.java:1244)
03-31 14:34:59.012: E/AndroidRuntime(3109): at fr.isima.android.tp3.service.DataFetchingService$TestThread.run(DataFetchingService.java:126)
03-31 14:34:59.060: E/gralloc_goldfish(933): gralloc_alloc: Mismatched usage flags: 288 x 288, usage 333
03-31 14:34:59.061: E/(933): GraphicBufferAlloc::createGraphicBuffer(w=288, h=288) failed (Invalid argument), handle=0x0
03-31 14:34:59.065: E/BufferQueueProducer(1244): [ScreenshotClient] dequeueBuffer: createGraphicBuffer failed
03-31 14:34:59.068: E/ActivityManager(1244): Invalid thumbnail dimensions: 288x288
03-31 14:37:24.259: E/CheckinTask(1730): SSL error, attempting time correction: javax.net.ssl.SSLHandshakeException: Connection closed by peer
03-31 14:37:24.736: E/CheckinTask(1730): Checkin failed: https://android.clients.google.com/checkin (request #0): javax.net.ssl.SSLHandshakeException: Connection closed by peer
03-31 14:37:34.955: E/ActivityThread(1642): Service com.google.android.gms.backup.BackupTransportService has leaked ServiceConnection com.google.android.gms.http.f@f4c18e9 that was originally bound here
03-31 14:37:34.955: E/ActivityThread(1642): android.app.ServiceConnectionLeaked: Service com.google.android.gms.backup.BackupTransportService has leaked ServiceConnection com.google.android.gms.http.f@f4c18e9 that was originally bound here
03-31 14:37:34.955: E/ActivityThread(1642): at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:1072)
03-31 14:37:34.955: E/ActivityThread(1642): at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:966)
03-31 14:37:34.955: E/ActivityThread(1642): at android.app.ContextImpl.bindServiceCommon(ContextImpl.java:1768)
03-31 14:37:34.955: E/ActivityThread(1642): at android.app.ContextImpl.bindService(ContextImpl.java:1751)
03-31 14:37:34.955: E/ActivityThread(1642): at android.content.ContextWrapper.bindService(ContextWrapper.java:538)
03-31 14:37:34.955: E/ActivityThread(1642): at com.google.android.gms.http.e.<init>(SourceFile:94)
03-31 14:37:34.955: E/ActivityThread(1642): at com.google.android.gms.http.GoogleHttpClient.<init>(SourceFile:234)
03-31 14:37:34.955: E/ActivityThread(1642): at com.google.android.gms.http.GoogleHttpClient.<init>(SourceFile:196)
03-31 14:37:34.955: E/ActivityThread(1642): at com.google.android.gms.backup.BackupTransportService.onCreate(SourceFile:1172)
03-31 14:37:34.955: E/ActivityThread(1642): at android.app.ActivityThread.handleCreateService(ActivityThread.java:2731)
03-31 14:37:34.955: E/ActivityThread(1642): at android.app.ActivityThread.access$1800(ActivityThread.java:144)
03-31 14:37:34.955: E/ActivityThread(1642): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1361)
03-31 14:37:34.955: E/ActivityThread(1642): at android.os.Handler.dispatchMessage(Handler.java:102)
03-31 14:37:34.955: E/ActivityThread(1642): at android.os.Looper.loop(Looper.java:135)
03-31 14:37:34.955: E/ActivityThread(1642): at android.app.ActivityThread.main(ActivityThread.java:5221)
03-31 14:37:34.955: E/ActivityThread(1642): at java.lang.reflect.Method.invoke(Native Method)
03-31 14:37:34.955: E/ActivityThread(1642): at java.lang.reflect.Method.invoke(Method.java:372)
03-31 14:37:34.955: E/ActivityThread(1642): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
03-31 14:37:34.955: E/ActivityThread(1642): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
03-31 14:37:34.984: E/StrictMode(1642): null
03-31 14:37:34.984: E/StrictMode(1642): android.app.ServiceConnectionLeaked: Service com.google.android.gms.backup.BackupTransportService has leaked ServiceConnection com.google.android.gms.http.f@f4c18e9 that was originally bound here
03-31 14:37:34.984: E/StrictMode(1642): at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:1072)
03-31 14:37:34.984: E/StrictMode(1642): at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:966)
03-31 14:37:34.984: E/StrictMode(1642): at android.app.ContextImpl.bindServiceCommon(ContextImpl.java:1768)
03-31 14:37:34.984: E/StrictMode(1642): at android.app.ContextImpl.bindService(ContextImpl.java:1751)
03-31 14:37:34.984: E/StrictMode(1642): at android.content.ContextWrapper.bindService(ContextWrapper.java:538)
03-31 14:37:34.984: E/StrictMode(1642): at com.google.android.gms.http.e.<init>(SourceFile:94)
03-31 14:37:34.984: E/StrictMode(1642): at com.google.android.gms.http.GoogleHttpClient.<init>(SourceFile:234)
03-31 14:37:34.984: E/StrictMode(1642): at com.google.android.gms.http.GoogleHttpClient.<init>(SourceFile:196)
03-31 14:37:34.984: E/StrictMode(1642): at com.google.android.gms.backup.BackupTransportService.onCreate(SourceFile:1172)
03-31 14:37:34.984: E/StrictMode(1642): at android.app.ActivityThread.handleCreateService(ActivityThread.java:2731)
03-31 14:37:34.984: E/StrictMode(1642): at android.app.ActivityThread.access$1800(ActivityThread.java:144)
03-31 14:37:34.984: E/StrictMode(1642): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1361)
03-31 14:37:34.984: E/StrictMode(1642): at android.os.Handler.dispatchMessage(Handler.java:102)
03-31 14:37:34.984: E/StrictMode(1642): at android.os.Looper.loop(Looper.java:135)
03-31 14:37:34.984: E/StrictMode(1642): at android.app.ActivityThread.main(ActivityThread.java:5221)
03-31 14:37:34.984: E/StrictMode(1642): at java.lang.reflect.Method.invoke(Native Method)
03-31 14:37:34.984: E/StrictMode(1642): at java.lang.reflect.Method.invoke(Method.java:372)
03-31 14:37:34.984: E/StrictMode(1642): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
03-31 14:37:34.984: E/StrictMode(1642): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
03-31 14:37:35.204: E/Backup(1661): [LegacyBackupAccountManager] Fail to get legacy transport context.
03-31 14:37:35.204: E/Backup(1661): android.content.pm.PackageManager$NameNotFoundException: Application package com.google.android.backup not found
03-31 14:37:35.204: E/Backup(1661): at android.app.ContextImpl.createPackageContextAsUser(ContextImpl.java:2139)
03-31 14:37:35.204: E/Backup(1661): at android.app.ContextImpl.createPackageContext(ContextImpl.java:2115)
03-31 14:37:35.204: E/Backup(1661): at android.content.ContextWrapper.createPackageContext(ContextWrapper.java:658)
03-31 14:37:35.204: E/Backup(1661): at com.google.android.gms.backup.am.<init>(SourceFile:47)
03-31 14:37:35.204: E/Backup(1661): at com.google.android.gms.backup.BackupTransportMigratorService.b(SourceFile:162)
03-31 14:37:35.204: E/Backup(1661): at com.google.android.gms.backup.BackupTransportMigratorService.onHandleIntent(SourceFile:80)
03-31 14:37:35.204: E/Backup(1661): at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65)
03-31 14:37:35.204: E/Backup(1661): at android.os.Handler.dispatchMessage(Handler.java:102)
03-31 14:37:35.204: E/Backup(1661): at android.os.Looper.loop(Looper.java:135)
03-31 14:37:35.204: E/Backup(1661): at android.os.HandlerThread.run(HandlerThread.java:61)
03-31 14:37:35.498: E/Backup(1661): [LegacyBackupAccountManager] Fail to get legacy transport context.
03-31 14:37:35.498: E/Backup(1661): android.content.pm.PackageManager$NameNotFoundException: Application package com.google.android.backup not found
03-31 14:37:35.498: E/Backup(1661): at android.app.ContextImpl.createPackageContextAsUser(ContextImpl.java:2139)
03-31 14:37:35.498: E/Backup(1661): at android.app.ContextImpl.createPackageContext(ContextImpl.java:2115)
03-31 14:37:35.498: E/Backup(1661): at android.content.ContextWrapper.createPackageContext(ContextWrapper.java:658)
03-31 14:37:35.498: E/Backup(1661): at com.google.android.gms.backup.am.<init>(SourceFile:47)
03-31 14:37:35.498: E/Backup(1661): at com.google.android.gms.backup.a.a(SourceFile:65)
03-31 14:37:35.498: E/Backup(1661): at com.google.android.gms.backup.c.a(SourceFile:39)
03-31 14:37:35.498: E/Backup(1661): at com.google.android.gms.backup.b.a(SourceFile:67)
03-31 14:37:35.498: E/Backup(1661): at com.google.android.gms.backup.b.a(SourceFile:39)
03-31 14:37:35.498: E/Backup(1661): at com.google.android.gms.backup.BackupAccountNotifierService.onHandleIntent(SourceFile:76)
03-31 14:37:35.498: E/Backup(1661): at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65)
03-31 14:37:35.498: E/Backup(1661): at android.os.Handler.dispatchMessage(Handler.java:102)
03-31 14:37:35.498: E/Backup(1661): at android.os.Looper.loop(Looper.java:135)
03-31 14:37:35.498: E/Backup(1661): at android.os.HandlerThread.run(HandlerThread.java:61)
03-31 14:45:11.498: E/ActivityThread(1642): Service com.google.android.gms.backup.BackupTransportService has leaked ServiceConnection com.google.android.gms.http.f@2ca00e59 that was originally bound here
03-31 14:45:11.498: E/ActivityThread(1642): android.app.ServiceConnectionLeaked: Service com.google.android.gms.backup.BackupTransportService has leaked ServiceConnection com.google.android.gms.http.f@2ca00e59 that was originally bound here
03-31 14:45:11.498: E/ActivityThread(1642): at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:1072)
03-31 14:45:11.498: E/ActivityThread(1642): at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:966)
03-31 14:45:11.498: E/ActivityThread(1642): at



Thanks in advance for your help.




How can I show the UML diagram in Android Studio? I have been searching on the internet for hours, but I found nothing. Any answers are appreciated.


Best regards




I am new in Android. I used the InfiniteViewPager library in my app and I have ten fragments in my app. When I change pages in page 6, the app will crash and I got the below error. How to fix it?



(FragmentManager.java:486)
at android.support.v4.app.FragmentPagerAdapter.finishUpdate(FragmentPagerAdapter.java:141)
at gh.sample.infinityLibrary.InfinitePagerAdapter.finishUpdate(InfinitePagerAdapter.java:67)
at android.support.v4.view.ViewPager.populate(ViewPager.java:1073)
at android.support.v4.view.ViewPager.populate(ViewPager.java:919)
at android.support.v4.view.ViewPager$3.run(ViewPager.java:249)
at android.support.v4.view.ViewPager.completeScroll(ViewPager.java:1766)
at android.support.v4.view.ViewPager.onInterceptTouchEvent(ViewPager.java:1901)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1817)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2174)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1875)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2174)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1875)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2174)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1875)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2174)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1875)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2174)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1875)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2174)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1875)
at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1953)



i am programming a view which is inside a scrollview. Everything inside the view is drawn using onDraw(). The view shows an object which is custom-build for a day. With two buttons, you can change the selected day forwards/backwards, but the problem is, that each day needs its own specific height. Is there a method to change the size of a view on at runtime or can i use onMeasure() before onDraw()?




What are classes/features do I need in the Android API to stream video/voice from one android device to another android device?




I'm using Android Studios tabbed activity template with ActionBar Tabs, I have a slight problem. I want to be able to add different texts into the different tabs however I get the same text on all tabs. How would I go by doing this?


Tabbed Activities


I have read through all the comments on the code yet still can't find how the different tabs are linked.


public class ScriptsTabbed extends ActionBarActivity implements ActionBar.TabListener {



/**
* The {@link android.support.v4.view.PagerAdapter} that will provide
* fragments for each of the sections. We use a
* {@link FragmentPagerAdapter} derivative, which will keep every
* loaded fragment in memory. If this becomes too memory intensive, it
* may be best to switch to a
* {@link android.support.v4.app.FragmentStatePagerAdapter}.
*/
SectionsPagerAdapter mSectionsPagerAdapter;

/**
* The {@link ViewPager} that will host the section contents.
*/
ViewPager mViewPager;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_scripts_tabbed);




// Set up the action bar.
final ActionBar actionBar = getSupportActionBar();
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);

// Create the adapter that will return a fragment for each of the three
// primary sections of the activity.
mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());

// Set up the ViewPager with the sections adapter.
mViewPager = (ViewPager) findViewById(R.id.pager);
mViewPager.setAdapter(mSectionsPagerAdapter);

// When swiping between different sections, select the corresponding
// tab. We can also use ActionBar.Tab#select() to do this if we have
// a reference to the Tab.
mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
@Override
public void onPageSelected(int position) {
actionBar.setSelectedNavigationItem(position);
}
});

// For each of the sections in the app, add a tab to the action bar.
for (int i = 0; i < mSectionsPagerAdapter.getCount(); i++) {
// Create a tab with text corresponding to the page title defined by
// the adapter. Also specify this Activity object, which implements
// the TabListener interface, as the callback (listener) for when
// this tab is selected.
actionBar.addTab(
actionBar.newTab()
.setText(mSectionsPagerAdapter.getPageTitle(i))
.setTabListener(this));
}
}


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

@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();

//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}

return super.onOptionsItemSelected(item);
}

@Override
public void onTabSelected(ActionBar.Tab tab1, FragmentTransaction fragmentTransaction) {
// When the given tab is selected, switch to the corresponding page in
// the ViewPager.
mViewPager.setCurrentItem(tab1.getPosition());



}

@Override
public void onTabUnselected(ActionBar.Tab tab2, FragmentTransaction fragmentTransaction) {
mViewPager.setCurrentItem(tab2.getPosition());


}

@Override
public void onTabReselected(ActionBar.Tab tab3, FragmentTransaction fragmentTransaction) {
mViewPager.setCurrentItem(tab3.getPosition());

}

/**
* A {@link FragmentPagerAdapter} that returns a fragment corresponding to
* one of the sections/tabs/pages.
*/
public class SectionsPagerAdapter extends FragmentPagerAdapter {

public SectionsPagerAdapter(FragmentManager fm) {
super(fm);
}

@Override
public Fragment getItem(int position) {
// getItem is called to instantiate the fragment for the given page.
// Return a PlaceholderFragment (defined as a static inner class below).
return PlaceholderFragment.newInstance(position + 1);
}

@Override
public int getCount() {
// Show 3 total pages.
return 3;
}

@Override
public CharSequence getPageTitle(int position) {
Locale l = Locale.getDefault();
switch (position) {
case 0:
return getString(R.string.title_section1).toUpperCase(l);
case 1:
return getString(R.string.title_section2).toUpperCase(l);
case 2:
return getString(R.string.title_section3).toUpperCase(l);
}
return null;
}
}

/**
* A placeholder fragment containing a simple view.
*/
public static class PlaceholderFragment extends Fragment {
/**
* The fragment argument representing the section number for this
* fragment.
*/
private static final String ARG_SECTION_NUMBER = "section_number";

/**
* Returns a new instance of this fragment for the given section
* number.
*/
public static PlaceholderFragment newInstance(int sectionNumber) {
PlaceholderFragment fragment = new PlaceholderFragment();
Bundle args = new Bundle();
args.putInt(ARG_SECTION_NUMBER, sectionNumber);
fragment.setArguments(args);
return fragment;
}


public PlaceholderFragment() {
}

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_scripts_tabbed, container, false);
return rootView;
}
}


}


Thank you!




I have a question about a local server and parsing JSON. I have to make a application for school and you have to parse JSON with a local server with IP and port.


This is the server class:



/**
* Created by Charlie on 26-3-2015.
*/
public class Server extends AsyncTask<Void, Void, String> {

private String message;
private String ip;
public static int port = 4444;
private String serverResponse = null;

public Server(String ip, int port, String message ) {
super();
//IP, Port en bericht om naar server te sturen
this.message = message;
this.ip = ip;
this.port = port;
}

@Override
protected String doInBackground(Void... params) {
try {
Socket serverSocket = new Socket();
serverSocket.connect(new InetSocketAddress(this.ip, this.port), 4444);

this.sendMessage(message, serverSocket);

InputStream input;

try {
input = serverSocket.getInputStream();
BufferedReader responseStreamReader = new BufferedReader(new InputStreamReader(input));
String line = "";
StringBuilder stringBuilder = new StringBuilder();
while ((line = responseStreamReader.readLine()) != null) {
stringBuilder.append(line);
}
responseStreamReader.close();

this.serverResponse = stringBuilder.toString();

} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}


System.out.println("Response: " + serverResponse);

} catch (UnknownHostException e) {
Log.d("debug", "can't find host");
} catch (SocketTimeoutException e) {
Log.d("debug", "time-out");
} catch (IOException e) {
e.printStackTrace();
}
return serverResponse;
}

private void sendMessage(String message, Socket serverSocket) {
OutputStreamWriter outputStreamWriter = null;

try {
outputStreamWriter = new OutputStreamWriter(serverSocket.getOutputStream());
} catch (IOException e2) {
e2.printStackTrace();
}

if (outputStreamWriter != null) {
BufferedWriter bufferedWriter = new BufferedWriter(outputStreamWriter);
PrintWriter writer = new PrintWriter(bufferedWriter, true);

writer.println(message);
}
}
}


And this is a class which calls the data:



public class HoofdschermFragment extends android.app.Fragment {

public static String serverIp;
public static int serverPort = 4444;
public static ArrayList<String> slotenLijst;
public static ArrayList<JSONObject> beknopteInformatieSlotlijst;
public static String informatieslotbeknopt = null;
private static View rootview;
private Spinner sloten_spinner;
public static String SlotNaam;
public static Boolean initieleVerbinding = true;
public static int GeselecteerdSlot;
public static int GeselecteerdePositie;

public static android.app.Fragment fragmentslotinformatie = new InformatieSlotFragment();

@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
rootview = inflater.inflate(R.layout.fragment_hoofdscherm, container, false);

//als eerste keer verbinding is, haal alles op uit server, zo niet, laatst opgehaalde data weer invullen
if(initieleVerbinding == true) {
dataOphalen();
dataInvullen();
} else {
dataInvullen();
sloten_spinner.setSelection(GeselecteerdSlot);
}
return rootview;
}

public void dataOphalen() {

//ophalen van de services
slotenLijst = new ArrayList<String>();
JSONObject jsonObject = new JSONObject();
try {
jsonObject.put("slotenlijst", "");
} catch (JSONException e) {
e.printStackTrace();
}
String response = null;
try {
try {
// Dit IP adres moet IP adres van server zijn.
response = new Server(serverIp,
serverPort, jsonObject.toString()).execute().get();

} catch (ExecutionException e) {
e.printStackTrace();
}
} catch (InterruptedException e1) {
e1.printStackTrace();
}
if (response == null) {

Toast.makeText(rootview.getContext(), "Kan helaas geen verbinding maken met de server.", Toast.LENGTH_LONG).show();
} else {
// Haal de null naam weg van de JSONArray (Voorkomt error)
String jsonFix = response.replace("null", "");

JSONArray JArray = null;
try {
JArray = new JSONArray(jsonFix);
} catch (JSONException e) {
e.printStackTrace();
}

JSONObject jObject = null;
String value = null;
slotenLijst = new ArrayList<String>();

//zet alle services in een JArray
for (int i = 0; i < JArray.length(); i++) {
try {
jObject = JArray.getJSONObject(i);
} catch (JSONException e) {
e.printStackTrace();
}
try {
value = jObject.getString("Slot");
} catch (JSONException e) {
e.printStackTrace();
}
slotenLijst.add(value);

}
// korte informatie over elke dienst ophalen, in een ArrayList zetten als JSONObjecten
beknopteInformatieSlotlijst = new ArrayList<JSONObject>();
JSONObject beknoptjObject = new JSONObject();
try {
for (int i = 0; i < slotenLijst.size(); i++) {
beknoptjObject.put("Informatiebeknopt", slotenLijst.get(i));
try {
try {
informatieslotbeknopt = new Server(serverIp,
serverPort, beknoptjObject.toString()).execute().get();
//exceptions afvangen
} catch (ExecutionException e) {
e.printStackTrace();
}
} catch (InterruptedException e1) {
e1.printStackTrace();
}
String infoFix = informatieslotbeknopt.replace("null", "");
JSONObject fixedjObject = new JSONObject(infoFix);
beknopteInformatieSlotlijst.add(fixedjObject);

Log.i("Informatiebeknopt", infoFix);
}
} catch (JSONException e) {
e.printStackTrace();
}

//aangeven dat app al eens eerder gedraait heeft
initieleVerbinding = false;

}


// Locate the spinner in activity_main.xml
sloten_spinner = (Spinner) rootview.findViewById(R.id.spinner);

// Spinner adapter

sloten_spinner
.setAdapter(new ArrayAdapter<String>(rootview.getContext(),
android.R.layout.simple_spinner_dropdown_item,
slotenLijst));

// Spinner on item click listener
sloten_spinner
.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {

@Override
public void onItemSelected(AdapterView<?> arg0,
View arg1, int position, long arg3) {
// Locate the textviews in activity_main.xml
TextView beknopteinfoslot = (TextView) rootview.findViewById(R.id.textviewbeknoptinfoslot);

try {
// Set the text followed by the position
beknopteinfoslot.setText(beknopteInformatieSlotlijst.get(position).getString("Informatiebeknopt"));
SlotNaam = slotenLijst.get(position);

} catch (Exception e) {

}

}

@Override
public void onNothingSelected(AdapterView<?> arg0) {
}
});

}

//opgehaalde data in de spinner zetten en beknopte tekst over diensten weergeven
private void dataInvullen() {
// Locate the spinner in activity_main.xml
sloten_spinner = (Spinner) rootview.findViewById(R.id.spinner);

// Spinner adapter
sloten_spinner
.setAdapter(new ArrayAdapter<String>(rootview.getContext(),
android.R.layout.simple_spinner_dropdown_item,
slotenLijst));

// Spinner on item click listener
sloten_spinner
.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {

@Override
public void onItemSelected(AdapterView<?> arg0,
View arg1, int position, long arg3) {
// TODO Auto-generated method stub
// Locate the textviews in activity_main.xml
TextView beknopteinfo = (TextView) rootview.findViewById(R.id.textviewbeknoptinfoslot);

try {
// Set the text followed by the position
beknopteinfo.setText(beknopteInformatieSlotlijst.get(position).getString("informatieslotbeknopt"));
SlotNaam = slotenLijst.get(position);
getActivity().setTitle(SlotNaam);
} catch (Exception e) {

}

}

@Override
public void onNothingSelected(AdapterView<?> arg0) {
// TODO Auto-generated method stub
}
});

//naar servicepagina navigeren en dus informatie ophalen over de geselecteerdePositie
Button infoslotbutton = (Button) rootview.findViewById(R.id.infoslotbutton);
infoslotbutton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
GeselecteerdePositie = sloten_spinner.getSelectedItemPosition();
FragmentManager fragmentManager = getFragmentManager();
fragmentManager.beginTransaction()
.replace(R.id.container, fragmentslotinformatie)
.commit();
}
});

}
}


I have also an Activity where the user can fill in the IP, so that the app can make a connection with the server with the given IP.

I know how I can figure out my own local IP adres, but where should I put the JSON file with the information so that the app can read the JSON data from that file? What I don't mean is a local json file, I mean a JSON file on a local server which can be reached with a IP. Thanks in advance.




As the title suggests, i'd like to print out the data of an SQL database in a listview. Can someone explain to me exactly how to do it ? Thanks in advance !




Hello i want to remove all empty element.. i use code below this, but did not working..



sejarahToken.removeAll(Collections.singleton(""));
sejarahToken.removeAll(Arrays.asList(""));
for (String st : sejarahToken) {
writingFile(st);
}


same as using this code:



sejarahToken.removeAll(Collections.singleton(null));
sejarahToken.removeAll(Arrays.asList(null,""));


here's output the sejarahToken arraylist on txt file.. there are still empty values:



Leonardo
da
Vinci
dari
Italia
dan
Otto
Lilienthal
dari
Jerman
telah
mendahuluinya


Tetapi
ternyata
jauh
sebelumnya
semua
sudah
didahului
oleh
seorang



I'm trying to style the action bar by adding a custom back button on the left and an icon in the center. The rendering in Android Studio is exactly as I want it, but when I test the layout on my phone, it just shows both back button and icon on the left, with the icon on top of the back button. This is my layout file:



<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/action_bar_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content">

<ImageButton android:id="@+id/back_button"
android:contentDescription="Image"
android:src="@drawable/back_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:background="@color/action_bar_bg_color"
android:layout_alignParentLeft="true"/>

<ImageView android:id="@+id/cow_icon"
android:contentDescription="Image"
android:src="@drawable/cowhead"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_centerVertical="true"/>

</RelativeLayout>


And this is what I do to style the action bar:



ActionBar actionBar = getSupportActionBar();
actionBar.setDisplayShowTitleEnabled(false);
View mActionBar = getLayoutInflater().inflate(R.layout.action_bar_layout, null);
actionBar.setCustomView(mActionBar);
actionBar.setDisplayShowCustomEnabled(true);


Anyone see what could be causing the flawed styling of the action bar?




[Android] I have a JSON File that it is composed in this way:



"5":{
"15":{
...
},
"18":{
..
},
"7":{
...
},
"9":{
..
}
}
}


How I can extract the infomation at 15,18,7,9? this number 15, 18 ,7, 9 change from run to another.. My Code is:



JSONObject obj = new JSONObject(file);
JSONArray uno = obj.getJSONArray("5");


and I obtain JSONException!! Anyone can help me?




I'm quite desperate here and can't figure out if there is a bug in my code or if i've done something wrong. My Problem is in reading a database which stores images as Blobs. I have followed tutorials to implement this but something seems broken.


First of i created a databaseHelper class that creates my databases.



@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL("CREATE TABLE " + TBLE_PROFILEIMG + " (" +
FLD_ALLTABLES_UNIQUEPICID + " INTEGER, " +
FLD_ALLTABLES_DELETABLE + " BOOLEAN, " +
FLD_ALLTABLES_PICTURE + " BLOB);");
db.execSQL("CREATE TABLE " + TBLE_EXIMG + " (" +
FLD_EXERCISE_ID + " TEXT, " +
FLD_ALLTABLES_DELETABLE + " BOOLEAN, " +
FLD_ALLTABLES_UNIQUEPICID + " INTEGER, " +
FLD_ALLTABLES_PICTURE + " BLOB);");

}


Then i Created a class to write to the database, There is no problem here and i am sure everything works on spot because i pulled the database from my device and opened it with SQLite Studio. The fields are created correctly and images successfully written as BLOB from an array of bytes.



public List<MyPicture> getProfilePictures() {
Cursor c = readTable(ImgDatabaseHelper.TBLE_PROFILEIMG);
List<MyPicture> bl = new ArrayList<>();
if (c.moveToFirst()) {
while (true) {
int colidx = c.getColumnIndex(ImgDatabaseHelper.FLD_ALLTABLES_PICTURE);
byte[] bb = c.getBlob(colidx);
Bitmap pic = BitmapFactory.decodeByteArray(bb, 0, bb.length);
if (pic != null)
bl.add(
new MyPicture(
pic,
c.getInt(c.getColumnIndex(ImgDatabaseHelper.FLD_ALLTABLES_UNIQUEPICID)),
c.getInt(c.getColumnIndex(ImgDatabaseHelper.FLD_ALLTABLES_DELETABLE)) > 0
)
);

if (c.isLast()) break;
else c.moveToNext();
}
}
return bl;
}


It Can't find the Column:



E/CursorWindow﹕ Failed to read row 0, column 2 from a CursorWindow which has 0 rows, 3 columns.


The Column surely exists because i verified it in sqlite studio. and the column index keeps coming back as null. I am guessing my problem is in the query because the exception says that there are 0 rows when infact i verified that there are 4 rows present. Here is my readTable method:



private Cursor readTable(String table) {
Cursor crs = null;
try {
// Has the same result as the statment under it
// crs = db.query(table, null, null, null, null, null, null, null);
crs = db.rawQuery("SELECT * FROM " + table, null);
}
catch(SQLiteException e) { }
return crs;
}



I m a beginner with android development, and I want to make a test app that allows has a login with Facebook option, I went through all the questions already asked in Stackoverflow and in other websites most of them were outdated and I couldn't grasp the newest ones, so what I m asking for is a step by step tutorial or documentation that teaches that, can anybody help me with that please. And thanks in advance.




I can't make my two custom listviews to fill the available space using the fill_parent value.


This is my custom listview_item layout:



<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content">

<com.github.siyamed.shapeimageview.CircularImageView
android:layout_width="60dp"
android:layout_height="60dp"
android:id="@+id/user"
app:siBorderWidth="0dp"
app:siBorderColor="#ecf0f1"
android:paddingTop="20dp"
android:layout_marginTop="10dp"
android:layout_marginLeft="10dp"
android:adjustViewBounds="false"
android:layout_weight="0.5"
android:layout_gravity="center_horizontal" />

<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/username"
android:gravity="center_vertical|center_horizontal"
android:layout_gravity="center_horizontal"
android:textStyle="bold"
android:layout_marginLeft="10dp"
android:textColor="#222222"
android:layout_marginTop="10dp"
android:layout_weight="0.5" />

<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginTop="5dp"
android:gravity="center_horizontal"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="5dp">

<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:id="@+id/imageView10"
android:background="@drawable/reward_rate" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Text"
android:id="@+id/reward_rate"
android:layout_gravity="center_vertical"
android:layout_marginLeft="2dp" />

<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:id="@+id/imageView11"
android:background="@drawable/reward_addshop"
android:layout_marginLeft="5dp" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Text"
android:id="@+id/reward_addshop"
android:layout_gravity="center_vertical"
android:layout_marginLeft="2dp" />

</LinearLayout>

</LinearLayout>




And this is the layout of the fragment that uses the custom listview:



<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent"
android:descendantFocusability="beforeDescendants"
android:focusableInTouchMode="true"
tools:context="guide_me_for_all.guide_me_for_all.RewardsFragment"
android:background="@drawable/pattern4">

<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/scrollView10" >

<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">

<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content">

<ImageView
android:layout_width="170dp"
android:layout_gravity="center_horizontal"
android:layout_height="160dp"
android:id="@+id/imageView14"
android:background="@drawable/user_rewards"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="15dp" />
</RelativeLayout>

<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:layout_weight="1"
android:layout_marginRight="16dp"
android:layout_marginLeft="16dp"
android:layout_marginBottom="10dp">

<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="0.5">

<TextView
android:id="@+id/textView44"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#ff2a9c86"
android:textStyle="bold"
android:textSize="@dimen/mediumless"
android:text="@string/top_contributors"
android:layout_gravity="center_horizontal"
android:gravity="center_horizontal" />

<ListView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/shop_rewards"
android:layout_gravity="center_horizontal"
android:background="#FFFFFF" />
</LinearLayout>

<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="0.5">

<TextView
android:id="@+id/textView42"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#ff2bab97"
android:textStyle="bold"
android:textSize="@dimen/mediumless"
android:text="@string/top_raters"
android:layout_gravity="center_horizontal"
android:gravity="center_horizontal" />

<ListView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/raters_rewards"
android:layout_gravity="center_horizontal"
android:background="#FFFFFF" />

</LinearLayout>

</LinearLayout>

</LinearLayout>
</ScrollView>
</FrameLayout>




The output from this in the layout is only the first result of the listview.




My Android app uses the wifi, the activation of this WiFi network, FreeWifi, is made on the operator's website.How to call in my app when the network is detected, the page or the interface for the user to enter his identiifiant and password. Thank you for your answers.




I need place three FrameLayouts with height equal to the height of the screen inside scrollView.


This picture shows the problem.



<scrollView>
_____________ ______________
| screen | | |
| | | FL1 |
| | | |
| | | |
| | | |
_____________ ______________
______________
| |
| FL2 |
| |
| |
| |
______________
______________
| |
| FL3 |
| |
| |
| |
______________
</scrollView>


This is my code. I tried to use Relative Layout. Maybe there is solving this Linear Layout. I could not do it.



<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">

<RelativeLayout android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center">

<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/black"
android:id="@+id/frameLayout1"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"/>


<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/background_light"
android:orientation="vertical"
android:layout_below="@+id/frameLayout1"
android:id="@+id/frameLayout2"/>

<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/black"
android:orientation="vertical"
android:layout_below="@+id/frameLayout2"
/>

</RelativeLayout>
</ScrollView>


Framelayouts do not have height equals of screen, how to fix it?




I have an image and store each pixel values in an array called pixels. I then get the first pixel value at location (0,0) and proceed to change only the RED value of the pixel to a specified integer. I then create a new array called encodedPixels which contains the changed value along with all the rest of the values from pixels array.


I create a new bitmap called encodedBitmap and set the encodedPixels onto this bitmap. I then call getPixels at (0,0), it should display the edited value with the changed red value, However it always displays zero and I cant seem to figure out why. Below is how I have created the bitmap



Bitmap encodedBitmap = Bitmap.createBitmap(imageWidth,imageHeight, Bitmap.Config.ARGB_8888);
encodedBitmap.setPixels(encodedPixels,0,imageWidth,0,0,imageWidth,imageHeight);


System.out.println("first pixel at encodedbitmap: " + encodedBitmap.getPixel(0,0));



when i long click the edit text the toolbar was being move down on screenshot 2, how to replace the toolbar with the text editor?


http://imgur.com/a/2hPmA < screenshots




enter image description hereI am updating the expandable list very often with new data, in addition I keep my 1 group open at a time. but when I update the data, the expanded group only shows first child item instead there should be more. I check the childCount and all, which are more then the number of views. The views are there but with not updated values check the img below. It only happens in somecases


here is my code of updating the adapter with new data.



if(!lastGroup.equals("NA")){
ArrayList<property> temp = new ArrayList<property>();
ArrayList<property> temp1 = new ArrayList<property>();
allDataChild = new ConcurrentHashMap<property, ArrayList<property>>();
for(int i = 0; i < data.size(); i++){
for (Map.Entry<property, ArrayList<property>> map : expanHash.entrySet()) {
if (data.size() > 0)
{
if (map.getKey().equals(data.get(i)))
{
if(data.get(i).type.equals(lastGroup))
{
temp.add(data.get(i));
temp1.addAll(removeDuplicates(map.getValue(), data.get(i).type));
}
}
}
}
}
for(int j = 0; j < temp1.size(); j++) {
if (temp1 != null && temp1.size() > 0)
Log.d(TAG, "map.value " + temp1.get(j).ssid);
}
allDataChild.put(temp.get(0), temp1);
info_panel = new ![ListAdapter][2](this, temp, allDataChild, false);
list.setAdapter(info_panel);
info_panel.notifyDataSetChanged();


any hints




I really need help here. I have project which call MyHeartRate, I downloaded the source code of heart rate project at Github. So I try to run that source code and there is nothing error. In the interface layout, it display the "camera". Example, when you open your camera then you will see the screen focus on what area that you want to take the picture. So my problem is, I want to remove that "camera" in my layout. I need to know which code need to be delete so then the "camera" not in my layout.


here's my code


xml file



<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/layout">
<LinearLayout android:id="@+id/top"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="50dp">
<TextView android:id="@+id/text"
android:text="@string/default_text"
android:textSize="32dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</TextView>
<RelativeLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<com.jwetherell.heart_rate_monitor.HeartbeatView android:id="@+id/image"
android:layout_centerInParent="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</com.jwetherell.heart_rate_monitor.HeartbeatView>
</RelativeLayout>
</LinearLayout>
<SurfaceView android:id="@+id/preview"
android:layout_weight="1"
android:layout_width="fill_parent"
android:layout_height="0dp">
</SurfaceView>


java file(HeartRateMonitor)



public class HeartRateMonitor extends Activity {

private static final String TAG = "HeartRateMonitor";
private static final AtomicBoolean processing = new AtomicBoolean(false);

private static SurfaceView preview = null;
private static SurfaceHolder previewHolder = null;
private static Camera camera = null;
private static View image = null;
private static TextView text = null;

private static WakeLock wakeLock = null;

private static int averageIndex = 0;
private static final int averageArraySize = 4;
private static final int[] averageArray = new int[averageArraySize];

public static enum TYPE {
GREEN, RED
};

private static TYPE currentType = TYPE.GREEN;

public static TYPE getCurrent() {
return currentType;
}

private static int beatsIndex = 0;
private static final int beatsArraySize = 3;
private static final int[] beatsArray = new int[beatsArraySize];
private static double beats = 0;
private static long startTime = 0;

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);

preview = (SurfaceView) findViewById(R.id.preview);
previewHolder = preview.getHolder();
previewHolder.addCallback(surfaceCallback);
previewHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);

image = findViewById(R.id.image);
text = (TextView) findViewById(R.id.text);

PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
wakeLock = pm.newWakeLock(PowerManager.FULL_WAKE_LOCK, "DoNotDimScreen");
}


@Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); }



@Override
public void onResume() {
super.onResume();

wakeLock.acquire();

camera = Camera.open();

startTime = System.currentTimeMillis();
}

@Override
public void onPause() {
super.onPause();

wakeLock.release();

camera.setPreviewCallback(null);
camera.stopPreview();
camera.release();
camera = null;
}

private static PreviewCallback previewCallback = new PreviewCallback() {

@Override
public void onPreviewFrame(byte[] data, Camera cam) {
if (data == null) throw new NullPointerException();
Camera.Size size = cam.getParameters().getPreviewSize();
if (size == null) throw new NullPointerException();

if (!processing.compareAndSet(false, true)) return;

int width = size.width;
int height = size.height;

int imgAvg = ImageProcessing.decodeYUV420SPtoRedAvg(data.clone(), height, width);
// Log.i(TAG, "imgAvg="+imgAvg);
if (imgAvg == 0 || imgAvg == 255) {
processing.set(false);
return;
}

int averageArrayAvg = 0;
int averageArrayCnt = 0;
for (int i = 0; i < averageArray.length; i++) {
if (averageArray[i] > 0) {
averageArrayAvg += averageArray[i];
averageArrayCnt++;
}
}

int rollingAverage = (averageArrayCnt > 0) ? (averageArrayAvg / averageArrayCnt) : 0;
TYPE newType = currentType;
if (imgAvg < rollingAverage) {
newType = TYPE.RED;
if (newType != currentType) {
beats++;
// Log.d(TAG, "BEAT!! beats="+beats);
}
} else if (imgAvg > rollingAverage) {
newType = TYPE.GREEN;
}

if (averageIndex == averageArraySize) averageIndex = 0;
averageArray[averageIndex] = imgAvg;
averageIndex++;

// Transitioned from one state to another to the same
if (newType != currentType) {
currentType = newType;
image.postInvalidate();
}

long endTime = System.currentTimeMillis();
double totalTimeInSecs = (endTime - startTime) / 1000d;
if (totalTimeInSecs >= 10) {
double bps = (beats / totalTimeInSecs);
int dpm = (int) (bps * 60d);
if (dpm < 30 || dpm > 180) {
startTime = System.currentTimeMillis();
beats = 0;
processing.set(false);
return;
}

// Log.d(TAG,
// "totalTimeInSecs="+totalTimeInSecs+" beats="+beats);

if (beatsIndex == beatsArraySize) beatsIndex = 0;
beatsArray[beatsIndex] = dpm;
beatsIndex++;

int beatsArrayAvg = 0;
int beatsArrayCnt = 0;
for (int i = 0; i < beatsArray.length; i++) {
if (beatsArray[i] > 0) {
beatsArrayAvg += beatsArray[i];
beatsArrayCnt++;
}
}
int beatsAvg = (beatsArrayAvg / beatsArrayCnt);
text.setText(String.valueOf(beatsAvg));
startTime = System.currentTimeMillis();
beats = 0;
}
processing.set(false);
}
};

private static SurfaceHolder.Callback surfaceCallback = new SurfaceHolder.Callback() {

@Override
public void surfaceCreated(SurfaceHolder holder) {
try {
camera.setPreviewDisplay(previewHolder);
camera.setPreviewCallback(previewCallback);
} catch (Throwable t) {
Log.e("PreviewDemo-surfaceCallback", "Exception in setPreviewDisplay()", t);
}
}

@Override
public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
Camera.Parameters parameters = camera.getParameters();
parameters.setFlashMode(Camera.Parameters.FLASH_MODE_TORCH);
Camera.Size size = getSmallestPreviewSize(width, height, parameters);
if (size != null) {
parameters.setPreviewSize(size.width, size.height);
Log.d(TAG, "Using width=" + size.width + " height=" + size.height);
}
camera.setParameters(parameters);
camera.startPreview();
}

@Override
public void surfaceDestroyed(SurfaceHolder holder) {
// Ignore
}
};

private static Camera.Size getSmallestPreviewSize(int width, int height, Camera.Parameters parameters) {
Camera.Size result = null;

for (Camera.Size size : parameters.getSupportedPreviewSizes()) {
if (size.width <= width && size.height <= height) {
if (result == null) {
result = size;
} else {
int resultArea = result.width * result.height;
int newArea = size.width * size.height;

if (newArea < resultArea) result = size;
}
}
}

return result;
}


}


tq, faizal




I'm trying to upload a file on an android phone using HTML5 and Javascript. Everything works perfectly except the phone asks the user to select an app to find the file. Is there a way to skip the app selection, and force the user to select a file from the Chrome Downloads directory?


Additional Info: I am able to skip the app selection when the user downloads the file by using "data:application/octet-stream;Content-Disposition:attachment". Is there something similar for uploading a file?




I'm working on the custom ListView. I have a problem when changing the dividers height (Just a View with background color black not listview's default divider). Video: https://www.youtube.com/watch?v=uCCe_LzxFEk


The divider's height is based on overscroll delta. This is the code for changing divider's height. Code works well when dragging from top to bottom but it is very jumpy when dragging from bottom to top.



public void changeDividerHeight(View view, int delta) {
if (Math.abs(delta) > getResources().getDimensionPixelSize(R.dimen.one_dip)) {
ViewGroup.LayoutParams params = view.getLayoutParams();
params.height = Math.abs(delta);
view.requestLayout();
requestLayout();
}
}



I am new to Android. I have four states like: driving, onDuty, offDuty and sleep. When I click on the driving button Automatically Time Updates in the Textview. It's working fine for me. Here is my code:



btnDriving.setonClickListener(new View.onClickListener)
{
private void UpdatingDrvingCircle() {
new Thread() {
@Override
public void run() {
try {
while (!isInterrupted()) {
Thread.sleep(1000);

if(getActivity() == null)
return;
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
updateDrivingTextView();
}
});
}
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}.start();
}
}

private void updateDutyTextView(){

final DateTime dt=DateTime.now() ;
String pattern = " KK:mm:ss";
DateTimeFormatter fmt;
fmt=DateTimeFormat.forPattern(pattern);
DateTime et=DateTime.now();
fmt=DateTimeFormat.forPattern(pattern);
String sTime=dt.toString(fmt);
String eTime=et.toString(fmt);

DateTime d1 = fmt.parseDateTime(sTime);
DateTime d2 = fmt.parseDateTime(eTime);

DateTime dt1 = new DateTime(d1);
DateTime dt2 = new DateTime(d2);
int hours=Hours.hoursBetween(dt1, dt2).getHours() % 24;
int minutes=Minutes.minutesBetween(dt1, dt2).getMinutes() % 60;
int LeftHours=AppConstants.DRIVING_11_HOUR-hours;
int LeftMins=AppConstants.DRIVING_MINUTE-minutes;
tvDutyTimeLeft.setText(LeftHours+" hr "+LeftMins+" m left");

}


Here I have one More Button i.e..btnOnDuty. When I click on that Button the Previous Button Text View Updates are stopped. Could anyone help me figure out why?


Here is btnDuty Code



btnOnDuty.setonClickListener()
{
UpdatingDutyCircle();
}
private void UpdatingDutyCircle() {
Thread t=new Thread() {
@Override
public void run() {
try {
while (!isInterrupted()) {
Thread.sleep(1000);
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
updateDutyTextView();
}
});
}
} catch (InterruptedException e) {
e.printStackTrace();
}


}
};t.start();
}

private void updateDutyTextView() {

fmt=DateTimeFormat.forPattern(pattern);
DateTime et=DateTime.now();
fmt=DateTimeFormat.forPattern(pattern);
String sTime=dt.toString(fmt);
String eTime=et.toString(fmt);

DateTime d1 = fmt.parseDateTime(sTime);
DateTime d2 = fmt.parseDateTime(eTime);

DateTime dt1 = new DateTime(d1);
DateTime dt2 = new DateTime(d2);
int hours=Hours.hoursBetween(dt1, dt2).getHours() % 24;
int minutes=Minutes.minutesBetween(dt1, dt2).getMinutes() % 60;
int LeftHours=AppConstants.DRIVING_14_HOUR-hours;
int LeftMins=AppConstants.DRIVING_MINUTE-minutes;

int TotalHrs=hours*60+minutes;
btnOnDuty.setText(""+hours+"hr "+ minutes +"m");
pbOnDuty.setMax(660);
pbOnDuty.setProgress(TotalHrs);
tvDutyTimeLeft.setText(LeftHours+" hr "+LeftMins+" m left");
}



I have published an android app in Google PlayStore but whenever I try to install it form any device the PlayStore shows "sign in to your Google account" message. pleas help me, I don't know what to do.




It gets connected, I can get the latitude and the longitude of the coordinate, but when I do the following code, speed = 0, why can't it take the speed from the location?



@Override
public void onLocationChanged(final Location location) {

Log.i("","geof is s onLocationChanged ENTERED");
if (LocationServices.FusedLocationApi.getLastLocation(mLocationClient) != null) {

locEnd = LocationServices.FusedLocationApi.getLastLocation(mLocationClient);
Log.i("","geof is s speed of locend:" + LocationServices.FusedLocationApi.getLastLocation(mLocationClient).getSpeed());
}
}


This will always be my response:



03-31 17:43:57.227 31463-31463/nl.hgrams.passenger I/﹕ geof is s speed of locend:0.0


And this are my permissions:



<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.LOCATION_HARDWARE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_GPS" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="nl.hgrams.passenger.C2D_MESSAGE" />



I am constructing an SQLite database to store data on chess games for my multiplayer android chess app. I will eventually create a MySQL remote database for networking purposes so keep that in mind.


Given that thousands of users (hopefully) will be playing thousands of games in total, should I have a table per user? But I'd like to store games between two people in one place so shouldn't I have 1 table per game?


Also, I'd like to have a record of the moves in each game so would it make sense, if we're going with the one game one table model, to have each row correspond to the state of the board following a given move?


I'm a complete newcomer to coding in general and SQL databases in particular. Does my overall strategy seem reasonable?




I am building an app to get some information from internet,so I decided to use httppost,but now I find a problem.I have gotten right cookies form service,then I know I need to post cookies as header,and this is its form data: __EVENTTARGET:"xxm_1" __EVENTARGUEMENT: __VIEWSTATE:... xxms:"%B1%ED%B8%F1" xnd:"2014-2015" xqd:"2%7C%B4%BA%A1%A2%CF%C4" kcxx: so I tried to post a list paramsSchedu: paramsSchedu.add(new BasicNameValuePair("__EVENTTARGET", "xxms_1")); paramsSchedu.add(new BasicNameValuePair("__EVENTARGUMENT","")); paramsSchedu.add(new BasicNameValuePair("xxms","%B1%ED%B8%F1")); paramsSchedu.add(new BasicNameValuePair("xnd","2014-2015")); paramsSchedu.add(new BasicNameValuePair("xqd","2%7C%B4%BA%A1%A2%CF%C4")); paramsSchedu.add(new BasicNameValuePair("kcxx","")); But I didn't get right response,even I added "__VIEWSTATE" to my param. But I found another information in header:"Query String Parameter" like this: xh:3140104045 xn:2014-2015 xq:2 So I guess I should add this to header or param,but I don't know how to do this,so...could you please help me to deal with this problem?