Wednesday, August 7, 2013

[General] Please help...


Please help...



Hello.

I've had my Samsung galaxy s2 for almost two years. It has worked smothly until yesterday. It flashes, and it's almost like a second operator system is trying to take over. My menu screen have a picture and a watch, and then it changes to a blue background...and it continues to flash back and forth for many minutes. It doesn't help to force it into resting mode or to turn of the screen...it just starts with the flashing. Sometimes it starts itself after I have turned it off.

It behaves like this no matter what I do. calls, sms, calendar, music player....

I have tried to update it several times. Turned it off and let it rest. Taken out the battery. Deleted several apps...

Anyone know what the problem is?



Read more

forum.xda-developers.com



[General] Can't move photos from Samsung Galaxy Q to computer =(


Can't move photos from Samsung Galaxy Q to computer =(



I have the USB connected but it only recognizes it as a charger, nothing comes up on the notification bar, and there is nothing else to indicate there is even a connection besides the fact that the phone is charging.



Read more

forum.xda-developers.com



[General] Google now voice action shortcut


Google now voice action shortcut



Id like to make greater use of Google now's voice action feature, and was wondering if there was a way to set it as a shortcut. Right now I have the default google search app where I can click on the mic and it goes to it, but I was wondering if there was a 1x1 tile app that can do the same thing, and can be added to the launcher, or as a lock screen widget. (wait I dont have 4.2.2. Damn it) Im trying out Open Mic+ right now, but "listen while screen is off" plumets battery life, and I have to actually unlock the phone to get anything done with it turned off.



Read more

forum.xda-developers.com



[General] Client application terminated after connecting


Client application terminated after connecting



I have written an app to connect to server but once i connect my client app terminates and i have include socket creation and communication as part of onCreate i am using 4.0.4,
can somebody help me to solve this



Read more

forum.xda-developers.com



[General] how do i switch to another android phone and keep my text messages? Please help.


how do i switch to another android phone and keep my text messages? Please help.



my phone (lg vortex) is malfunctioning terribly, it's about two years old and it's about time i get something new. there's only one thing stopping me. i want to be able to keep my text messages, at least the text messages from one specific contact. so are there any trustworthy apps or anything where i could switch them over to a new device??

please tell me how i would go about doing this. it doesn't have to be free. i just want to keep my messages, and be able to restore them to the new phone somehow.

thank you so much. someone please respond. i've tried asking things on the forums before and NO ONE ever answers me.



Read more

forum.xda-developers.com



[android help] Appcelerator tableView font color


Appcelerator tableView font color



How can you set the color of the font for the rows in tableView?


I DO NOT want to set it row by row like this:



var table_data = [
{title:'Row 1', color: 'black'},
];


I have tried adding font:{colour:'black'} to the table var but it does not seem to work. Like this:



var table1 = Titanium.UI.createTableView({
data:table_data,
separatorColor:'black',
font:{color:'black'}
});


I want to be able to set it so any row in the table has a set color. Specifically as I will be adding items to the table and I want them to be 'black' not the default white/grey. So when I add new items they will be black...


I am sure this is simple but I cant seem to find anything that is assisting me hence the question here


Thanks in advance.



Read more

stackoverflow.comm



[android help] Android: Custom notification appearance issue


Android: Custom notification appearance issue



I am using MediaPlayer in my app. I am adding an Ongoing Notification with media player controls (such as previous, next and stop buttons) in my app, so that users don't have to go in the app to access those controls. It looks fine on platforms 4.x. Here is the screenshot of the notification on Android 4.2.2.


Notification on Android 4.2.2


But, on Android 2.2, it looks like this:


Notification on Android 2.2


My code is as follows:



private Notification generateNotification() {
Log.d(TAG, "generateNotification called");

Intent actionIntent = new Intent(getApplicationContext(),
AartiActivity.class);
PendingIntent pi = PendingIntent.getActivity(getApplicationContext(),
0, actionIntent, PendingIntent.FLAG_UPDATE_CURRENT);
RemoteViews mNotificationView = new RemoteViews(getPackageName(),
R.layout.notification_view);
NotificationCompat.Builder builder = new NotificationCompat.Builder(
getApplicationContext());
builder.setSmallIcon(R.drawable.icon);
builder.setContent(mNotificationView);
builder.setOngoing(true);
builder.setTicker("Aarti Sangrah");
builder.setContentIntent(pi);
mNotificationView.setImageViewResource(R.id.imgAppIc, R.drawable.icon);
mNotificationView.setTextViewText(R.id.txtAartiPlaying, mediaName);

return builder.build();
}// generateNotification


