Monday, May 6, 2013

[android help] Why getApplicationContext() in constructor of Activity throws null pointer exception?

android - Why getApplicationContext() in constructor of Activity throws null pointer exception? - 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.

















After some time spent bug hunting it turns out that :



public class MainActivity extends BaseActivity { // BaseActivity extends Activity

public MainActivity() {
super();
getApplicationContext(); // NPE here
}
}


Why ? Where is this documented ?
Froyo


























Wait for the end of onCreate to call this method.



public class MainActivity extends BaseActivity {

public onCreate(Bundle savedInstanceState) {
super(savedInstanceState);
getApplicationContext(); //activity has a context now
}
}

























Just to get a feeling of what's going on. Activity extends ContextThemeWrapper which extends ContextWrapper from whom Activity inherits getApplicationContext(). ContextWraper implements it as :



@Override
public Context getApplicationContext() {
return mBase.getApplicationContext(); // mBase is a Context
}


The only public constructor of ContextWrapper is :



public ContextWrapper(Context base) {
mBase = base;
}


in ContextThemeWrapper we have :



public ContextThemeWrapper() {
super(null);
}


and since Activity does not define an explicit constructor the constructor above is called - mBase == null in Activity's constructor - boom.


Links from 4.2.2_r1




















default






.

stackoverflow.comm

[android help] Android ScaleAnimation and TranslateAnimation, how to avoid ScaleAnimation movement


I have an AnimationSet with inside a ScaleAnimation and a TranslateAnimation like this:


TranslateAnimation:



TranslateAnimation goTopFromRight =
new TranslateAnimation(0, -(right.getLeft()-top.getLeft()),
0,-(right.getTop()-top.getTop()));


ScaleAnimation:



ScaleAnimation = setSizeForTop = new ScaleAnimation(1, 2, 1, 2);


and AnimationSet:



bringToLeftFromTopAnimationSet = new AnimationSet(true);
bringToTopFromRightAnimationSet.addAnimation(goTopFromRight);
bringToTopFromRightAnimationSet.addAnimation(setSizeForTop);


The problem is that when i try to use only the ScaleAnimation, my item goes to the position i want, but whe I am using the ScaleAnimation with the TranslateAnimation in the AnimationSet, my item translates more than i need, as if ScaleAnimation introduces some supplementary movements abd I don't know how to delete them.


Thank you for your help.



.

stackoverflow.comm

[android help] Trigger.io: File Access - Getting total Counts of Images in my Gallery (iPhone/Androi)


Is there any way to get the total counts of Pictures in my Gallery. We need to preview the total counts in my gallery. We can't find what API method to be used for it.


For example,


My Gallery - 30 Photos


I hope someone from trigger.io can clarify this one. Thanks!!!



.

stackoverflow.comm

[android help] Why does my application force close when getting and parsing JSON data?


First off, I'm a noob. I'm probably not handling the AsyncTask properly, but that's why I'm here!


I'm trying to make an activity that gets, parses, and displays values from JSON data. For now I'm using Twitter as a placeholder, but I'm going to use Youtube's GData. I really don't know much about Android's JSON library, or Async Task, so those are the first places I looked for problems. I couldn't find any myself.


NOTE: I do have internet access permissions in the manifest.


This is my class for the activity.



public class MainActivity extends ListActivity {

List videos;

@Override
protected void onCreate(Bundle savedInstanceState) {
videos = new ArrayList();
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

new LoadVideos().execute("http://twitter.com/statuses/user_timeline/zacpac2020.json");
}

private class LoadVideos extends AsyncTask {

@Override
protected String doInBackground(String... params) {
final ListView listview = (ListView) findViewById(R.id.listview);

StringBuilder builder = new StringBuilder();
HttpClient client = new DefaultHttpClient();
HttpGet httpGet = new HttpGet(params[0]);
try {
HttpResponse response = client.execute(httpGet);
StatusLine statusLine = response.getStatusLine();
int statusCode = statusLine.getStatusCode();
if (statusCode == 200) {
HttpEntity entity = response.getEntity();
InputStream content = entity.getContent();
BufferedReader reader = new BufferedReader(new InputStreamReader(content));
String line;
while ((line = reader.readLine()) != null) {
builder.append(line);
}
} else {
Log.e("JSON Parsing", "Failed to download the JSON file.");
System.err.println("Failed to download JSON file.");
}
} catch (ClientProtocolException e) {
e.printStackTrace();
System.err.println("ClientProtocolException in LoadVideos");
} catch (IOException e) {
e.printStackTrace();
System.err.println("ClientProtocolException in LoadVideos");
}

String data = builder.toString();
try {
JSONArray jsonArray = new JSONArray(data);
Log.i("Parse JSON",
"Number of entries: " + jsonArray.length());
for (int i = 0; i < jsonArray.length(); i++) {
JSONObject jsonObject = jsonArray.getJSONObject(i);
videos.add(jsonObject.toString());
}
} catch(Exception e) {
e.printStackTrace();
}

final ArrayAdapter arrayAdapter =
new ArrayAdapter(MainActivity.this,android.R.layout.simple_list_item_1, videos);
listview.setAdapter(arrayAdapter);

return "All Done!";
}
}

}


