Monday, April 8, 2013

[android help] Update issue of an app widget using collection


I have created an app widget using collection for my app, The widget shows date and list of item on that particular date. Everything works fine and the widget are updating as required, But sometimes what happen while changing the date in the widget by clicking next and previous button, the list is not refresh means the items are not updated on that particular date. This behaviour is random and its occur sometimes only. So why this happen, anything wrong in my code.


Code that i have use is:


WidgetProvider.class



public class WidgetProvider extends AppWidgetProvider
{
private ThemeManager m_ThemeManagerObject;

private static String WIDGET_NEXT_BUTTON = "in.test.widgetApp.WIDGET_NEXT_BUTTON";

private static String WIDGET_PREV_BUTTON = "in.test.widgetApp.WIDGET_PREV_BUTTON";

@Override
public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds)
{
super.onUpdate(context, appWidgetManager, appWidgetIds);

// Set Date to current Date
NoteManager.getSingletonObject().setWidgetToCurrentDate();

// Code to update the widget by current date
updateAppWidget(context, AppWidgetManager.getInstance(context), appWidgetIds);
}

@Override
public void onReceive(Context context, Intent intent)
{
super.onReceive(context, intent);

int numOfDays = 1;

ComponentName thisWidget = new ComponentName(context, WidgetProvider.class);
AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context);
int[] appWidgetIds = appWidgetManager.getAppWidgetIds(thisWidget);

if (intent.getAction().equals(WIDGET_NEXT_BUTTON))
{
// Increase no of days by one
// Update the widget by new date
NoteManager.getSingletonObject().setWidgetDate(numOfDays);
updateAppWidget(context, AppWidgetManager.getInstance(context), appWidgetIds);
}
else if (intent.getAction().equals(WIDGET_PREV_BUTTON))
{
// Decrease no of days by one
// Update the widget by new date
NoteManager.getSingletonObject().setWidgetDate(-numOfDays);
updateAppWidget(context, AppWidgetManager.getInstance(context), appWidgetIds);
}
}

public void updateAppWidget(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds)
{
// Get the folder path of all-page-view
ContextWrapper cw = new ContextWrapper(context.getApplicationContext());
File customDirectoryPath = cw.getDir(Utilities.CUSTOM_DIRECTORY_NAME_PREFIX, Context.MODE_PRIVATE);
File allPageDirectoryPath = new File(customDirectoryPath.getPath() + "/" + Utilities.All_PAGE_DIRECTORY_NAME_PREFIX);

if (!(allPageDirectoryPath.exists()))
allPageDirectoryPath.mkdirs();

// Create an singleton object of ThemeManager class
m_ThemeManagerObject = ThemeManager.getSingletonObject();
m_ThemeManagerObject.readTheme(allPageDirectoryPath.getPath());

// Create an instance of SimpleDateFormat class
SimpleDateFormat dateFormater = new SimpleDateFormat("dd-MMM, EEE", Locale.US);

/* loop through all widget instances */
for (int widgetId : appWidgetIds)
{
// Create an instance of remote view class
RemoteViews remoteView = new RemoteViews(context.getPackageName(), R.layout.widget_list);
Intent svcIntent = new Intent(context, WidgetService.class);
svcIntent.setData(Uri.fromParts("content", String.valueOf(widgetId), null));
remoteView.setRemoteAdapter(R.id.widget_list, svcIntent);

// Show day, month and week day inside the widget
remoteView.setTextViewText(R.id.txt_date, dateFormater.format(NoteManager.getSingletonObject().getWidgetDate().getTime()));

// If the list is empty. Show empty widget with juswrite-icon & empty text to the user
remoteView.setEmptyView(R.id.widget_list, R.id.widget_empty_text);

// On click of next button
Intent nextButtonIntent = new Intent(WIDGET_NEXT_BUTTON);
/* use widgetId as second parameter - it helped me to better address particular widget instance */
PendingIntent nextButtonPendingIntent = PendingIntent.getBroadcast(context, widgetId, nextButtonIntent, PendingIntent.FLAG_UPDATE_CURRENT);
remoteView.setOnClickPendingIntent(R.id.btn_next_month, nextButtonPendingIntent);
remoteView.setInt(R.id.btn_next_month, "setBackgroundResource", m_ThemeManagerObject.getNextButtonBgImage());

// On click of previous button
Intent prevButtonIntent = new Intent(WIDGET_PREV_BUTTON);
/* use widgetId as second parameter - same as above */
PendingIntent prevButtonPendingIntent = PendingIntent.getBroadcast(context, widgetId, prevButtonIntent, PendingIntent.FLAG_UPDATE_CURRENT);
remoteView.setOnClickPendingIntent(R.id.btn_prev_month, prevButtonPendingIntent);
remoteView.setInt(R.id.btn_prev_month, "setBackgroundResource", m_ThemeManagerObject.getPrevButtonBgImage());

// Open application on click of app widget
Intent clickIntent = new Intent(context, AllPageViewActivity.class);
PendingIntent clickPI = PendingIntent.getActivity(context, 0,clickIntent,PendingIntent.FLAG_UPDATE_CURRENT);
remoteView.setOnClickPendingIntent(R.id.widget_empty_text, clickPI);
remoteView.setOnClickPendingIntent(R.id.txt_date, clickPI);

/* update one widget instance at a time*/
appWidgetManager.updateAppWidget(widgetId, remoteView);
}
}
}