And then, I called startForeground(1, generateNotification()); in onPrepared().


The Remote Views is available since API level 1. And, it is well supported also. I read somewhere, it was not supported prior to Honeycomb. But, on several devices having Android 2.x, this feature is available. Also, in order to check this, I looked at the source code of Music Player of Android 2.2 from here.


Here, is the snippet from its Music Player Service.



RemoteViews views = new RemoteViews(getPackageName(),
R.layout.statusbar);
views.setOnClickPendingIntent(R.id.btnTest, PendingIntent
.getActivity(getApplicationContext(), 0,
new Intent(getApplicationContext(),
MusicBrowserActivity.class),
PendingIntent.FLAG_UPDATE_CURRENT));
views.setImageViewResource(R.id.icon,
R.drawable.stat_notify_musicplayer);
if (getAudioId() < 0) {
// streaming
views.setTextViewText(R.id.trackname, getPath());
views.setTextViewText(R.id.artistalbum, null);
} else {
String artist = getArtistName();
views.setTextViewText(R.id.trackname, getTrackName());
if (artist == null || artist.equals(MediaStore.UNKNOWN_STRING)) {
artist = getString(R.string.unknown_artist_name);
}
String album = getAlbumName();
if (album == null || album.equals(MediaStore.UNKNOWN_STRING)) {
album = getString(R.string.unknown_album_name);
}

views.setTextViewText(
R.id.artistalbum,
getString(R.string.notification_artist_album, artist,
album));
}

Notification status = new Notification();
status.contentView = views;
status.flags |= Notification.FLAG_ONGOING_EVENT;
status.icon = R.drawable.stat_notify_musicplayer;
status.contentIntent = PendingIntent.getActivity(this, 0,
new Intent("com.android.music.PLAYBACK_VIEWER")
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK), 0);
startForeground(PLAYBACKSERVICE_STATUS, status);


The Remote Views has been used in this code. It had two TextViews. I modified the code by adding a button to it, and also performed action on button click. Everything worked fine on every platform.


Same thing, I want with my application. But, on 2.2, it looks as I had shown above in the screenshot. I thought it is because of white colors text and button so tried changing the colors of button and text, but no luck. As far as I understand, only thing I figured out is remote view is not inflated on Android 2.2 (in my case). I am not getting why notification is not appearing properly on Android 2.x platforms.



Read more

stackoverflow.comm



[android help] problems with android scanner code in LG escape mobile


problems with android scanner code in LG escape mobile


problems with android scanner code in LG escape mobile - Stack Overflow







Tell me more ×

Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

















I made an application which will scan several bar codes. If i click on 1st button it capture code and return result from prgram,but for 2nd button it doesn't return back to my program. Mobile is LG escape. In other tab(HTC) or other mobile (Samsung) it works fine.
















Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.










default






Read more

stackoverflow.comm



[android help] Android Studio vs Eclipse IDE


Android Studio vs Eclipse IDE


Android Studio vs Eclipse IDE - Stack Overflow







Tell me more ×

Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

















I am new to android and I started development on Eclipse but it is creating lot of issues as Emulator is taking lot of time to start and in between it hangs aswell.


Just now learnt there is another tool "Android Studio". Can I use android studie instead of eclipse? are there any performance issues with android studio.


Please anyone suggest me to clear the confusion. I am ready to shift to android studio if it is more user friendly than eclipse.


Thanks Siva


























There is a lot of info on both if you googled it. But the only way you'll know for sure is if you try it yourself and see what's better for you. The emulator though will be the same for both platforms, so if the emulator is what's bugging you there won't be any improvement. Also remember that Android Studio is still only in preview so there are lots of bugs that are being resolved every day.




















default






Read more

stackoverflow.comm



