[Q] My android studio giving me errors and not working. - IDEs, Libraries, & Programming Tools

Well I posted it in android studio forum here but I don't know if it belongs to here..
any way -
READ ONLY EDIT DOWN!!
Okay, so I can't develop nothing as my Android Studio decided to. My all project is full of errors, unknown errors caused by Android Studio.
note: my files are correct, it is an other problem because even if I will import something from google codes it will have errors.
When I import a project everything's fine, but then after indexing and such things, all sudden everything is red and shouldn't be.
My errors for example are :
Code:
button1.setOnLongClickListener(new View.OnLongClickListener() {
....
....
}
Well shouldn't be error but :
Code:
cannot resolve symbol setOnLongClickListener
Another example:
Code:
button1=(Button) findViewById(R.id.button1);
I used this exact code for other button, seems right, I always using this line, it was fine until my Android Studio decided to give me some hard time, this line is full by errors and they are:
Code:
Unknown class: 'button1' , invalid method declaration; return type required, missing method body, or declare abstract
and there are like 20 errors that shouldn't be, things I tried:
1.deleting iml files , .idea folder - worked for a while but now it happened again and it doesn't fix it.
2.reinstalling android studio and then importing project.
3.upgrading android studio version to 1.3
4.restarting my pc.
5.importing project to an other pc, happened after a while.
6.Invalidate caches/ restart.
7.Changing module in project structure - I changed it back to how it was (it didn't help) and I think it caused the manifest error down..
My Module:app build.gradle:
Code:
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion '22.0.1'
defaultConfig {
applicationId "firstappdevelopments.david.reactiontime"
minSdkVersion 9
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.1'
}
Also I noticed now, my Manifest file as an error in
Code:
android:name=".MainActivity"
says it has no default structure. something like this. here is the full normal code:
Code:
<?xml version="1.0" encoding="utf-8"?>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
</manifest>
Please, if someone knows what is the problem or what can I else do, just say, and I am sorry about my English, thank you all.
EDIT!!!:
I deleted this lines:
Code:
connect.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
bluetooth = BluetoothAdapter.getDefaultAdapter();
if (bluetooth != null) {
if (bluetooth.isEnabled()) {
bluetooth.startDiscovery();
Set<BluetoothDevice> bondedSet = bluetooth.getBondedDevices();
if(bondedSet.size() > 0){
for(BluetoothDevice device : bondedSet){
newDevicesListView.setVisibility(View.VISIBLE);
mArrayAdapter.add(device.getName() + "\n" + device.getAddress());
}
}else{
mArrayAdapter.add("No Devices");
}
}
} else {
textview.setText("bluetooth is disabled, enabling.");
Intent enableBtIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
startActivityForResult(enableBtIntent, RESULT_OK);
}
} else{
textview.setText("Bluetooth is not supported.");
}
}
});
AND SUDDENLY ALL THE ERRORS DISSAPPEARED , ANY IDEAS? - The errors was in other lines..

I dont understand the 2nd one but i cann help u in button prblm..
try this
Button button1 = (Button)findViewById(R.id.blahblah);
and button1.setOnLongClickListenetblahblahnla.......
try and let me know

Related

[Q] App that start when boot of the phone is complete