The LogCat Output



05-05 18:29:10.192: D/dalvikvm(11237): Debugger has detached; object registry had 1 entries
05-05 20:25:26.066: D/AndroidRuntime(15976): Shutting down VM
05-05 20:25:26.066: W/dalvikvm(15976): threadid=1: thread exiting with uncaught exception (group=0x41640930)
05-05 20:25:26.073: E/AndroidRuntime(15976): FATAL EXCEPTION: main
05-05 20:25:26.073: E/AndroidRuntime(15976): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.aer.biblealive/com.aer.biblealive.MainActivity}: android.os.NetworkOnMainThreadException
05-05 20:25:26.073: E/AndroidRuntime(15976): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2308)
05-05 20:25:26.073: E/AndroidRuntime(15976): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2358)
05-05 20:25:26.073: E/AndroidRuntime(15976): at android.app.ActivityThread.access$600(ActivityThread.java:154)
05-05 20:25:26.073: E/AndroidRuntime(15976): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1248)
05-05 20:25:26.073: E/AndroidRuntime(15976): at android.os.Handler.dispatchMessage(Handler.java:99)
05-05 20:25:26.073: E/AndroidRuntime(15976): at android.os.Looper.loop(Looper.java:137)
05-05 20:25:26.073: E/AndroidRuntime(15976): at android.app.ActivityThread.main(ActivityThread.java:5235)
05-05 20:25:26.073: E/AndroidRuntime(15976): at java.lang.reflect.Method.invokeNative(Native Method)
05-05 20:25:26.073: E/AndroidRuntime(15976): at java.lang.reflect.Method.invoke(Method.java:511)
05-05 20:25:26.073: E/AndroidRuntime(15976): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:795)
05-05 20:25:26.073: E/AndroidRuntime(15976): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:562)
05-05 20:25:26.073: E/AndroidRuntime(15976): at dalvik.system.NativeStart.main(Native Method)
05-05 20:25:26.073: E/AndroidRuntime(15976): Caused by: android.os.NetworkOnMainThreadException
05-05 20:25:26.073: E/AndroidRuntime(15976): at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1117)
05-05 20:25:26.073: E/AndroidRuntime(15976): at java.net.InetAddress.lookupHostByName(InetAddress.java:385)
05-05 20:25:26.073: E/AndroidRuntime(15976): at java.net.InetAddress.getAllByNameImpl(InetAddress.java:236)
05-05 20:25:26.073: E/AndroidRuntime(15976): at java.net.InetAddress.getAllByName(InetAddress.java:214)
05-05 20:25:26.073: E/AndroidRuntime(15976): at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:137)
05-05 20:25:26.073: E/AndroidRuntime(15976): at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:164)
05-05 20:25:26.073: E/AndroidRuntime(15976): at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:119)
05-05 20:25:26.073: E/AndroidRuntime(15976): at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:360)
05-05 20:25:26.073: E/AndroidRuntime(15976): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:555)
05-05 20:25:26.073: E/AndroidRuntime(15976): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:487)
05-05 20:25:26.073: E/AndroidRuntime(15976): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:465)
05-05 20:25:26.073: E/AndroidRuntime(15976): at com.aer.biblealive.MainActivity.onCreate(MainActivity.java:45)
05-05 20:25:26.073: E/AndroidRuntime(15976): at android.app.Activity.performCreate(Activity.java:5104)
05-05 20:25:26.073: E/AndroidRuntime(15976): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
05-05 20:25:26.073: E/AndroidRuntime(15976): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2262)
05-05 20:25:26.073: E/AndroidRuntime(15976): ... 11 more
05-05 20:26:56.433: D/AndroidRuntime(16674): Shutting down VM
05-05 20:26:56.433: W/dalvikvm(16674): threadid=1: thread exiting with uncaught exception (group=0x41640930)
05-05 20:26:56.433: E/AndroidRuntime(16674): FATAL EXCEPTION: main
05-05 20:26:56.433: E/AndroidRuntime(16674): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.aer.biblealive/com.aer.biblealive.MainActivity}: android.os.NetworkOnMainThreadException
05-05 20:26:56.433: E/AndroidRuntime(16674): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2308)
05-05 20:26:56.433: E/AndroidRuntime(16674): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2358)
05-05 20:26:56.433: E/AndroidRuntime(16674): at android.app.ActivityThread.access$600(ActivityThread.java:154)
05-05 20:26:56.433: E/AndroidRuntime(16674): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1248)
05-05 20:26:56.433: E/AndroidRuntime(16674): at android.os.Handler.dispatchMessage(Handler.java:99)
05-05 20:26:56.433: E/AndroidRuntime(16674): at android.os.Looper.loop(Looper.java:137)
05-05 20:26:56.433: E/AndroidRuntime(16674): at android.app.ActivityThread.main(ActivityThread.java:5235)
05-05 20:26:56.433: E/AndroidRuntime(16674): at java.lang.reflect.Method.invokeNative(Native Method)
05-05 20:26:56.433: E/AndroidRuntime(16674): at java.lang.reflect.Method.invoke(Method.java:511)
05-05 20:26:56.433: E/AndroidRuntime(16674): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:795)
05-05 20:26:56.433: E/AndroidRuntime(16674): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:562)
05-05 20:26:56.433: E/AndroidRuntime(16674): at dalvik.system.NativeStart.main(Native Method)
05-05 20:26:56.433: E/AndroidRuntime(16674): Caused by: android.os.NetworkOnMainThreadException
05-05 20:26:56.433: E/AndroidRuntime(16674): at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1117)
05-05 20:26:56.433: E/AndroidRuntime(16674): at java.net.InetAddress.lookupHostByName(InetAddress.java:385)
05-05 20:26:56.433: E/AndroidRuntime(16674): at java.net.InetAddress.getAllByNameImpl(InetAddress.java:236)
05-05 20:26:56.433: E/AndroidRuntime(16674): at java.net.InetAddress.getAllByName(InetAddress.java:214)
05-05 20:26:56.433: E/AndroidRuntime(16674): at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:137)
05-05 20:26:56.433: E/AndroidRuntime(16674): at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:164)
05-05 20:26:56.433: E/AndroidRuntime(16674): at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:119)
05-05 20:26:56.433: E/AndroidRuntime(16674): at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:360)
05-05 20:26:56.433: E/AndroidRuntime(16674): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:555)
05-05 20:26:56.433: E/AndroidRuntime(16674): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:487)
05-05 20:26:56.433: E/AndroidRuntime(16674): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:465)
05-05 20:26:56.433: E/AndroidRuntime(16674): at com.aer.biblealive.MainActivity.onCreate(MainActivity.java:45)
05-05 20:26:56.433: E/AndroidRuntime(16674): at android.app.Activity.performCreate(Activity.java:5104)
05-05 20:26:56.433: E/AndroidRuntime(16674): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
05-05 20:26:56.433: E/AndroidRuntime(16674): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2262)
05-05 20:26:56.433: E/AndroidRuntime(16674): ... 11 more
05-05 20:43:01.972: D/AndroidRuntime(17355): Shutting down VM
05-05 20:43:01.972: W/dalvikvm(17355): threadid=1: thread exiting with uncaught exception (group=0x41640930)
05-05 20:43:01.995: E/AndroidRuntime(17355): FATAL EXCEPTION: main
05-05 20:43:01.995: E/AndroidRuntime(17355): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.aer.biblealive/com.aer.biblealive.MainActivity}: android.os.NetworkOnMainThreadException
05-05 20:43:01.995: E/AndroidRuntime(17355): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2308)
05-05 20:43:01.995: E/AndroidRuntime(17355): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2358)
05-05 20:43:01.995: E/AndroidRuntime(17355): at android.app.ActivityThread.access$600(ActivityThread.java:154)
05-05 20:43:01.995: E/AndroidRuntime(17355): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1248)
05-05 20:43:01.995: E/AndroidRuntime(17355): at android.os.Handler.dispatchMessage(Handler.java:99)
05-05 20:43:01.995: E/AndroidRuntime(17355): at android.os.Looper.loop(Looper.java:137)
05-05 20:43:01.995: E/AndroidRuntime(17355): at android.app.ActivityThread.main(ActivityThread.java:5235)
05-05 20:43:01.995: E/AndroidRuntime(17355): at java.lang.reflect.Method.invokeNative(Native Method)
05-05 20:43:01.995: E/AndroidRuntime(17355): at java.lang.reflect.Method.invoke(Method.java:511)
05-05 20:43:01.995: E/AndroidRuntime(17355): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:795)
05-05 20:43:01.995: E/AndroidRuntime(17355): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:562)
05-05 20:43:01.995: E/AndroidRuntime(17355): at dalvik.system.NativeStart.main(Native Method)
05-05 20:43:01.995: E/AndroidRuntime(17355): Caused by: android.os.NetworkOnMainThreadException
05-05 20:43:01.995: E/AndroidRuntime(17355): at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1117)
05-05 20:43:01.995: E/AndroidRuntime(17355): at java.net.InetAddress.lookupHostByName(InetAddress.java:385)
05-05 20:43:01.995: E/AndroidRuntime(17355): at java.net.InetAddress.getAllByNameImpl(InetAddress.java:236)
05-05 20:43:01.995: E/AndroidRuntime(17355): at java.net.InetAddress.getAllByName(InetAddress.java:214)
05-05 20:43:01.995: E/AndroidRuntime(17355): at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:137)
05-05 20:43:01.995: E/AndroidRuntime(17355): at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:164)
05-05 20:43:01.995: E/AndroidRuntime(17355): at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:119)
05-05 20:43:01.995: E/AndroidRuntime(17355): at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:360)
05-05 20:43:01.995: E/AndroidRuntime(17355): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:555)
05-05 20:43:01.995: E/AndroidRuntime(17355): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:487)
05-05 20:43:01.995: E/AndroidRuntime(17355): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:465)
05-05 20:43:01.995: E/AndroidRuntime(17355): at com.aer.biblealive.MainActivity$1.run(MainActivity.java:50)
05-05 20:43:01.995: E/AndroidRuntime(17355): at java.lang.Thread.run(Thread.java:856)
05-05 20:43:01.995: E/AndroidRuntime(17355): at com.aer.biblealive.MainActivity.onCreate(MainActivity.java:83)
05-05 20:43:01.995: E/AndroidRuntime(17355): at android.app.Activity.performCreate(Activity.java:5104)
05-05 20:43:01.995: E/AndroidRuntime(17355): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
05-05 20:43:01.995: E/AndroidRuntime(17355): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2262)
05-05 20:43:01.995: E/AndroidRuntime(17355): ... 11 more
05-05 21:02:50.448: D/AndroidRuntime(18004): Shutting down VM
05-05 21:02:50.448: W/dalvikvm(18004): threadid=1: thread exiting with uncaught exception (group=0x41640930)
05-05 21:02:50.448: E/AndroidRuntime(18004): FATAL EXCEPTION: main
05-05 21:02:50.448: E/AndroidRuntime(18004): android.app.SuperNotCalledException: Activity {com.aer.biblealive/com.aer.biblealive.MainActivity} did not call through to super.onCreate()
05-05 21:02:50.448: E/AndroidRuntime(18004): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2264)
05-05 21:02:50.448: E/AndroidRuntime(18004): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2358)
05-05 21:02:50.448: E/AndroidRuntime(18004): at android.app.ActivityThread.access$600(ActivityThread.java:154)
05-05 21:02:50.448: E/AndroidRuntime(18004): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1248)
05-05 21:02:50.448: E/AndroidRuntime(18004): at android.os.Handler.dispatchMessage(Handler.java:99)
05-05 21:02:50.448: E/AndroidRuntime(18004): at android.os.Looper.loop(Looper.java:137)
05-05 21:02:50.448: E/AndroidRuntime(18004): at android.app.ActivityThread.main(ActivityThread.java:5235)
05-05 21:02:50.448: E/AndroidRuntime(18004): at java.lang.reflect.Method.invokeNative(Native Method)
05-05 21:02:50.448: E/AndroidRuntime(18004): at java.lang.reflect.Method.invoke(Method.java:511)
05-05 21:02:50.448: E/AndroidRuntime(18004): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:795)
05-05 21:02:50.448: E/AndroidRuntime(18004): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:562)
05-05 21:02:50.448: E/AndroidRuntime(18004): at dalvik.system.NativeStart.main(Native Method)
05-05 21:06:36.831: D/libEGL(18374): loaded /vendor/lib/egl/libEGL_POWERVR_SGX540_120.so
05-05 21:06:36.870: D/libEGL(18374): loaded /vendor/lib/egl/libGLESv1_CM_POWERVR_SGX540_120.so
05-05 21:06:36.878: D/libEGL(18374): loaded /vendor/lib/egl/libGLESv2_POWERVR_SGX540_120.so
05-05 21:06:37.542: D/OpenGLRenderer(18374): Enabling debug mode 0
05-05 21:06:37.558: I/Choreographer(18374): Skipped 54 frames! The application may be doing too much work on its main thread.
05-05 21:16:18.816: D/libEGL(18958): loaded /vendor/lib/egl/libEGL_POWERVR_SGX540_120.so
05-05 21:16:18.855: D/libEGL(18958): loaded /vendor/lib/egl/libGLESv1_CM_POWERVR_SGX540_120.so
05-05 21:16:18.855: D/libEGL(18958): loaded /vendor/lib/egl/libGLESv2_POWERVR_SGX540_120.so
05-05 21:16:19.300: D/OpenGLRenderer(18958): Enabling debug mode 0
05-05 21:16:19.300: I/Choreographer(18958): Skipped 38 frames! The application may be doing too much work on its main thread.
05-05 21:16:20.487: E/JSON Parsing(18958): Failed to download the JSON file.
05-05 21:16:20.503: W/System.err(18958): org.json.JSONException: End of input at character 0 of
05-05 21:16:20.527: W/System.err(18958): at org.json.JSONTokener.syntaxError(JSONTokener.java:450)
05-05 21:16:20.527: W/System.err(18958): at org.json.JSONTokener.nextValue(JSONTokener.java:97)
05-05 21:16:20.527: W/System.err(18958): at org.json.JSONArray.(JSONArray.java:87)
05-05 21:16:20.534: W/System.err(18958): at org.json.JSONArray.(JSONArray.java:103)
05-05 21:16:20.534: W/System.err(18958): at com.aer.biblealive.MainActivity$LoadVideos.doInBackground(MainActivity.java:145)
05-05 21:16:20.534: W/System.err(18958): at com.aer.biblealive.MainActivity$LoadVideos.doInBackground(MainActivity.java:1)
05-05 21:16:20.534: W/System.err(18958): at android.os.AsyncTask$2.call(AsyncTask.java:287)
05-05 21:16:20.534: W/System.err(18958): at java.util.concurrent.FutureTask.run(FutureTask.java:234)
05-05 21:16:20.534: W/System.err(18958): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
05-05 21:16:20.534: W/System.err(18958): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
05-05 21:16:20.534: W/System.err(18958): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
05-05 21:16:20.534: W/System.err(18958): at java.lang.Thread.run(Thread.java:856)
05-05 21:16:20.534: W/dalvikvm(18958): threadid=11: thread exiting with uncaught exception (group=0x41640930)
05-05 21:16:20.534: E/AndroidRuntime(18958): FATAL EXCEPTION: AsyncTask #1
05-05 21:16:20.534: E/AndroidRuntime(18958): java.lang.RuntimeException: An error occured while executing doInBackground()
05-05 21:16:20.534: E/AndroidRuntime(18958): at android.os.AsyncTask$3.done(AsyncTask.java:299)
05-05 21:16:20.534: E/AndroidRuntime(18958): at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:352)
05-05 21:16:20.534: E/AndroidRuntime(18958): at java.util.concurrent.FutureTask.setException(FutureTask.java:219)
05-05 21:16:20.534: E/AndroidRuntime(18958): at java.util.concurrent.FutureTask.run(FutureTask.java:239)
05-05 21:16:20.534: E/AndroidRuntime(18958): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
05-05 21:16:20.534: E/AndroidRuntime(18958): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
05-05 21:16:20.534: E/AndroidRuntime(18958): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
05-05 21:16:20.534: E/AndroidRuntime(18958): at java.lang.Thread.run(Thread.java:856)
05-05 21:16:20.534: E/AndroidRuntime(18958): Caused by: java.lang.NullPointerException
05-05 21:16:20.534: E/AndroidRuntime(18958): at com.aer.biblealive.MainActivity$LoadVideos.doInBackground(MainActivity.java:158)
05-05 21:16:20.534: E/AndroidRuntime(18958): at com.aer.biblealive.MainActivity$LoadVideos.doInBackground(MainActivity.java:1)
05-05 21:16:20.534: E/AndroidRuntime(18958): at android.os.AsyncTask$2.call(AsyncTask.java:287)
05-05 21:16:20.534: E/AndroidRuntime(18958): at java.util.concurrent.FutureTask.run(FutureTask.java:234)
05-05 21:16:20.534: E/AndroidRuntime(18958): ... 4 more
05-05 21:35:41.362: D/AndroidRuntime(19655): Shutting down VM
05-05 21:35:41.362: W/dalvikvm(19655): threadid=1: thread exiting with uncaught exception (group=0x41640930)
05-05 21:35:41.394: E/AndroidRuntime(19655): FATAL EXCEPTION: main
05-05 21:35:41.394: E/AndroidRuntime(19655): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.aer.biblealive/com.aer.biblealive.MainActivity}: java.lang.RuntimeException: Your content must have a ListView whose id attribute is 'android.R.id.list'
05-05 21:35:41.394: E/AndroidRuntime(19655): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2308)
05-05 21:35:41.394: E/AndroidRuntime(19655): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2358)
05-05 21:35:41.394: E/AndroidRuntime(19655): at android.app.ActivityThread.access$600(ActivityThread.java:154)
05-05 21:35:41.394: E/AndroidRuntime(19655): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1248)
05-05 21:35:41.394: E/AndroidRuntime(19655): at android.os.Handler.dispatchMessage(Handler.java:99)
05-05 21:35:41.394: E/AndroidRuntime(19655): at android.os.Looper.loop(Looper.java:137)
05-05 21:35:41.394: E/AndroidRuntime(19655): at android.app.ActivityThread.main(ActivityThread.java:5235)
05-05 21:35:41.394: E/AndroidRuntime(19655): at java.lang.reflect.Method.invokeNative(Native Method)
05-05 21:35:41.394: E/AndroidRuntime(19655): at java.lang.reflect.Method.invoke(Method.java:511)
05-05 21:35:41.394: E/AndroidRuntime(19655): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:795)
05-05 21:35:41.394: E/AndroidRuntime(19655): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:562)
05-05 21:35:41.394: E/AndroidRuntime(19655): at dalvik.system.NativeStart.main(Native Method)
05-05 21:35:41.394: E/AndroidRuntime(19655): Caused by: java.lang.RuntimeException: Your content must have a ListView whose id attribute is 'android.R.id.list'
05-05 21:35:41.394: E/AndroidRuntime(19655): at android.app.ListActivity.onContentChanged(ListActivity.java:243)
05-05 21:35:41.394: E/AndroidRuntime(19655): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:335)
05-05 21:35:41.394: E/AndroidRuntime(19655): at android.app.Activity.setContentView(Activity.java:1881)
05-05 21:35:41.394: E/AndroidRuntime(19655): at com.aer.biblealive.MainActivity.onCreate(MainActivity.java:37)
05-05 21:35:41.394: E/AndroidRuntime(19655): at android.app.Activity.performCreate(Activity.java:5104)
05-05 21:35:41.394: E/AndroidRuntime(19655): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
05-05 21:35:41.394: E/AndroidRuntime(19655): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2262)
05-05 21:35:41.394: E/AndroidRuntime(19655): ... 11 more
05-05 21:42:59.503: D/AndroidRuntime(20362): Shutting down VM
05-05 21:42:59.503: W/dalvikvm(20362): threadid=1: thread exiting with uncaught exception (group=0x41640930)
05-05 21:42:59.511: E/AndroidRuntime(20362): FATAL EXCEPTION: main
05-05 21:42:59.511: E/AndroidRuntime(20362): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.aer.biblealive/com.aer.biblealive.MainActivity}: java.lang.RuntimeException: Your content must have a ListView whose id attribute is 'android.R.id.list'
05-05 21:42:59.511: E/AndroidRuntime(20362): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2308)
05-05 21:42:59.511: E/AndroidRuntime(20362): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2358)
05-05 21:42:59.511: E/AndroidRuntime(20362): at android.app.ActivityThread.access$600(ActivityThread.java:154)
05-05 21:42:59.511: E/AndroidRuntime(20362): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1248)
05-05 21:42:59.511: E/AndroidRuntime(20362): at android.os.Handler.dispatchMessage(Handler.java:99)
05-05 21:42:59.511: E/AndroidRuntime(20362): at android.os.Looper.loop(Looper.java:137)
05-05 21:42:59.511: E/AndroidRuntime(20362): at android.app.ActivityThread.main(ActivityThread.java:5235)
05-05 21:42:59.511: E/AndroidRuntime(20362): at java.lang.reflect.Method.invokeNative(Native Method)
05-05 21:42:59.511: E/AndroidRuntime(20362): at java.lang.reflect.Method.invoke(Method.java:511)
05-05 21:42:59.511: E/AndroidRuntime(20362): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:795)
05-05 21:42:59.511: E/AndroidRuntime(20362): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:562)
05-05 21:42:59.511: E/AndroidRuntime(20362): at dalvik.system.NativeStart.main(Native Method)
05-05 21:42:59.511: E/AndroidRuntime(20362): Caused by: java.lang.RuntimeException: Your content must have a ListView whose id attribute is 'android.R.id.list'
05-05 21:42:59.511: E/AndroidRuntime(20362): at android.app.ListActivity.onContentChanged(ListActivity.java:243)
05-05 21:42:59.511: E/AndroidRuntime(20362): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:335)
05-05 21:42:59.511: E/AndroidRuntime(20362): at android.app.Activity.setContentView(Activity.java:1881)
05-05 21:42:59.511: E/AndroidRuntime(20362): at com.aer.biblealive.MainActivity.onCreate(MainActivity.java:41)
05-05 21:42:59.511: E/AndroidRuntime(20362): at android.app.Activity.performCreate(Activity.java:5104)
05-05 21:42:59.511: E/AndroidRuntime(20362): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
05-05 21:42:59.511: E/AndroidRuntime(20362): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2262)
05-05 21:42:59.511: E/AndroidRuntime(20362): ... 11 more


