Thursday, June 27, 2013

[android help] Android Emulator for windows?(Not to install the Complete SDK, Just Emulator Needed)


Android Emulator for windows?(Not to install the Complete SDK, Just Emulator Needed)



Is there any possible way to install Android Emulator itself on the windows. I would need that for the Testing purpose? Any Idea?


Please Note: I dont want to install whole sdk. i just want install the Emulater itself. that emulator is just like that a phone for the testing purpose.


Thanks in Advance



.

stackoverflow.comm



[android help] Unable to instantiate fragment make sure class name exists, is public, and has an empty constructor that is public


Unable to instantiate fragment make sure class name exists, is public, and has an empty constructor that is public



I am using the Fragment and When I change the orientation of the device. If initially its portrait and when i change it to landscape then my application crash. I added the logcat here. I have gone through many links but could not find the right answer.


Please help me to solve this issue.


Thanks



public class PageViewActivity extends FragmentActivity {

private ViewPager viewPager;
private NoticePageAdapter noticePageAdapter;
private TextView titleText;
private int pageIndex;
private static int restTime = 0;
private long lastTime;

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
setContentView(R.layout.activity_page_view);

getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.window_title2);
titleText = (TextView) findViewById(R.id.title2);
titleText.setText(R.string.app_name);

// Create the adapter that will return a fragment for each of the three
// primary sections of the app.
noticePageAdapter = new NoticePageAdapter(getSupportFragmentManager());

// Set up the ViewPager with the sections adapter.
viewPager = (ViewPager) findViewById(R.id.viewpager);
Intent intent = getIntent();
pageIndex = intent.getIntExtra("notice_position", 0);
viewPager.setAdapter(noticePageAdapter);
viewPager.setCurrentItem(pageIndex, true);

lastTime = System.currentTimeMillis();

//Check the rest time. If it exceed the 30 sec then finish the activity.
new CheckTimeThread().start();
}

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

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

@Override
public Fragment getItem(int position) {
Fragment fragment = new NoticeFragment();
Bundle args = new Bundle();
args.putInt(NoticeFragment.TEMPLATE_POSITION, position + 1);
fragment.setArguments(args);
return fragment;
}

@Override
public int getCount() {
return NoticeData.templateId.length;
}
}

/**
* A Notice fragment representing a notices of the app, but that simply
* displays notices
*/
public class NoticeFragment extends Fragment {
public static final String TEMPLATE_POSITION = "template_position";
private TextView noticeHeaderTextView;
private TextView noticeContentTextView;
private ImageView noticeImageView;

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
int templatePosition = getArguments().getInt(TEMPLATE_POSITION);
int templateId = 0;
int tempVar;

tempVar = templatePosition - 1;
templateId = Integer.parseInt(NoticeData.templateId[tempVar]);

int res = R.layout.first_template;

switch (templateId) {
case 1:
res = R.layout.first_template;
break;
case 2:
res = R.layout.second_template;
break;
case 3:
res = R.layout.third_template;
break;
case 4:
res = R.layout.fourth_template;
break;
default:
break;
}

View rootView = inflater.inflate(res, container, false);
noticeHeaderTextView = (TextView)rootView.findViewById(R.id.noticeHeading);
noticeHeaderTextView.setText(Html.fromHtml(NoticeData.noticeHeading[tempVar]));

noticeContentTextView = (TextView)rootView.findViewById(R.id.noticeContent);
noticeContentTextView.setText(Html.fromHtml(NoticeData.noticeContent[tempVar]));

noticeImageView = (ImageView)rootView.findViewById(R.id.noticeImageView);
UrlImageViewHelper.setUrlDrawable(noticeImageView, NoticeData.imagesURL[tempVar]);

DisplayMetrics metrics = getResources().getDisplayMetrics();
int width = metrics.widthPixels;

if(templateId == 3) {
noticeImageView.getLayoutParams().width = width / 2;
}
else if(templateId == 2) {
noticeHeaderTextView.getLayoutParams().width = width/2;
noticeContentTextView.getLayoutParams().width = width/2;
}

RelativeLayout relativeLayout = (RelativeLayout)rootView.findViewById(R.id.relativeLayout);
relativeLayout.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
resetRestTime();
return false;
}
});