WidgetService.class



public class WidgetService extends RemoteViewsService
{
@Override
public RemoteViewsFactory onGetViewFactory(Intent intent)
{
return(new WidgetDisplay(this.getApplicationContext(), intent));
}
}


WidgetDisplay.class



public class WidgetDisplay implements RemoteViewsService.RemoteViewsFactory
{
private File m_CustomDirectoryPath, m_AllPageDirectoryPath;

private NoteManager m_NoteManagerObject;

private ThemeManager m_ThemeManagerObject;

private ArrayList m_AlarmItemNameArrayList;

private ArrayList m_ItemIndexArray;

private Context ctxt=null;

int appWidgetId;

Bitmap canvasBackground;

public WidgetDisplay(Context ctxt, Intent intent)
{
this.ctxt=ctxt;

appWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID,
AppWidgetManager.INVALID_APPWIDGET_ID);

setImageInView(this.ctxt);

}

private void setImageInView(Context context)
{
ContextWrapper cw = new ContextWrapper(ctxt.getApplicationContext());
m_CustomDirectoryPath = cw.getDir(Utilities.CUSTOM_DIRECTORY_NAME_PREFIX, Context.MODE_PRIVATE);
m_AllPageDirectoryPath = new File(m_CustomDirectoryPath.getPath() + "/" + Utilities.All_PAGE_DIRECTORY_NAME_PREFIX);

m_NoteManagerObject = NoteManager.getSingletonObject();
m_ThemeManagerObject = ThemeManager.getSingletonObject();

m_NoteManagerObject.readSettings(m_AllPageDirectoryPath.getPath());
m_NoteManagerObject.readAllPageChangesFromFile(m_AllPageDirectoryPath.getPath());
m_NoteManagerObject.readAlarmFromFile(m_AllPageDirectoryPath.getPath());
m_ThemeManagerObject.readTheme(m_AllPageDirectoryPath.getPath());

m_AlarmItemNameArrayList = new ArrayList(m_NoteManagerObject.getAlarmCount());
m_ItemIndexArray = new ArrayList(m_NoteManagerObject.getAlarmCount());

SimpleDateFormat sdFormatter = new SimpleDateFormat("dd-MMM-yyyy", Locale.US);
String selectedDate = sdFormatter.format(m_NoteManagerObject.getWidgetDate());

for(int i=0; i {
String ArrayDate = sdFormatter.format(m_NoteManagerObject.getAlarmTime(i));
if(selectedDate.equals(ArrayDate))
{
File noteDirectoryPath = new File(m_CustomDirectoryPath.getPath() + "/" + m_NoteManagerObject.getAlarmFolder(i));
m_AlarmItemNameArrayList.add(noteDirectoryPath.getPath() + "/" + m_NoteManagerObject.getAlarmItem(i));

m_ItemIndexArray.add(i);
}
}
}

@Override
public int getCount()
{
return(m_AlarmItemNameArrayList.size());
}

@Override
public RemoteViews getViewAt(int position)
{
new ImageLoaderTask(position).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);

// Set combine image to the image view using remote view instance
RemoteViews remoteView = new RemoteViews(ctxt.getPackageName(), R.layout.widget_list_item);
remoteView.setImageViewBitmap(R.id.image_view, canvasBackground);

// Set time text view using remote view instance
SimpleDateFormat timeFormater;

if(m_NoteManagerObject.get24HourFormat())
{
timeFormater = new SimpleDateFormat("HH:mm", Locale.US);
}
else
{
timeFormater = new SimpleDateFormat("hh:mm a", Locale.US );
}

// Show time on the top of each image view
String time = timeFormater.format(m_NoteManagerObject.getAlarmTime(m_ItemIndexArray.get(position)));
remoteView.setTextViewText(R.id.text_alarm_time, time);

Intent clickIntent = new Intent(ctxt, AllPageViewActivity.class);
PendingIntent clickPI=PendingIntent.getActivity(ctxt, 0,clickIntent,PendingIntent.FLAG_UPDATE_CURRENT);
remoteView.setOnClickPendingIntent(R.id.image_view, clickPI);

return(remoteView);
}