Hi boys,
I'm a novice android programmer.
I want to create an app that start when the boot of the phone is complete.
I've write this code, the application work if I click on the icon, but it don't work when the boot of the phone is complete!!
this is my code:
Code:
public class HelloMyBoss extends Activity implements TextToSpeech.OnInitListener{
private TextToSpeech tts;
private String sayd;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
sayd="";
tts= new TextToSpeech(this, this);
}
@Override
protected void onDestroy() {
// Don't forget to shutdown!
if (tts != null) {
tts.stop();
tts.shutdown();
}
super.onDestroy();
}
@Override
public void onInit(int status) {
// status can be either TextToSpeech.SUCCESS or TextToSpeech.ERROR.
if (status == TextToSpeech.SUCCESS) {
// Set preferred language
int result = tts.setLanguage(Locale.ITALY);
if (result == TextToSpeech.LANG_MISSING_DATA ||
result == TextToSpeech.LANG_NOT_SUPPORTED) {
// Lanuage data is missing or the language is not supported.
Log.e(TAG, "Language is not available.");
} else {
sayHello();
}
} else {
// Initialization failed.
/Log.e(TAG, "Could not initialize TextToSpeech.");
}
}
private void sayHello() {
String hello = "Buon Giorno! Mi sono appena acceso...";
tts.speak(hello,
TextToSpeech.QUEUE_FLUSH, // Drop all pending entries in the playback queue.
null);
}
}
Code:
public class MyIntentReceiver extends BroadcastReceiver{
@Override
public void onReceive(Context context, Intent arg1) {
Intent startupBootIntent = new Intent(context, HelloMyBoss.class);
startupBootIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(startupBootIntent);
}
}
...and this is my manifest:
Code:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="mrbrown.android.hellomyboss"
android:versionCode="1"
android:versionName="1.0">
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".HelloMyBoss"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<receiver android:name=".MyIntentReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<category android:name="android.intent.category.HOME" />
</intent-filter>
</receiver>
</application>
<uses-sdk android:minSdkVersion="4"/>
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
</manifest>
Why it don't work?? What's my error???
Help me please!!

Coding help(reboot)