[android help] Android webserver shows html pages as text


Android webserver shows html pages as text



I am developing a android app which turns the android device into a multithreaded web server the code which i use do not have any error but runs fine and it can be seen through web browser but it shows the source of html file as text rather than full gui.


this is my code..


Jhtts class:



package dolphin.developers.com;

import java.io.File;
import java.io.IOException;
import java.net.InetAddress;

import android.app.Activity;
import android.os.Bundle;
import android.os.Environment;
import android.util.Log;
import android.widget.Toast;
import dolphin.devlopers.com.R;

public class JHTTS extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {

// TODO Auto-generated method stub

super.onCreate(savedInstanceState);

setContentView(R.layout.server);

try {

String IndexFileName = "index.htm";
File documentRootDirectory = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + "/");
JHTTP j = new JHTTP(documentRootDirectory, 9001, IndexFileName);
j.start();

Toast.makeText(getApplicationContext(), "Phishing Server Started!!", 5).show();
Log.d("Server Rooot", "" + documentRootDirectory);

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

}
}
}


Jhttp class:



package dolphin.developers.com;

import java.io.File;
import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
import java.net.SocketException;

public class JHTTP extends Thread {

private File documentRootDirectory;
private String indexFileName = "index.htm";
private ServerSocket server;
private int numThreads = 50;

public JHTTP(File documentRootDirectory, int port, String indexFileName) throws IOException {

if (!documentRootDirectory.isDirectory()) {

throw new IOException(documentRootDirectory

+ " does not exist as a directory");
}

this.documentRootDirectory = documentRootDirectory;
this.indexFileName = indexFileName;
this.server = new ServerSocket(port);
}

public JHTTP(File documentRootDirectory, int port) throws IOException {
this(documentRootDirectory, port, "index.htm");
}

public JHTTP(File documentRootDirectory) throws IOException {
this(documentRootDirectory, 9001, "index.htm");
}

public void run() {
for (int i = 0; i < numThreads; i++) {
Thread t = new Thread(new RequestProcessor(documentRootDirectory, indexFileName));
t.start();
}
System.out.println("Accepting connections on port " + server.getLocalPort());
System.out.println("Document Root: " + documentRootDirectory);

while (true) {
try {
Socket request = server.accept();

request.setReuseAddress(true);
RequestProcessor.processRequest(request);

} catch (SocketException ex) {

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


RequestProcessor:



package dolphin.developers.com;

import java.net.*;
import java.io.*;
import java.util.*;


public class RequestProcessor implements Runnable {

@SuppressWarnings("rawtypes")
private static List pool = new LinkedList( );

private File documentRootDirectory;

private String indexFileName = "index.htm";

public RequestProcessor(File documentRootDirectory,

String indexFileName) {


if (documentRootDirectory.isFile( )) {

throw new IllegalArgumentException(

"documentRootDirectory must be a directory, not a file");

}

this.documentRootDirectory = documentRootDirectory;

try {

this.documentRootDirectory

= documentRootDirectory.getCanonicalFile( );

}


catch (IOException ex) {

}

if (indexFileName != null) this.indexFileName = indexFileName;

}


@SuppressWarnings("unchecked")
public static void processRequest(Socket request) {
synchronized (pool) {
pool.add(pool.size( ), request);
pool.notifyAll( );

}

}

public void run( ) {
// for security checks

String root = documentRootDirectory.getPath( );
while (true) {
Socket connection;

synchronized (pool) {

while (pool.isEmpty( )) {

try {

pool.wait( );
}



catch (InterruptedException ex) {


}

}


connection = (Socket) pool.remove(0);

}

try {


String filename;

String contentType;

OutputStream raw = new BufferedOutputStream(

connection.getOutputStream( )


);


Writer out = new OutputStreamWriter(raw);




Reader in = new InputStreamReader(

new BufferedInputStream(

connection.getInputStream( )

),"ASCII"

);


StringBuffer requestLine = new StringBuffer( );

int c;

while (true) {

c = in.read( );
if (c == '\r' || c == '\n') break;
requestLine.append((char) c);

}

String get = requestLine.toString( );
// log the request

System.out.println(get);

StringTokenizer st = new StringTokenizer(get);

String method = st.nextToken( );

String version = "";

if (method.equals("GET")) {

filename = st.nextToken( );

if (filename.endsWith("/")) filename += indexFileName;

contentType = guessContentTypeFromName(filename);

if (st.hasMoreTokens( )) {

version = st.nextToken( );
}
File theFile = new File(documentRootDirectory,
filename.substring(1,filename.length( )));
if (theFile.canRead( )
// Don't let clients outside the document root
&& theFile.getCanonicalPath( ).startsWith(root)) {

DataInputStream fis = new DataInputStream(

new BufferedInputStream(

new FileInputStream(theFile)
)

);
byte[] theData = new byte[(int) theFile.length( )];
fis.readFully(theData);
fis.close( );
if (version.startsWith("HTTP ")) { // send a MIME header

out.write("HTTP/1.0 200 OK\r\n");


Date now = new Date( );
out.write("Date: " + now + "\r\n");
out.write("Server: JHTTP/1.0\r\n");
out.write("Content-length: " + theData.length + "\r\n");
out.write("Content-type: " + contentType + "\r\n\r\n");
out.flush( );

} // end if
// send the file; it may be an image or other binary data
// so use the underlying output stream
// instead of the writer
raw.write(theData);
raw.flush( );

} // end if

else { // can't find the file

if (version.startsWith("HTTP ")) { // send a MIME header

out.write("HTTP/1.0 404 File Not Found\r\n");

Date now = new Date( );

out.write("Date: " + now + "\r\n");

out.write("Server: JHTTP/1.0\r\n");

out.write("Content-type: text/html\r\n\r\n");

}

out.write("\r\n");
out.write("File Not Found\r\n");
out.write("\r\n");
out.write("");

out.write("

HTTP Error 404: File Not Found

\r\n");
out.write("\r\n");
out.flush( );

}

}

else { // method does not equal "GET"

if (version.startsWith("HTTP ")) { // send a MIME header

out.write("HTTP/1.0 501 Not Implemented\r\n");

Date now = new Date( );

out.write("Date: " + now + "\r\n");

out.write("Server: JHTTP 1.0\r\n");

out.write("Content-type: text/html\r\n\r\n");

}

out.write("\r\n");
out.write("Not Implemented\r\n");
out.write("\r\n");
out.write("");
out.write("

HTTP Error 501: Not Implemented

\r\n");

out.write("\r\n");

out.flush( );

}

}

catch (IOException ex) {

}

finally {

try {

connection.close( );

}

catch (IOException ex) {}

}
} // end while

} // end run

public static String guessContentTypeFromName(String name) {

if (name.endsWith(".html") || name.endsWith(".htm")) {

return "text/html";

}

else if (name.endsWith(".txt") || name.endsWith(".java")) {

return "text/plain";


}


else if (name.endsWith(".gif")) {

return "image/gif";

}

else if (name.endsWith(".class")) {

return "application/octet-stream";

}


else if (name.endsWith(".jpg") || name.endsWith(".jpeg")) {


return "image/jpeg";

}

else if (name.endsWith(".png") ) {


return "image/png";

}

else if (name.endsWith(".js")) {


return "text/javascript";

}

else if (name.endsWith(".js")) {


return "text/javascript";

}

else if (name.endsWith(".css")) {


return "text/css";

}

else return "text/plain";

}


} // end RequestProcessor


Please Help...



Read more

stackoverflow.comm



[android help] Clear Image in the Imageview


Clear Image in the Imageview



I went through many threads but i could not get the answer yet .


I am setting an image to the imageView programmatically as



imageview.setBackgroundResource(R.Drawable.image);


if i set image as the above , will the image get cleared if i give



imageview,setImageDrawable(null) ;


what does imageview.setBackgroundDrawable(null) meant ?


What is the difference between



imageview,setImageDrawable(null) ;


and



imageview,setImageBitmap(null) ;


and



imageview.setBackgroundDrawable(null);


Read more

stackoverflow.comm



Google Voice on T-Mobile? [General]

Google Voice on T-Mobile? So I recently switched from a GNex on Verizon to a Moto X DE on T-Mobile. I had always used Google Voice for my v...