class ImageLoaderTask extends AsyncTask
{
private int position;

ImageLoaderTask(int position)
{
this.position = position;
}

@Override
protected void onPreExecute()
{
// Get foreground and background image
Bitmap bitmapImage = BitmapFactory.decodeFile(m_AlarmItemNameArrayList.get(position)).copy(Bitmap.Config.ARGB_8888, true);
canvasBackground = BitmapFactory.decodeResource(ctxt.getResources(), m_ThemeManagerObject.getWidgetListItemBgImage(m_ItemIndexArray.get(position), bitmapImage)).copy(Bitmap.Config.ARGB_8888, true);

// Scaled foreground image and combine with the background image
bitmapImage = Bitmap.createScaledBitmap(bitmapImage, 380, bitmapImage.getHeight() / 2, true);
Canvas comboImage = new Canvas(canvasBackground);
comboImage.drawBitmap(bitmapImage, 0f, 0f, null);
}

@Override
protected Long doInBackground(URL... urls)
{
return null;
}

@Override
protected void onProgressUpdate(Integer... progress)
{

}

@Override
protected void onPostExecute(Long result)
{

}
}

@Override
public void onCreate(){
}

@Override
public void onDestroy(){
}

@Override
public RemoteViews getLoadingView()
{
return(null);
}

@Override
public int getViewTypeCount(){
return(1);
}

@Override
public long getItemId(int position){
return(position);
}

@Override
public boolean hasStableIds(){
return(true);
}

@Override
public void onDataSetChanged(){
}
}


.

stackoverflow.comm

[android help] Copyrighting published code so that others don't copile and sell my work

android - Copyrighting published code so that others don't copile and sell my work - Stack Overflow




















Basically I have some code published online. It is very unlikely that anybody will find it and/or link it to my android app. (project and product names differ). I Just want to include a license agreement in my published code that protects me from someone else using my code to do the exact same thing to compete against me.


I have looked at the GNU public license but it is copy left. Does that mean I can not claim this right on my code if I plan on selling it?


I think what I want is the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. Which states others can't use my code for commercial use. But does that mean I can't use the code for commercial use?