Im trying to make a restart app for android for a senior class project but im having some trouble with the code. Anyone have tips or can help me out that would be great. I could message the code if they want.
look into something like this:
Code:
Intent reboot = new Intent(Intent.ACTION_REBOOT);
reboot.putExtra("nowait", 1);
reboot.putExtra("interval", 1);
reboot.putExtra("window", 0);
sendBroadcast(reboot);
Nvm you probably don't need the extras. You might so give it a try with and without
From something awesome
So would that go in the onCreate method?
Sent from my ADR6300 using XDA App
MrAwesomeMan said:
So would that go in the onCreate method?
Sent from my ADR6300 using XDA App
Click to expand...
Click to collapse
if you want your phone to reboot the second you start your app... then yes
i had that code in the onCreate method and i kept getting a force close error. So then i tried this:
Code:
[COLOR="Blue"]public class restart extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
public void boom(){
Intent reboot = new Intent(Intent.ACTION_REBOOT);
reboot.putExtra("nowait", 1);
reboot.putExtra("interval", 1);
reboot.putExtra("window", 0);
sendBroadcast(reboot);
}
public void myClickHandler(View view) {
boom();
}[/COLOR]
}
and when i click the button it doesnt do anything
here is the main.xml :
Code:
[COLOR="Blue"]<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<Button android:text="Restart" android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
</LinearLayout>
[/COLOR]
and here is the manifest
Code:
[COLOR="Blue"]<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="restart.android"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="8" />
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".restart"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<permission android:name="android.permission.DEVICE_POWER"/>
<uses-permission android:name="android.permission.DEVICE_POWER" />
<permission android:name="android.permission.REBOOT"/>
<uses-permission android:name="android.permission.REBOOT"/>
</manifest>[/COLOR]
Cause you never attached an onClickListener to your button. When i take a break in 15mins ill write an example
From something awesome
Code:
public class restart extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
//get an instance of that button to be used in the code
Button rebootButton = (Button)findViewById(R.id.button1);
//attach an action to the button
rebootButton.setOnClickListener(new View.OnClickListener() {
//the action to partake upon pressage of said button
public void onClick(View view) {
boom();
}
});
}
public void boom() {
Intent reboot = new Intent(Intent.ACTION_REBOOT);
reboot.putExtra("nowait", 1);
reboot.putExtra("interval", 1);
reboot.putExtra("window", 0);
sendBroadcast(reboot);
}
}
whether boom() will work or not im not sure. but it will be called when you press the button.
-------------------
public static final String ACTION_REBOOT
Since: API Level 1
Broadcast Action: Have the device reboot. This is only for use by system code.
This is a protected intent that can only be sent by the system.
Constant Value: "android.intent.action.REBOOT"
killersnowman said:
public static final String ACTION_REBOOT
Since: API Level 1
Broadcast Action: Have the device reboot. This is only for use by system code.
This is a protected intent that can only be sent by the system.
Constant Value: "android.intent.action.REBOOT"
Click to expand...
Click to collapse
Well you can use, root + terminal commands.
http://stackoverflow.com/questions/4580254/android-2-2-reboot-device-programmatically
Code:
try {
Runtime.getRuntime().exec("su");
Runtime.getRuntime().exec("reboot");
} catch (IOException e) {
}
(Note: there is no error checking or anything special).
The first command will ask for superuser permission. The second, will reboot the phone. There is no need for extra permissions in the manifest file since the actual rebooting is handled by the executed comamand, not the app.
So i tried your code but boom() didnt work so i commented out the button instances in onCreate and put what was in boom() into onCreate but i still kept getting a window asking to force close. i also tried the try and catch loop in boom and in on create and they didnt work either.
Boom() wont work with out being signed as a system app, which would require you t compile your own rom. Try the superuser method above. You will need root
From something awesome
is there a way to shutdown the phone with a intent broadcast?
i was trying to use ACTION_SHUTDOWN instead of ACTION_REBOOT but it didnt works
thx for reply
##### EDIT
problem solved: need to put "ACTION_REQUEST_SHUTDOWN" to the Intent.
I'm a newbie here, so if you think anything is wrong with this post, feel free to point it out. I'm happy to learn.
I hope it's alright to piggyback on this thread, since half of it (the half of it that doesn't deal with using the linux-way of rebooting) actually deals with the same problem, even though it stems from an entirely different source.
In my case it's about sending a ACTION_PACKAGE_ADDED Intent... what's important is that it's protected the same way:
ActivityManagerService.java: broadcastIntentLocked
Code:
if (callingUid == Process.SYSTEM_UID || callingUid == Process.PHONE_UID
|| callingUid == Process.SHELL_UID || callingUid == 0) {
// Always okay.
} else if (callerApp == null || !callerApp.persistent) {
So, it's about satisfying these requirements somehow, or getting around it by sending the broadcast directly.
As you say, you're supposed to sign applications with the same key as the applications in one of these groups to be able to use a sharedUserId, but that's cumbersome and would prevent the application from running on any device other but my own. It would also make updates a lot more complicated... so circumventing it seems the better idea. After all: I am root, so we're already way past any security considerations.
The first thing I've tried is modifying packages.xml , in the hope that the system wouldn't try to re-check the keys. Well, no such luck. From a security standpoint I don't think this check is necessary (if anybody is able to edit packages.xml it's already too late), but Android does it anyway, rebuilding the xml file. Maybe somebody has an idea where and how this re-building could be controlled? Or is it the other way around and the uid originates from somewhere else? It isn't the permission on the APK in /data/app, that's always system:system.
I've also tried starting the APK via "am" hoping that it might inherit the shell uid... it was a desperate attempt and it turned out exactly like anybody would have expected: it didn't work.
The next thing was changing the permission on the process while it's running. On some Linux flavors root can change the permissions in /proc/* , but apparently not on Android.
Then I tried to use ActivityManagerNative::broadcastIntent instead of Content::sendIntent, but the check is buried too deep (as I said before): in order to get past the check I would need access to ActivityManagerService::sendPackageBroadcastLocked , but the object I get through IActivityManager::getDefault is actually only a proxy (ActivityManagerProxy) that forwards the public commands via an IBinder. Naturally the proxy doesn't have the private methods (private methods can still be called, but the proxy is a pretty good isolation layer).
The only thing that I can still think of would be implementing sendPackageBroadcastLocked myself.. it really only depends on the threads, which might be accessible... somehow
Code:
for (int i = mLruProcesses.size() - 1 ; i >= 0 ; i--)
mLruProcesses.get(i).thread.dispatchPackageBroadcast(cmd, packages);
These are IApplicationThread objects... they are not implemented in Java... at least the file contains only the prototypes. Is there some way to interact with such objects directly from the shell?
I would be really grateful if anybody had any idea... I just refuse to believe that I'm the first person to need root access rights beyond the shell.

[HELP][NEWBIE]Camera Activity Not working...