return rootView;
}
}
}


Error Trace:



06-24 18:24:36.501: E/AndroidRuntime(11863): FATAL EXCEPTION: main
06-24 18:24:36.501: E/AndroidRuntime(11863): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.noticeboard/com.noticeboard.PageViewActivity}: android.support.v4.app.Fragment$InstantiationException: Unable to instantiate fragment com.noticeboard.PageViewActivity$NoticeFragment: make sure class name exists, is public, and has an empty constructor that is public
06-24 18:24:36.501: E/AndroidRuntime(11863): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1970)
06-24 18:24:36.501: E/AndroidRuntime(11863): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1995)
06-24 18:24:36.501: E/AndroidRuntime(11863): at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:3365)
06-24 18:24:36.501: E/AndroidRuntime(11863): at android.app.ActivityThread.access$700(ActivityThread.java:128)
06-24 18:24:36.501: E/AndroidRuntime(11863): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1165)
06-24 18:24:36.501: E/AndroidRuntime(11863): at android.os.Handler.dispatchMessage(Handler.java:99)
06-24 18:24:36.501: E/AndroidRuntime(11863): at android.os.Looper.loop(Looper.java:137)
06-24 18:24:36.501: E/AndroidRuntime(11863): at android.app.ActivityThread.main(ActivityThread.java:4514)
06-24 18:24:36.501: E/AndroidRuntime(11863): at java.lang.reflect.Method.invokeNative(Native Method)
06-24 18:24:36.501: E/AndroidRuntime(11863): at java.lang.reflect.Method.invoke(Method.java:511)
06-24 18:24:36.501: E/AndroidRuntime(11863): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790)
06-24 18:24:36.501: E/AndroidRuntime(11863): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
06-24 18:24:36.501: E/AndroidRuntime(11863): at dalvik.system.NativeStart.main(Native Method)
06-24 18:24:36.501: E/AndroidRuntime(11863): Caused by: android.support.v4.app.Fragment$InstantiationException: Unable to instantiate fragment com.noticeboard.PageViewActivity$NoticeFragment: make sure class name exists, is public, and has an empty constructor that is public
06-24 18:24:36.501: E/AndroidRuntime(11863): at android.support.v4.app.Fragment.instantiate(Fragment.java:399)
06-24 18:24:36.501: E/AndroidRuntime(11863): at android.support.v4.app.FragmentState.instantiate(Fragment.java:97)
06-24 18:24:36.501: E/AndroidRuntime(11863): at android.support.v4.app.FragmentManagerImpl.restoreAllState(FragmentManager.java:1760)
06-24 18:24:36.501: E/AndroidRuntime(11863): at android.support.v4.app.FragmentActivity.onCreate(FragmentActivity.java:200)
06-24 18:24:36.501: E/AndroidRuntime(11863): at com.noticeboard.PageViewActivity.onCreate(PageViewActivity.java:40)
06-24 18:24:36.501: E/AndroidRuntime(11863): at android.app.Activity.performCreate(Activity.java:4465)
06-24 18:24:36.501: E/AndroidRuntime(11863): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1053)
06-24 18:24:36.501: E/AndroidRuntime(11863): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1934)
06-24 18:24:36.501: E/AndroidRuntime(11863): ... 12 more
06-24 18:24:36.501: E/AndroidRuntime(11863): Caused by: java.lang.InstantiationException: can't instantiate class com.noticeboard.PageViewActivity$NoticeFragment; no empty constructor
06-24 18:24:36.501: E/AndroidRuntime(11863): at java.lang.Class.newInstanceImpl(Native Method)
06-24 18:24:36.501: E/AndroidRuntime(11863): at java.lang.Class.newInstance(Class.java:1319)
06-24 18:24:36.501: E/AndroidRuntime(11863): at android.support.v4.app.Fragment.instantiate(Fragment.java:388)
06-24 18:24:36.501: E/AndroidRuntime(11863): ... 19 more


.

stackoverflow.comm



[android help] how to use android geofencing api?


how to use android geofencing api?



who may concern,


i tested new google play service api.