Thanks
















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










default







.

stackoverflow.comm

[android help] How to use a timer to change the position of a imageview continuously


I want to change the location of a image view every short period. The location is random numbers. Here is my code:



rl = (RelativeLayout) findViewById(R.id.relativeLayout);
final ImageView i = (ImageView) findViewById(R.id.imageView1);
i.setImageResource(R.drawable.rat);

Timer t = new Timer();
final Handler h = new Handler();
final Runnable r = new Runnable(){

@Override
public void run() {
// TODO Auto-generated method stub
i.requestLayout();
rl.removeView(i);
Display display = getWindowManager().getDefaultDisplay();
int sw = display.getWidth();
int sh = display.getHeight();
Random w = new Random();
Random h = new Random();
int width = w.nextInt(sw);
int height = h.nextInt(sh);
tv.setText(String.format("%s",height));

LayoutParams params = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
params.leftMargin = width;
params.topMargin = height;
i.setLayoutParams(params);
i.requestLayout();
rl.addView(i,params);

}

};
TimerTask tt = new TimerTask(){

@Override
public void run() {
// TODO Auto-generated method stub
runOnUiThread(r);
}

};
t.schedule(tt, 0, delay);


This does not work for me, the image does not change. I need someone to help me solve this. Thanks.



.

stackoverflow.comm

[android help] How to cancel Asynch task in below case


Please dont downvote considering its repeated question. I have already read all questions to related to cancelling asynch task


Basicaly I hav three function which execute three different queries and shows the list On click of corresponding radio button.Before doing db operation I hide list container and display progress bar spining and on post execute vice versa. at any time user can click other radio button and select differnt list.


Now my problem is once asynch task is started I am not able to stop it Since I m calling function inside asynch task.I could only check isCanclelled before executing the function.Once function is invoked from Asynch task I dont have controll and function which is bieng called takes most of the time to execute.So how does I stop that function to execute. when user press another radio.


One possible solution would be to use different subclass of asynch task for each function/task. or instead of calling function put enitre code in do in Background function


I would like to know more Ideal way of achieving this task.


Currently my code which does not work properly.



public class ShopListView extends FragmentActivity {

public static Location currentLocation;
private static LocationTracker lTracker;
private static final String TAG = "ShopListView";
private GetList mTask=null;
private String mIntent="showPopular";
ListView lview;
boolean flagCategory=false;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_shop_list_view);
lview= (ListView) findViewById(R.id.listView1);
RadioGroup radioGroupListSelector = (RadioGroup) findViewById(R.id.radio_group_list_selector);
radioGroupListSelector.setOnCheckedChangeListener(new OnCheckedChangeListener()
{

public void onCheckedChanged(RadioGroup group, int checkedId) {
// checkedId is the RadioButton selected

switch (checkedId) {
case R.id.radioPopular :
Log.i(TAG,"Popular Radio Button Selected");

if(mTask!=null)
{
mTask.cancel(true);
Log.i(TAG,"Canceling Current Task");
}
else
{
mTask=new GetList();
mTask.execute("showPopular");
}

break;
case R.id.radioAZ :
Log.i(TAG,"AZ Radio Button Selected");

if(mTask!=null)
{
mTask.cancel(true);
Log.i(TAG,"Canceling Current Task");
}
else
{
mTask=new GetList();
mTask.execute("showAZ");
}

break;
case R.id.radioCategory:
Log.i(TAG,"Category Radio Button Selected");

if(mTask!=null)
{
mTask.cancel(true);
Log.i(TAG,"Canceling Current Task");

}
else
{
mTask=new GetList();
mTask.execute("showCategory");
}
break;

case R.id.radioNearBy :
Log.i(TAG,"NearBy Radio Button Selected");


if(mTask!=null)
{
mTask.cancel(true);
Log.i(TAG,"Canceling Current Task");

}
else
{
mTask=new GetList();
mTask.execute("showNearBy");
}
break;

default:
if(mTask!=null)
{
mTask.cancel(true);
Log.i(TAG,"Canceling Current Task");

}

showFeatured();
Log.i(TAG,"No Radio Selected");

}
}
});




}