It looks like I have the network downloading something on the main thread. But I don't think I do...



.

stackoverflow.comm

[android help] php can't run command about android

php can't run command about android - 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 would like to create an android project in PHP. I hv wrote a .bat file for PHP to execute:



cd C:\temp
android create project -n test -t 1 -p ./testing -k com.examples.test -a Main
exit


(I have tested that these commands are workable if I just type them in cmd.exe.)


However, if I use PHP to run the .bat file with following code:



system("test.bat"); ?>


It will be no response at all. Is PHP not able to execute any command about "android"? or any better solution for creating project in PHP?


Thank you.





























*.bat file is not a binary executable. I think it can be executed only by system's shell like *.doc file can be opened only by sofware that supports it.


To execute *.bat file you need to execute it via shell's cmd.exe



system("cmd.exe /c test.bat");






















Where is your test.bat file is placed in the file system? The code you are supplied is trying to run it from a root of disk C:.






















I have tried to run a create.bat before and it ran well with this code :


system("c:\wamp\www\android\bin\create.bat /PF\ c:\wamp\www\test com.example.test mytest");


============================================ But my problem was that the server couldn't recognize the Android SDK PATH ("Environment variable") and so it gave me this error :



=================================================== I have tried to run other .bat files that didn't need any of the last requirements and they ran perfect ... hope anyone can solve my environment variable problem




















lang-php






.

stackoverflow.comm

[android help] ABS 4.3.0 - android.support.v4.app.Watson does not exist

actionbarsherlock - ABS 4.3.0 - android.support.v4.app.Watson does not exist - 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 did a straight swap of ABS 4.2.0 for 4.3.0 and now I'm getting errors during compilation.



java: package android.support.v4.app.Watson does not exist


I'm using IntelliJ, both the main project and the ABS library project are using the android-support-v4.jar that was bundled with 4.3.0.


Any suggestions? Thanks.


























I didn't find out the issue, but trashing all the libraries from the project and adding them back in one by one has resolved the problem.























ABS 4.3.x is screwed up. It includes an incomplete support.v4 and adding the full support.v4 causes a duplicate which crashes you app. ABS 4.3.x is screwed up.




















default






.

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...