That is geofencing. i downloaded the sample code from android developers site(http://developer.android.com/shareables/training/GeofenceDetection.zip).


i ran this code on android device(galaxy note2).


i placed my office geo-position and radius to 10m.


when i was walking to my office, nothing happened.


while running the sample code, one thing i have noticed is when I am already placed inside the geofence range and add the geofence to LocationClient at the moment.


so i read LocationClient class document(http://developer.android.com/reference/com/google/android/gms/location/LocationClient.html#addGeofences(java.util.List, android.app.PendingIntent, com.google.android.gms.location.LocationClient.OnAddGeofencesResultListener)).


i found the following paragraph.


"In case network location provider is disabled by the user, the geofence service will stop updating, all registered geofences will be removed and an intent is generated by the provided pending intent. In this case,hasError(Intent) returns true and getErrorCode(Intent) returns GEOFENCE_NOT_AVAILABLE."


so i turned on wi-fi. and was walking to my office(geofence), then i got notification "geofence entered".


i have some question.



  1. does geofencing only work with wi-fi?




  2. why not happened in 3g network?




  3. is that a sample code bug?




  4. is that my mistake?



I'm waiting for your urgent reply..


anyone help me..please.



.

stackoverflow.comm



[android help] How to restart an application completely?


How to restart an application completely?



I have an application which starts a Remote Service in its first launched activity. Then, in another activity, the user can set the configuration of the application. Please note that this second activity isn't bound to the Service and I don't wish to bind it.


Now my question is : how could I restart the whole application from the second activity, after changing the configuration settings?


For now, I am using a button which onClickListener is :



public void onClick(DialogInterface dialog, int which) {
sauvegarde();
Intent i = getBaseContext().getPackageManager().getLaunchIntentForPackage(getBaseContext().getPackageName());
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(i);
}


The problem is : it only restarts the current activity without shutting the whole application, and therefore, without restarting the service


Any ideas?



.

stackoverflow.comm



Wednesday, June 26, 2013

[General] App to turn another app on and off based on time


App to turn another app on and off based on time



Hi all...

I like to sleep at night! When I do I would love it if I could turn Google Talk off but have it switch on again in the morning without me having to remember to do it. At the moment I have an app which puts the phone into airplane mode and I set a time to turn it back on. If I could do the same with Google Talk it would be awesome.

Does anyone have any ideas of an app that would turn it off for a set period of time, or maybe at a certan time of the day check to see if it is off and start it up again?

Thanks guys.



.

forum.xda-developers.com

[General] can I back up but *not* restore using Backup and Restore?


can I back up but *not* restore using Backup and Restore?



Hi,

If I use the Backup and Restore option in my S3's settings, can I just back up my settings to Google and back out of the restore? I'm afraid to give it a try in case it goes from backup --> restore on it's own.

Thanks,
Deb



.

forum.xda-developers.com

[General] Downloading on 3g


Downloading on 3g



I have a question, hopefully i'll make sense and someone can help me

Say I want to download a tv programme onto my tablet but I'm not in a wifi hospot, so using 3g.

Let's the the programme is 350mb, does that mean that downloading on 3g would use up 350mb of my data allowance?



.

forum.xda-developers.com

[General] Unlock to last app used


Unlock to last app used



It should do that by default, however some system intensive apps like games and the like will restart when you unlock your phone.

The reason being that some apps don't work well with wake locks. And putting the phone to sleep during the middle of a system intensive app interrupts the process and forces it to close. Because turning the phone off causes the processor to sleep.

Sprint GS3 Running TN's Msg and Chubbs



.

forum.xda-developers.com

[General] Seeking App for Non-Cloud Email with Folders and Filters


Seeking App for Non-Cloud Email with Folders and Filters



Is there an Android email app that will do the following:


  • Sync with multiple POP3 accounts

  • Sort mail into folders automatically

  • One of the sort criteria: Sender is in my Contacts list

If not, would someone please write it?

(I can't switch to IMAP and I won't use Gmail or another cloud-based service.)


.

forum.xda-developers.com

[General] Looking for a good headset


Looking for a good headset



Is there a good monaural headset with a large leather earcup that can fit around the ear?

Sort of like this except with a leather earcup. Blutooth would be best, but wired is acceptable. Does not matter if earcup is closed or open, although closed would be best. The phone I will use it for will be either a Samsung Note II or S 4.



.

forum.xda-developers.com

[android help] Android: Image Over Zooming


Android: Image Over Zooming



I have this code from a tut that enables scrolling and zooming of an image, but even if the image is small, the code will stretch the image so that It will fill the whole screen. I want it to have a dialog maybe that contains the image and enables the zooming and scrolling by modifying the code without occupying the whole screen.


Edit: Is it possible to have a limit in scrolling or limit the size of the image using the code below?



public class ZoomHelloActivity extends Activity {

// Physical display width and height.
private static int displayWidth = 0;
private static int displayHeight = 0;


static String img="";

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

Display display = ((WindowManager)
getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
displayWidth = display.getWidth();
displayHeight = display.getHeight();

//get intent
Bundle extras = getIntent().getExtras();

if (extras != null) {
Toast.makeText(this.getBaseContext(),"Inside: "+img.toString(),
Toast.LENGTH_SHORT).show();
img = extras.getString("img");
// and get whatever type user account id is
}
else{ Toast.makeText(this.getBaseContext(),"ERROR ni",
Toast.LENGTH_SHORT).show();}
setContentView(new SampleView(this));


}

private static class SampleView extends View {
private static Bitmap bmLargeImage; //bitmap large enough to be scrolled
private static Rect displayRect = null; //rect we display to
private Rect scrollRect = null; //rect we scroll over our bitmap with
private int scrollRectX = 0; //current left location of scroll rect
private int scrollRectY = 0; //current top location of scroll rect
private float scrollByX = 0; //x amount to scroll by
private float scrollByY = 0; //y amount to scroll by
private float startX = 0; //track x from one ACTION_MOVE to the next
private float startY = 0; //track y from one ACTION_MOVE to the next

public SampleView(Context context) {
super(context);

// Destination rect for our main canvas draw. It never changes.
displayRect = new Rect(0, 0, displayWidth, displayHeight);
// Scroll rect: this will be used to 'scroll around' over the
// bitmap in memory. Initialize as above.
scrollRect = new Rect(0, 0, displayWidth, displayHeight);

// Load a large bitmap into an offscreen area of memory.
int assignImg;
assignImg = Integer.parseInt(img);
bmLargeImage = BitmapFactory.decodeResource(getResources(),
assignImg);
}

@Override
public boolean onTouchEvent(MotionEvent event) {
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
// Remember our initial down event location.
startX = event.getRawX();
startY = event.getRawY();
break;

case MotionEvent.ACTION_MOVE:
float x = event.getRawX();
float y = event.getRawY();
// Calculate move update. This will happen many times
// during the course of a single movement gesture.
scrollByX = x - startX; //move update x increment
scrollByY = y - startY; //move update y increment
startX = x; //reset initial values to latest
startY = y;
invalidate(); //force a redraw
break;
}
return true; //done with this event so consume it
}

@Override
protected void onDraw(Canvas canvas) {
int newScrollRectX = scrollRectX - (int)scrollByX;
int newScrollRectY = scrollRectY - (int)scrollByY;

// Don't scroll off the left or right edges of the bitmap.
if (newScrollRectX < 0)
newScrollRectX = 0;
else if (newScrollRectX > (bmLargeImage.getWidth() - displayWidth))
newScrollRectX = (bmLargeImage.getWidth() - displayWidth);

// Don't scroll off the top or bottom edges of the bitmap.
if (newScrollRectY < 0)
newScrollRectY = 0;
else if (newScrollRectY > (bmLargeImage.getHeight() - displayHeight))
newScrollRectY = (bmLargeImage.getHeight() - displayHeight);

// We have our updated scroll rect coordinates, set them and draw.
scrollRect.set(newScrollRectX, newScrollRectY,
newScrollRectX + displayWidth, newScrollRectY + displayHeight);
Paint paint = new Paint();
canvas.drawBitmap(bmLargeImage, scrollRect, displayRect, paint);

// Reset current scroll coordinates to reflect the latest updates,
// so we can repeat this update process.
scrollRectX = newScrollRectX;
scrollRectY = newScrollRectY;
}
}
}


.

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