public void showFeatured()
{

}

public ArrayList showPopular(){
flagCategory=false;
ArrayList list=new ArrayList();
String sql="select S.shopName shopName from streetShopInfo AS S JOIN ratings AS R where S.shopName=R.shopName and R.overall >0 order by S.shopName";
Log.i(TAG,"Creating Adapter for Fetching Data");
StreetFoodDataBaseAdapter mDBAdapter= new StreetFoodDataBaseAdapter(this);
Log.i(TAG,"Adapter Ready..");
Log.i(TAG,"Creating/Opening Database");
mDBAdapter.createDatabase();
mDBAdapter.open();
Log.i(TAG,"Requesting info from getInfo function");
list=mDBAdapter.getInfo(sql,"shopName");
Log.i(TAG,"Information Retrived Passing it to SetView");
//setView(list);
mDBAdapter.close();
return list;
}

public ArrayList showNearBy() {

flagCategory=false;
ArrayList list=new ArrayList();
list=null;

String sql="select shopName shopName from streetShopInfo where distance<3";
//currentLocation=lTracker.getLocation();
Log.i(TAG,"Location Tracker Started");
StreetFoodDataBaseAdapter mDBAdapter= new StreetFoodDataBaseAdapter(this);
mDBAdapter.createDatabase();
mDBAdapter.open();
currentLocation=lTracker.getLocation();
if(mDBAdapter.validDistance() && currentLocation!=null && currentLocation.getLatitude()!=0)
{
Log.i(TAG,"Now Fetching Near By Location from DB");
list=mDBAdapter.getInfo(sql,"shopName");
Log.i(TAG,"Cursor Values Retrived into Array list");
mDBAdapter.close();
}
else
{
if(currentLocation!=null && currentLocation.getLatitude()!=0 )
{
Log.i(TAG,"Location Received");
mDBAdapter.updateDistance();
list=mDBAdapter.getInfo(sql,"shopName");
mDBAdapter.close();

}
}
return list;
}


public ArrayList showAZ(){
ArrayList list=new ArrayList();
flagCategory=false;
String sql="select shopName from streetShopInfo order by shopName";
StreetFoodDataBaseAdapter mDBAdapter= new StreetFoodDataBaseAdapter(this);
mDBAdapter.createDatabase();
mDBAdapter.open();
list=mDBAdapter.getInfo(sql,"shopName");
Log.i(TAG,"Cursor Values Retrived into Array list");
//setView(list);
mDBAdapter.close();
return list;
}

public ArrayList showCategory(){
ArrayList list=new ArrayList();
flagCategory=true;
String sql="select distinct category from streetShopInfo order by category";
StreetFoodDataBaseAdapter mDBAdapter= new StreetFoodDataBaseAdapter(this);
mDBAdapter.createDatabase();
mDBAdapter.open();
list=mDBAdapter.getInfo(sql,"category");
Log.i(TAG,"Cursor Values Retrived into Array list");
//setView(list);
mDBAdapter.close();
return list;
}