Hi people, I am newbie , trying to learn android developing.
So i was making this app. which uses the camera client android clicks a picture and then sets it as wallpaper, as per the user's request.
But when i try to install it on my phone (Samsung Galaxy y duos ). It says application not installed. I am not able to understand why. I have also added the permissions on the Android manifest. Please do help me out. I will be attaching the xml for the camera app and its Class.
THE JAVA CLASS...
Code:
package com.example.done;
import java.io.IOException;
import java.io.InputStream;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.ImageView;
public class Camera extends Activity implements View.OnClickListener {
Button camera;
ImageButton done;
ImageView wallpaper;
int cameraData = 0;
Intent i;
Bitmap pic;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.photo);
intial();
camera.setOnClickListener(this);
done.setOnClickListener(this);
InputStream is = getResources().openRawResource(R.drawable.abc);
pic= BitmapFactory.decodeStream(is);
int cameraData = 0;
Intent i;
}
private void intial() {
// TODO Auto-generated method stub
camera = (Button) findViewById(R.id.camera);
done = (ImageButton) findViewById(R.id.imgTile);
wallpaper = (ImageView) findViewById(R.id.imagButt);
}
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
switch (v.getId()) {
case R.id.camera:
i = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(i, cameraData);
break;
case R.id.imagButt:
try {
getApplicationContext().setWallpaper(pic);
} catch (IOException e) {
e.printStackTrace();
}
}
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
// TODO Auto-generated method stub
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == RESULT_OK) {
Bundle e = i.getExtras();
pic = (Bitmap) e.get("data");
wallpaper.setImageBitmap(pic);
}
}
}[/CODE]
the Xml file (photo.xml)
Code:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="xda wont allow"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ImageView
android:id="@+id/imgTile"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/abc"
android:layout_gravity="center" />
<ImageButton
android:id="@+id/imagButt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:src="@drawable/ic_launcher" />
<Button
android:id="@+id/camera"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="Button" />
</LinearLayout>
ThankYou in advance
Please add your manifest to the OP too, the issue is most likely in it (The first thing that comes to my mind is that your app has a higher android:minSdkVersion than your device's version of android)
Also, did you export a signed apk?
Are you using Eclipse ?
If you do, just make a right click on your project name and choose "Run As --> Android Application" to launch it on your connected device with adb enabled.
If you want to export a signed apk, right click your project's name and choose "Android tools --> Export Signed Application Package..." and follow the instructions in the daemon.
Manifest
Androguide.fr said:
Please add your manifest to the OP too, the issue is most likely in it (The first thing that comes to my mind is that your app has a higher android:minSdkVersion than your device's version of android)
Also, did you export a signed apk?
Are you using Eclipse ?
If you do, just make a right click on your project name and choose "Run As --> Android Application" to launch it on your connected device with adb enabled.
If you want to export a signed apk, right click your project's name and choose "Android tools --> Export Signed Application Package..." and follow the instructions in the daemon.
Click to expand...
Click to collapse
Yeah i am on eclipse.
And yup I am using a signed APK.
Actually, if i hit run. It would start up my emulator(It is installng on that perfectly).
But i have not connected my emulator to the webcam, so it would forceClose.
I have also set my emulator to Qvga.
And yup, the i have attached the manifest too.:good::good:
Manifest
Androguide.fr said:
Please add your manifest to the OP too, the issue is most likely in it (The first thing that comes to my mind is that your app has a higher android:minSdkVersion than your device's version of android)
Also, did you export a signed apk?
Are you using Eclipse ?
If you do, just make a right click on your project name and choose "Run As --> Android Application" to launch it on your connected device with adb enabled.
If you want to export a signed apk, right click your project's name and choose "Android tools --> Export Signed Application Package..." and follow the instructions in the daemon.
Click to expand...
Click to collapse
Yeah i am on eclipse.
And yup I am using a signed APK.
Actually, if i hit run. It would start up my emulator(It is installng on that perfectly).
But i have not connected my emulator to the webcam, so it would forceClose.
I have also set my emulator to Qvga.
And yup, the i have attached the manifest too.:good::good:
Actually the app i am developing, includes a menu which includes some other apps. Everything other app was working fine, until i added the camera app. . If you want the classes of the other apps, I can provide you that. But please help me. Thanks
Code:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.done"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="8" />
<uses-permission android:name="android.permission.SET_WALLPAPER" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".Splash"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.example.done.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="com.example.done.MAINACTIVITY" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name=".Menu"
android:label="@string/app_name" >
<intent-filter>
<action android:name="com.example.done.MENU" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name=".Password"
android:label="@string/app_name" >
</activity>
<activity
android:name=".Email"
android:label="@string/app_name" >
</activity>
<activity
android:name=".Camera"
android:label="cameraApp"
android:screenOrientation="portrait" >
</activity>
</application>
</manifest>
Add this permission to your manifest :
Code:
<uses-permission android:name="android.permission.CAMERA"/>
What version of Android is your device running ? You might wanna change this line
Code:
android:targetSdkVersion="8"
to :
Code:
android:targetSdkVersion="17"
if you want your app to support devices running ics & jellybean and/or be able to use the latest APIs (download the android 4.2.2 sdk platform if eclipse throws an error)
EDIT : you also have a whitespace in this line, remove it :
Code:
i = new Intent(android.provider.MediaStore.ACTION_IMAGE_CA [COLOR="DarkRed"]here [/COLOR]PTURE
It would be helpful if you paste in here the output of the console. It has nothing to do with the java code since it is being installed in the emulator.
Still not working
Androguide.fr said:
Add this permission to your manifest :
Code:
<uses-permission android:name="android.permission.CAMERA"/>
What version of Android is your device running ? You might wanna change this line
Code:
android:targetSdkVersion="8"
to :
Code:
android:targetSdkVersion="17"
if you want your app to support devices running ics & jellybean and/or be able to use the latest APIs (download the android 4.2.2 sdk platform if eclipse throws an error)
EDIT : you also have a whitespace in this line, remove it :
Code:
i = new Intent(android.provider.MediaStore.ACTION_IMAGE_CA [COLOR="DarkRed"]here [/COLOR]PTURE
Click to expand...
Click to collapse
As you said, i made all the changes. (Includind premissions etc.)
But it is not working.
When i run it on my emulator, it is getting installed. But when i run it on my phone.. It says app not installed.
Also I am attchiing the console output.
[2013-04-16 12:49:11 - Emulator] emulator: WARNING: Could not initialize OpenglES emulation, using software renderer.
[2013-04-16 12:49:12 - done] New emulator found: emulator-5554
[2013-04-16 12:49:12 - done] Waiting for HOME ('android.process.acore') to be launched...
[2013-04-16 12:50:09 - done] HOME is up on device 'emulator-5554'
[2013-04-16 12:50:09 - done] Uploading done.apk onto device 'emulator-5554'
[2013-04-16 12:50:35 - done] Installing done.apk...
[2013-04-16 12:50:57 - done] Success!
[2013-04-16 12:50:57 - done] Starting activity com.example.done.Splash on device emulator-5554
[2013-04-16 12:51:00 - done] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.example.done/.Splash }
hiphop12ism said:
As you said, i made all the changes. (Includind premissions etc.)
But it is not working.
When i run it on my emulator, it is getting installed. But when i run it on my phone.. It says app not installed.
Also I am attchiing the console output.
[2013-04-16 12:49:11 - Emulator] emulator: WARNING: Could not initialize OpenglES emulation, using software renderer.
[2013-04-16 12:49:12 - done] New emulator found: emulator-5554
[2013-04-16 12:49:12 - done] Waiting for HOME ('android.process.acore') to be launched...
[2013-04-16 12:50:09 - done] HOME is up on device 'emulator-5554'
[2013-04-16 12:50:09 - done] Uploading done.apk onto device 'emulator-5554'
[2013-04-16 12:50:35 - done] Installing done.apk...
[2013-04-16 12:50:57 - done] Success!
[2013-04-16 12:50:57 - done] Starting activity com.example.done.Splash on device emulator-5554
[2013-04-16 12:51:00 - done] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.example.done/.Splash }
Click to expand...
Click to collapse
You're giving us the output for the emulator here... We need to see the output for when you install it on an actual device as it's where your problem is.
I attached a screenshot.
I hope that helps.
So as i told you, everything was working fine. Until i added the camera app. But for experiment's sake, i deleted the app's xml, java and the activity from the manifest. But still the same result.
As i.told you, the camera app is a sub app in my phone..
The whole app contains some more app. But even then its not working:thumbup::thumbup:
Sent from my GT-S6102 using xda app-developers app
Problem Solved
Hey fellas.
I thought that changing the phone, would solve the problem,
So i used samsung s2 instead of samasing galaxy y duos.
And the app worked....
But i am not able to determine the reason.
Why don't you post the output of the console? You have been asked several times :good:
You will not find anything in the console.
As eclipse installes the apk in my emulator. In the emulator, it installs perfectly. So everything in the console is positve. Anyways i have already attached the console output in the previous page. And if you need the logcat. I will provide you.
Anyways, a great thanks for your concern
--------+---------+-----------+-------------
Sent from my GT-S6102 using xda app-developers app
Could you provide us your android manifest?
Maybe you need to set a lower minSdkVersion. (Although it says "Parsing error" on my Samsung Galaxy Ace if there is a wrong minSdkVersion)
I have copied the manifest in the previous page. I have tried putting minsdk on qvga adpi.
But it didnt work..
Sent from my GT-S6102 using xda app-developers app
hiphop12ism said:
I have copied the manifest in the previous page. I have tried putting minsdk on qvga adpi.
But it didnt work..
Sent from my GT-S6102 using xda app-developers app
Click to expand...
Click to collapse
Ah. Ok. Thanks.
The minSdkVersion is the minimum Android version which has to be installed on the device.
8 is the code for Android 2.2.
Which Android version is running on your device? Maybe you will need to set it to a lower value.
i have 2.3.6
Sent from my GT-S6102 using xda app-developers app

2.3.3 to 4.2.2 Http Get - Help me conquer learning curve

Hey all!
New to Android but not developing. App runs great with emulator running Android 2.3.3. When I install the app to my phone (Samsung Galaxy 4S Active) runnnig Android 4.2.2, the Http Get execute command on the client does not seem to happen. I get no data back reported to my TextView.
I know there is some learning curve I'm missing here, and would appreciate some guidance.
HttpExample.java
Code:
package com.example.test;
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
public class HttpExample extends Activity {
TextView httpStuff;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.httpex);
httpStuff = (TextView) findViewById(R.id.tvHttp);
GetMethodEx test = new GetMethodEx();
try {
String returned = test.getInternetData();
httpStuff.setText(returned);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
GetMethodEx.java
Code:
package com.example.test;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URI;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;
public class GetMethodEx {
public String getInternetData () throws Exception {
BufferedReader in = null;
String data = null;
try {
HttpClient client = new DefaultHttpClient();
URI website = new URI("CANTPOSTURL");
HttpGet request = new HttpGet();
request.setURI(website);
HttpResponse response = client.execute(request);
in = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
StringBuffer sb = new StringBuffer("");
String l = "";
String nl = System.getProperty("line.separator");
while ((l = in.readLine()) !=null) {
sb.append(l + nl);
}
in.close();
data = sb.toString();
return data;
}finally {
if (in !=null) {
try {
in.close();
return data;
}catch (Exception e) {
e.printStackTrace();
}
}
}
}
}
AndroidManifest.xml
Code:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="CANTPOSTURL"
package="com.example.test"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="18" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.example.test.HttpExample"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
httpex.xml
Code:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="CANTPOSTURL"
xmlns:tools="CANTPOSTURL"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".HttpActivity">
<ScrollView android:layout_height="fill_parent" android:layout_width="fill_parent">
<TextView
android:id="@+id/tvHttp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Loading Data" >
</TextView>
</ScrollView>
</LinearLayout>
I would post the logcat but there really is no issue at 2.3.3... just need to know what i'm missing going to 4.2.2.
Thanks in advance, I know this should be easy for you all.

[Q] how to start application on boot / startup

I tried to follow the tutorials on internet to start application start at boot time , but it does not seems to work.
i followed the tutorial, i also downloaded and installed this example source code, but this application wont work, its not showing at startup, is that something wrong with my device ? or is it has a technical changes like OS forbid it to run or something?
You need to create boot receiver:
public class BootExampleReciever extends BroadcastReceiver
{
@override
public void onReceive(Context context, Intent intent) {
Intent i = new Intent(context, MainActivity.class);
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(i);
}
}
you need to add the following permission to the manifest:
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
and to declare the receiver as well:
<receiver android:name=".BootExampleReciever">
<intent-filter >
<action android:name="android.intent.action.BOOT_COMPLETED"/>
</intent-filter>
</receiver>

Categories

Resources