/*
* Sub Class for Asynchronous Task
*/
class GetList extends AsyncTask >
{

LinearLayout linlaHeaderProgress = (LinearLayout) findViewById(R.id.linlaHeaderProgress);
LinearLayout linlaContainer = (LinearLayout) findViewById(R.id.ListViewContainer);
@Override
protected void onPreExecute()
{
// TODO Auto-generated method stub
super.onPreExecute();
linlaContainer.setVisibility(View.GONE);
linlaHeaderProgress.setVisibility(View.VISIBLE);

}


protected ArrayList doInBackground(String... params)
{
ArrayList result = null;
// TODO Auto-generated method stub
if(params[0].equals("showNearBy") && !isCancelled())
result=showNearBy();
else if(params[0].equals("showPopular") && !isCancelled())
result=showPopular();
else if(params[0].equals("showAZ") && !isCancelled())
result=showAZ();
else if(params[0].equals("showCategory") && !isCancelled())
result=showCategory();
return result;
}

@Override
protected void onCancelled() {
super.onCancelled();

linlaHeaderProgress.setVisibility(View.GONE);
linlaContainer.setVisibility(View.VISIBLE);

// ask if user wants to try again
}

@Override
protected void onPostExecute(ArrayList result)
{
// TODO Auto-generated method stub
super.onPostExecute(result);
linlaHeaderProgress.setVisibility(View.GONE);
linlaContainer.setVisibility(View.VISIBLE);

if(result!=null)
setView(result);
else
Toast.makeText(ShopListView.this,"Sorry Your Location not available..",Toast.LENGTH_LONG).show();


}

}


}



.

stackoverflow.comm

[android help] Extending ImageView. Make the scrolls work


i'm extending ImageView to reimplement OnDraw method, but i have some problems with scroll. Now I have this in XML file:



android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
android:fillViewport="true">
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:fillViewport="true">
android:isScrollContainer="false"
android:layout_height="3000dp"
android:layout_width="3000dp"/>




The problem is i see only vertical scroll bar in my application. I can swap ScrollView and HorizontalScrollView, but it in result i will see only horizontal scroll bar. I've tried to use this code with ImageView (loaded big picture) and i saw both scrolls there.


Can you please help me to fix this little trouble?



.

stackoverflow.comm

[android help] Error while Connecting to Local Server Xampp using Android


I am writing an App in which i am trying to store data into local server in Xampp using Android, but the problem is whenever i do click on save button, cannot save data to local server xampp, i am getting my own defined error message: Error while Registering User



String strError = "Error while Registering User!";


I am using below line to connect to local server Xampp:



String url = "http://127.0.0.1/saveADDData.php";

String url = "http://10.0.2.2/saveADDData.php";


Note: I believe that i am getting problem in above paths.... please let me know what path i need to use to get run my app successuflly...


I guess i am doing mistake while setting path like above twos...


Location of my PHP file is:



E:\xampp\htdocs


Tell me where i am doing silly mistake, what are the changes i need to do to get it work for me.....


FYI : I have successfully created database along with member Table and also able to store records via SQL Query, just getting problem while trying to use Android for this....


First of all i have created a database along with table



Database Name: registration_login
Table Name: member


Secondly, i have written php class code:




$objConnect = mysql_connect("localhost","root","");
$objDB = mysql_select_db("registration_login");

$_POST["sUsername"] = "a";
$_POST["sPassword"] = "b";
$_POST["sName"] = "c";
$_POST["sEmail"] = "d";
$_POST["sTel"] = "e";

$strUsername = $_POST["sUsername"];
$strPassword = $_POST["sPassword"];
$strName = $_POST["sName"];
$strEmail = $_POST["sEmail"];
$strTel = $_POST["sTel"];

$strSQL = "SELECT * FROM member WHERE Username = '".$strUsername."' ";
$objQuery = mysql_query($strSQL);
$objResult = mysql_fetch_array($objQuery);
if($objResult)
{
$arr['StatusID'] = "0";
$arr['Error'] = "Username Exists!";
echo json_encode($arr);
exit();
}

/*** Check Email Exists ***/
$strSQL = "SELECT * FROM member WHERE Email = '".$strEmail."' ";
$objQuery = mysql_query($strSQL);
$objResult = mysql_fetch_array($objQuery);
if($objResult)
{
$arr['StatusID'] = "0";
$arr['Error'] = "Email Exists!";
echo json_encode($arr);
exit();
}

$strSQL = "INSERT INTO member (Username,Password,Name,Email,Tel)
VALUES (
'".$strUsername."',
'".$strPassword."',
'".$strName."',
'".$strEmail."',
'".$strTel."'
)
";

$objQuery = mysql_query($strSQL);
if(!$objQuery)
{
$arr['StatusID'] = "0";
$arr['Error'] = "Cannot save data!";
}
else
{
$arr['StatusID'] = "1";
$arr['Error'] = "";
}

mysql_close($objConnect);
echo json_encode($arr);
?>


.

stackoverflow.comm

[android help] Android Terminal-IDE: terminal-gcc error: arm-eabi-gcc not found


I'm using Terminal-IDE as my development environment. (Google code site here.)


Please Note


The Terminal-IDE environment is unique and its problems are likely unique. Would someone with enough "reputation" PLEASE create the tag "Terminal-IDE" for us? I don't have enough...


I'm running Terminal-IDE v 2.02 - the very latest. My Android versions are:


  • Android 4.0.3

  • Software version 2.14.531.3 71ORD

  • (the rest aren't likely pertinent, but more on request)

I'm in a suitable development directory with a simple enough c source code file ready and run 'make'.


I have never yet gotten any compilation to work successfully. Most likely, there's a version mis-match with regard to what executable is available versus what the software is looking for.


Here's the command and error message:



terminal-gcc -c -Wall -I/data/data/com.spartacusrex.spartacuside/files/local/include tester.c -o tester.o
/data/data/com.spartacusrex.spartacuside/files/system/bin/terminal-gcc[43]: arm-eabi-gcc: not found
make: *** [tester.o] Error 127


Snafu, of course. I'm not at all sure how to find out what the right compiler file name(s) should be because, on this non-rooted phone, I don't have permissions to hunt through the PATH and find the actual executables.


It may also be that PATH is set wrong. All input appreciated.



.

stackoverflow.comm

[android help] Android source code and repo - What exactly is happening when getting code


repo init


Since you seem pretty savvy, you know repo is just a python script, right? You can read it to see exactly how it works. I haven't read through the entire thing, but, basically, it wraps git and provides support for working across multiple git repositories. The idea is there is a manifest file that specifies requirements for different versions of Android. When you do repo init with an argument it looks at which git repositories it needs to clone and which git repositories you have already synced, and which branches it needs to fetch once it has obtained the proper repositories. It then handles keeping all the repositories it is managing on the proper branches. Think of repo as adding another layer to the standard git workflow (which I'll assume you're familiar with).


The first time you use repo, to get the master branch, you need to use



repo init -u https://android.googlesource.com/platform/manifest


And afterwards you need to sync all the files from the server:



repo sync


This will update your current working directory to the exact state specified by the master version of the manifest you downloaded. To checkout a different version of the AOSP, you use:



repo init -b version_name


This updates the manifest to the one that contains information about the Android version you want (also called a branch).


Don't forget to sync.



To switch to another manifest branch, repo init -b otherbranch may be used in an existing client. However, as this only updates the manifest, a subsequent repo sync (or repo sync -d) is necessary to update the working directory files.



The behavior you are experiencing may seem weird because you're probably not used to working with a system that overwrites your local state so easily. When using git, you're not supposed to init a bunch of times in the same directory. Another option, then, is to make new directories for each project. The purpose of the .repo directory is to store all the information relevant to your current repo setup (also like the .git directory). In fact, running repo init does many things:


  1. Downloads the manifest from the specified url.

  2. Tries to open or create the .repo directory.

  3. Makes sure your GPG key is set up.

  4. Clones the specified branch (which defaults to REPO_REV if none is specified).

  5. Verifies it.

  6. Checks out the appropriate branch for each of the projects.

I would assume the clone operation writes over information in the .repo folder. The reason it takes ages after the first command you run:



repo init -u https://android.googlesource.com/platform/manifest
repo sync


Is because it has to download many gigabytes of information. Now, going from the master branch to gingerbread repo knows it simply needs to drop about 68 commits which can be done very quickly.



$ repo init -u https://android.googlesource.com/platform/manifest -b gingerbread
$ repo sync
...
.repo/manifests/: discarding 68 commits
...


Ramping back up to android_4.2.2_r1 means repo needs to not just download any information needed by those commits again, but also update the current branches on all the referenced projects. This will take a long time. We are trading disk usage for processing time (=


really?


Now, this presents a problem: what if you want to compare two repo branches at once? This is difficult because when you repo init && repo sync you lose the old information you were looking at. The answer, then, is to copy the relevant information and then repo init && repo sync again. This will get annoying really fast -- thankfully repo provides a way to speed up this process if you have the disk space.


One strategy to make things quicker is to create a local mirror in a workspace/master directory. Then, checkout your desired branch from the mirror in a new directory, e.g. workspace/gingerbread . Now you can switch between branches simply by changing to the appropriate directory.


Mirror the AOSP locally:



cd workspace
mkdir master && cd master
repo init --mirror


will cause repo to mirror the remote server on your local machine. Then, when you want to switch to a new branch, you can:



mkdir ../gingerbread && cd ../gingerbread
repo init -b version_name --reference=../master


The result is a workspace with a folder containing the mirror and a folder containing the gingerbread branch referencing the mirror where possible.


The other option is to simply initialize and sync the branch you want, then copy the folder to another location and use the copy to initialize and sync again. Repo should only download what's missing.


Other repo uses:


Beyond init, repo provides support for passing commands, such as branch, to all the different git repositories in a given manifest so that you don't have to worry about that when working with the code. It also facilitates collaboration by making it easy to submit your local changes to the gerrit code review system. I'm unsure what the official reason for partitioning the AOSP into multiple git repositories is, but I would imagine it was done in order to manage the scaling issues of version control and in order to keep the project robust and fault-tolerant (if someone brakes one git repo it doesn't destroy the entire AOSP). It is also necessary to provide a way that vendors can contribute back to the source and letting them manage their own git repositories which can simply be registered with, or entered into, a overarching manifest makes sense. I didn't answer your questions line-item, but does this give you the information you are looking for?



.

stackoverflow.comm

[android help] Android custom overlay on mapview with border and image?

Android custom overlay on mapview with border and image? - Stack Overflow




















I have a requirement to display a set of custom overlay on mapview that contain an image that is downloaded from the internet. In the past i have extended Overlay and overrode draw to create the pin by drawing bitmaps and shapes onto the canvas. Is there an alternative approach to this that will allow me to overlay the map with an ImageView at a specified lat/long? I am asking as I have a custom ImageView implementation that downloads and caches images and it would be nice to re-use it in this case.


Thanks
















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










default







.

stackoverflow.comm

[android help] How to use sliding menu toggle() from fragment

android - How to use sliding menu toggle() from fragment - Stack Overflow




















In my application i have used sherlock actionbar with sliding menu.


from Sherlock Fragment activity i can use the sliding menu toggle of as like this...



switch (item.getItemId()) {

case android.R.id.home:
toggle();
break;}


but now i am trying to hide the actionbar and want to use the actionBar menu button from fragments..




i have hide the actionbar but how can i use the toggle() from fragments?


can anyone give me idea that how can i use android.R.id.home action from fragment instead of fragmentActivity?





















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










default







.

stackoverflow.comm

Sunday, April 7, 2013

[android help] connect google map with data base


The first step you can do is get set up with the Google Maps API https://developers.google.com/maps/documentation/javascript/tutorial - If you don't have latitude and longitude data you will need to choose a geocoder, google has one https://developers.google.com/maps/documentation/geocoding/ and from there you can set those lat/longs into the google map with markers with something like


var marker = new google.maps.Marker({



position: myLatlng,
map: map,
title:"My Map!"
});


Hope this helps.



.

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